/**
 * Listmonk WordPress Integration Styles
 * Compatible with TagDiv Newspaper theme
 * @version 1.0.0
 */

/* =============================================================================
   BASE STYLES
   ============================================================================= */

.listmonk-subscription-form {
    max-width: 500px;
    margin: 30px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid #DC2626;
    font-family: inherit;
    position: relative;
    transition: all 0.3s ease;
}

.listmonk-subscription-form:hover {
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.15);
    transform: translateY(-2px);
}

.listmonk-subscription-form.loading {
    opacity: 0.8;
    pointer-events: none;
}

/* =============================================================================
   FORM HEADER
   ============================================================================= */

.listmonk-form-header {
    text-align: center;
    margin-bottom: 25px;
}

.listmonk-form-title {
    color: #DC2626;
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
}

.listmonk-form-description {
    color: #666;
    font-size: 16px;
    margin: 0;
    line-height: 1.5;
}

/* =============================================================================
   FORM FIELDS
   ============================================================================= */

.listmonk-form {
    margin: 0;
}

.listmonk-form-group {
    margin-bottom: 20px;
    position: relative;
}

.listmonk-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.listmonk-form-group label.required::after {
    content: " *";
    color: #DC2626;
    font-weight: bold;
}

.listmonk-form-group input[type="text"],
.listmonk-form-group input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    line-height: 1.5;
    background: #fff;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.listmonk-form-group input[type="text"]:focus,
.listmonk-form-group input[type="email"]:focus {
    outline: none;
    border-color: #DC2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.listmonk-form-group input.invalid {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1) !important;
    animation: shake 0.5s ease-in-out;
}

.listmonk-form-group input.valid {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* =============================================================================
   CHECKBOX (CONSENT)
   ============================================================================= */

.listmonk-checkbox-group {
    margin: 20px 0;
}

.listmonk-checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
    color: #555;
}

.listmonk-checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
    transform: scale(1.2);
    accent-color: #DC2626;
}

.listmonk-consent-text {
    flex: 1;
}

.listmonk-consent-text a {
    color: #DC2626;
    text-decoration: underline;
}

.listmonk-consent-text a:hover {
    color: #b91c1c;
}

/* =============================================================================
   SUBMIT BUTTON
   ============================================================================= */

.listmonk-submit-btn {
    width: 100%;
    padding: 15px 20px;
    background: #DC2626;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

.listmonk-submit-btn:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

.listmonk-submit-btn:active {
    transform: translateY(0);
}

.listmonk-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.listmonk-submit-btn.loading {
    opacity: 0.8;
    cursor: not-allowed;
}

.listmonk-btn-loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Loading Spinner */
.listmonk-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* =============================================================================
   MESSAGES
   ============================================================================= */

.listmonk-message {
    margin-top: 20px;
    padding: 15px 20px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    position: relative;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.listmonk-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.listmonk-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.listmonk-message .dismiss {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: inherit;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.listmonk-message .dismiss:hover {
    opacity: 1;
}

/* =============================================================================
   STYLE VARIATIONS
   ============================================================================= */

/* Modern Style (default) */
.listmonk-style-modern {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #DC2626;
}

.listmonk-style-modern .listmonk-form-title {
    background: linear-gradient(45deg, #DC2626, #b91c1c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Classic Style */
.listmonk-style-classic {
    background: #fff;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.listmonk-style-classic .listmonk-form-title {
    color: #333;
    border-bottom: 2px solid #DC2626;
    padding-bottom: 10px;
}

/* Minimal Style */
.listmonk-style-minimal {
    background: transparent;
    border: 1px solid #e1e5e9;
    box-shadow: none;
    padding: 20px;
}

.listmonk-style-minimal .listmonk-form-title {
    font-size: 20px;
    color: #333;
}

.listmonk-style-minimal .listmonk-submit-btn {
    background: #333;
}

.listmonk-style-minimal .listmonk-submit-btn:hover {
    background: #555;
}

/* =============================================================================
   RESPONSIVE DESIGN
   ============================================================================= */

@media (max-width: 768px) {
    .listmonk-subscription-form {
        margin: 20px;
        padding: 20px;
        max-width: none;
    }
    
    .listmonk-form-title {
        font-size: 20px;
    }
    
    .listmonk-form-description {
        font-size: 14px;
    }
    
    .listmonk-form-group input[type="text"],
    .listmonk-form-group input[type="email"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .listmonk-submit-btn {
        padding: 12px 16px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .listmonk-subscription-form {
        margin: 15px;
        padding: 15px;
    }
    
    .listmonk-form-title {
        font-size: 18px;
    }
    
    .listmonk-checkbox-label {
        font-size: 13px;
    }
}

/* =============================================================================
   TAGDIV NEWSPAPER THEME COMPATIBILITY
   ============================================================================= */

/* Post Content Integration */
.td-post-content .listmonk-subscription-form {
    margin: 40px auto !important;
    font-family: inherit;
}

.td-post-content .listmonk-subscription-form .listmonk-form-title {
    font-family: inherit;
}

/* Sidebar Integration */
.td-sidebar .listmonk-subscription-form,
.td-sidebar .listmonk-sidebar-newsletter {
    margin: 20px 0 !important;
    padding: 20px !important;
    max-width: none;
}

.td-sidebar .listmonk-form-title {
    font-size: 18px;
    margin-bottom: 12px;
}

.td-sidebar .listmonk-form-description {
    font-size: 13px;
    margin-bottom: 15px;
}

.td-sidebar .listmonk-form-group {
    margin-bottom: 15px;
}

.td-sidebar .listmonk-form-group input {
    padding: 10px 12px;
    font-size: 14px;
}

.td-sidebar .listmonk-submit-btn {
    padding: 10px 15px;
    font-size: 14px;
}

/* Widget Specific Styles */
.widget.listmonk-newsletter-widget {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
}

.widget.listmonk-newsletter-widget .listmonk-subscription-form {
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Footer Integration */
.td-footer-wrapper .listmonk-subscription-form {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    backdrop-filter: blur(10px);
}

.td-footer-wrapper .listmonk-form-title {
    color: #fff !important;
}

.td-footer-wrapper .listmonk-form-description {
    color: rgba(255, 255, 255, 0.8) !important;
}

.td-footer-wrapper .listmonk-form-group label {
    color: #fff !important;
}

.td-footer-wrapper .listmonk-form-group input {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    color: #fff !important;
}

.td-footer-wrapper .listmonk-form-group input::placeholder {
    color: rgba(255, 255, 255, 0.7) !important;
}

.td-footer-wrapper .listmonk-form-group input:focus {
    border-color: #DC2626 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.3) !important;
}

.td-footer-wrapper .listmonk-consent-text {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .listmonk-subscription-form {
        background: #1a1a1a;
        border-color: #DC2626;
        color: #fff;
    }
    
    .listmonk-form-title {
        color: #DC2626;
    }
    
    .listmonk-form-description {
        color: #ccc;
    }
    
    .listmonk-form-group label {
        color: #fff;
    }
    
    .listmonk-form-group input {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .listmonk-form-group input::placeholder {
        color: #999;
    }
    
    .listmonk-message.success {
        background: #1e4d3e;
        color: #4ade80;
        border-color: #059669;
    }
    
    .listmonk-message.error {
        background: #4d1e1e;
        color: #f87171;
        border-color: #dc2626;
    }
}

/* =============================================================================
   ACCESSIBILITY ENHANCEMENTS
   ============================================================================= */

.listmonk-subscription-form:focus-within {
    outline: 2px solid #DC2626;
    outline-offset: 2px;
}

/* Skip to content for screen readers */
.listmonk-skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #DC2626;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.listmonk-skip-link:focus {
    top: 6px;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .listmonk-subscription-form {
        border: 3px solid #000;
    }
    
    .listmonk-submit-btn {
        border: 2px solid #000;
    }
    
    .listmonk-form-group input {
        border: 2px solid #000;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .listmonk-subscription-form,
    .listmonk-submit-btn,
    .listmonk-form-group input,
    .listmonk-message {
        transition: none;
        animation: none;
    }
    
    .listmonk-subscription-form:hover {
        transform: none;
    }
    
    .listmonk-submit-btn:hover {
        transform: none;
    }
}

/* =============================================================================
   PRINT STYLES
   ============================================================================= */

@media print {
    .listmonk-subscription-form {
        box-shadow: none;
        border: 2px solid #000;
        background: #fff !important;
    }
    
    .listmonk-submit-btn,
    .listmonk-message {
        display: none;
    }
    
    .listmonk-form-group input {
        border: 1px solid #000;
        background: #fff;
    }
}

/* =============================================================================
   COMPACT/INLINE VARIATIONS
   ============================================================================= */

.listmonk-subscription-form.compact {
    padding: 15px;
    max-width: 400px;
}

.listmonk-subscription-form.compact .listmonk-form-title {
    font-size: 18px;
    margin-bottom: 8px;
}

.listmonk-subscription-form.compact .listmonk-form-description {
    font-size: 13px;
    margin-bottom: 12px;
}

.listmonk-subscription-form.compact .listmonk-form-group {
    margin-bottom: 12px;
}

.listmonk-subscription-form.compact .listmonk-form-group input {
    padding: 8px 12px;
    font-size: 14px;
}

.listmonk-subscription-form.compact .listmonk-submit-btn {
    padding: 10px 15px;
    font-size: 14px;
}

/* Inline Form Style */
.listmonk-form-inline {
    display: flex;
    gap: 10px;
    align-items: end;
    max-width: 100%;
}

.listmonk-form-inline .listmonk-form-group {
    flex: 1;
    margin-bottom: 0;
}

.listmonk-form-inline .listmonk-submit-btn {
    white-space: nowrap;
    min-width: 120px;
    height: 46px;
}

@media (max-width: 600px) {
    .listmonk-form-inline {
        flex-direction: column;
        gap: 15px;
    }
    
    .listmonk-form-inline .listmonk-submit-btn {
        width: 100%;
    }
}

/* =============================================================================
   HOVER EFFECTS & ANIMATIONS
   ============================================================================= */

.td-hover-effect {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(220, 38, 38, 0.2);
}

/* Pulse animation for call-to-action */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

.listmonk-submit-btn.pulse {
    animation: pulse 2s infinite;
}

/* Success checkmark animation */
.listmonk-success-checkmark {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border-radius: 50%;
    background: #27ae60;
    color: white;
    text-align: center;
    line-height: 16px;
    font-size: 12px;
    animation: checkmarkBounce 0.6s ease-in-out;
}

@keyframes checkmarkBounce {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}