/**
 * Newsletter Modal & Inline Subscription Styles
 * Academic Legal Website
 * 
 * Popup modal and inline subscription boxes
 */

/* ============================================================================
   NEWSLETTER MODAL
   ========================================================================= */

.newsletter-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.newsletter-modal.is-active {
    opacity: 1;
    visibility: visible;
}

.newsletter-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.newsletter-modal-content {
    position: relative;
    background: white;
    border-radius: var(--radius-xl, 16px);
    padding: var(--space-2xl, 48px);
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.newsletter-modal.is-active .newsletter-modal-content {
    transform: scale(1) translateY(0);
}

[data-theme="dark"] .newsletter-modal-content {
    background: var(--surface, #1e293b);
    color: var(--text-dark, #f1f5f9);
}

.newsletter-modal-close {
    position: absolute;
    top: var(--space-md, 16px);
    right: var(--space-md, 16px);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-xs, 8px);
    color: var(--text-light, #64748b);
    border-radius: var(--radius-full, 50%);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.newsletter-modal-close:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-dark, #1e293b);
}

[data-theme="dark"] .newsletter-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.newsletter-modal-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary, #1a365d) 0%, var(--accent, #3182ce) 100%);
    border-radius: var(--radius-full, 50%);
    margin-bottom: var(--space-lg, 24px);
    color: white;
}

.newsletter-modal-title {
    font-size: var(--text-2xl, 1.5rem);
    font-weight: var(--font-bold, 700);
    color: var(--text-dark, #1e293b);
    margin-bottom: var(--space-sm, 12px);
}

[data-theme="dark"] .newsletter-modal-title {
    color: white;
}

.newsletter-modal-description {
    font-size: var(--text-base, 1rem);
    color: var(--text-light, #64748b);
    margin-bottom: var(--space-xl, 32px);
    line-height: 1.6;
}

[data-theme="dark"] .newsletter-modal-description {
    color: var(--text-muted, #94a3b8);
}

.newsletter-modal-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm, 12px);
}

.newsletter-modal-input {
    padding: var(--space-md, 16px);
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-lg, 12px);
    font-size: var(--text-base, 1rem);
    width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.newsletter-modal-input:focus {
    outline: none;
    border-color: var(--primary, #1a365d);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
}

[data-theme="dark"] .newsletter-modal-input {
    background: var(--background, #0f172a);
    border-color: var(--border-color, #334155);
    color: white;
}

[data-theme="dark"] .newsletter-modal-input:focus {
    border-color: var(--accent, #60a5fa);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.newsletter-modal-input.is-valid {
    border-color: var(--success, #38a169);
}

.newsletter-modal-input.is-invalid {
    border-color: var(--error, #e53e3e);
}

.newsletter-modal-submit {
    padding: var(--space-md, 16px) var(--space-xl, 32px);
    background: linear-gradient(135deg, var(--primary, #1a365d) 0%, var(--accent, #3182ce) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-lg, 12px);
    font-size: var(--text-base, 1rem);
    font-weight: var(--font-semibold, 600);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.newsletter-modal-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(26, 54, 93, 0.3);
}

.newsletter-modal-submit:active {
    transform: translateY(0);
}

.newsletter-modal-submit.is-loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.newsletter-modal-submit.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: modal-spinner 0.6s linear infinite;
}

@keyframes modal-spinner {
    to { transform: rotate(360deg); }
}

.newsletter-modal-message {
    margin-top: var(--space-md, 16px);
    padding: var(--space-sm, 12px);
    border-radius: var(--radius-md, 8px);
    font-size: var(--text-sm, 0.875rem);
}

.newsletter-modal-message.success {
    background: rgba(56, 161, 105, 0.1);
    color: var(--success, #276749);
    border: 1px solid rgba(56, 161, 105, 0.3);
}

.newsletter-modal-message.error {
    background: rgba(229, 62, 62, 0.1);
    color: var(--error, #c53030);
    border: 1px solid rgba(229, 62, 62, 0.3);
}

[data-theme="dark"] .newsletter-modal-message.success {
    background: rgba(56, 161, 105, 0.15);
    color: #68d391;
}

[data-theme="dark"] .newsletter-modal-message.error {
    background: rgba(229, 62, 62, 0.15);
    color: #fc8181;
}

.newsletter-modal-note {
    margin-top: var(--space-md, 16px);
    font-size: var(--text-sm, 0.875rem);
    color: var(--text-muted, #94a3b8);
}

/* ============================================================================
   INLINE NEWSLETTER BOX
   ========================================================================= */

.newsletter-inline {
    background: linear-gradient(135deg, var(--primary, #1a365d) 0%, #2d4a7c 100%);
    border-radius: var(--radius-xl, 16px);
    padding: var(--space-xl, 32px);
    margin: var(--space-2xl, 48px) 0;
    color: white;
    text-align: center;
}

[data-theme="dark"] .newsletter-inline {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d4a7c 100%);
}

.newsletter-inline-title {
    font-size: var(--text-xl, 1.25rem);
    font-weight: var(--font-bold, 700);
    margin-bottom: var(--space-sm, 12px);
    color: white;
}

.newsletter-inline-description {
    font-size: var(--text-base, 1rem);
    opacity: 0.9;
    margin-bottom: var(--space-lg, 24px);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.newsletter-inline-form {
    display: flex;
    gap: var(--space-sm, 12px);
    max-width: 450px;
    margin: 0 auto;
}

.newsletter-inline-input {
    flex: 1;
    padding: var(--space-md, 16px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg, 12px);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: var(--text-base, 1rem);
}

.newsletter-inline-input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.newsletter-inline-input:focus {
    outline: none;
    border-color: white;
    background: rgba(255, 255, 255, 0.15);
}

.newsletter-inline-submit {
    padding: var(--space-md, 16px) var(--space-xl, 32px);
    background: white;
    color: var(--primary, #1a365d);
    border: none;
    border-radius: var(--radius-lg, 12px);
    font-weight: var(--font-semibold, 600);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    white-space: nowrap;
}

.newsletter-inline-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.3);
}

.newsletter-inline-message {
    margin-top: var(--space-md, 16px);
    padding: var(--space-sm, 12px);
    border-radius: var(--radius-md, 8px);
    font-size: var(--text-sm, 0.875rem);
}

.newsletter-inline-message.success {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.newsletter-inline-message.error {
    background: rgba(229, 62, 62, 0.3);
    color: #fecaca;
}

/* Mobile responsive */
@media (max-width: 640px) {
    .newsletter-modal-content {
        padding: var(--space-xl, 32px) var(--space-lg, 24px);
    }
    
    .newsletter-inline-form {
        flex-direction: column;
    }
    
    .newsletter-inline-submit {
        width: 100%;
    }
}

/* ============================================================================
   ARTICLE NEWSLETTER BOX (Mid-article)
   ========================================================================= */

.article-newsletter {
    background: var(--surface, #f8fafc);
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-xl, 16px);
    padding: var(--space-xl, 32px);
    margin: var(--space-2xl, 48px) 0;
    text-align: center;
}

[data-theme="dark"] .article-newsletter {
    background: var(--surface, #1e293b);
    border-color: var(--border-color, #334155);
}

.article-newsletter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--primary, #1a365d);
    border-radius: var(--radius-full, 50%);
    margin-bottom: var(--space-md, 16px);
    color: white;
}

.article-newsletter-title {
    font-size: var(--text-lg, 1.125rem);
    font-weight: var(--font-bold, 700);
    color: var(--text-dark, #1e293b);
    margin-bottom: var(--space-xs, 8px);
}

[data-theme="dark"] .article-newsletter-title {
    color: white;
}

.article-newsletter-description {
    font-size: var(--text-sm, 0.875rem);
    color: var(--text-light, #64748b);
    margin-bottom: var(--space-lg, 24px);
}

[data-theme="dark"] .article-newsletter-description {
    color: var(--text-muted, #94a3b8);
}

.article-newsletter-form {
    display: flex;
    gap: var(--space-sm, 12px);
    max-width: 400px;
    margin: 0 auto;
}

.article-newsletter-input {
    flex: 1;
    padding: var(--space-sm, 12px) var(--space-md, 16px);
    border: 2px solid var(--border-color, #e2e8f0);
    border-radius: var(--radius-md, 8px);
    font-size: var(--text-sm, 0.875rem);
}

[data-theme="dark"] .article-newsletter-input {
    background: var(--background, #0f172a);
    border-color: var(--border-color, #334155);
    color: white;
}

.article-newsletter-submit {
    padding: var(--space-sm, 12px) var(--space-lg, 24px);
    background: var(--primary, #1a365d);
    color: white;
    border: none;
    border-radius: var(--radius-md, 8px);
    font-weight: var(--font-semibold, 600);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.article-newsletter-submit:hover {
    background: var(--primary-dark, #152a4a);
}

.article-newsletter-message {
    margin-top: var(--space-md, 16px);
}

@media (max-width: 480px) {
    .article-newsletter-form {
        flex-direction: column;
    }
    
    .article-newsletter-submit {
        width: 100%;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .newsletter-modal,
    .newsletter-modal-content,
    .newsletter-modal-submit,
    .newsletter-inline-submit,
    .article-newsletter-submit {
        transition: none;
    }
    
    .newsletter-modal-submit.is-loading::after {
        animation: none;
    }
}
