/**
 * Newsletter Component Fixes
 * Fixes visibility issues in both light and dark modes
 * 
 * This file should be loaded AFTER all other newsletter CSS
 */

/* ============================================================================
   HOMEPAGE NEWSLETTER CTA - LIGHT MODE
   Background: Blue gradient, Text: Must be white
   ========================================================================= */

.newsletter-cta {
    background: linear-gradient(135deg, #3182ce 0%, #2b6cb0 100%);
    color: #ffffff;
    padding: var(--space-4xl) 0;
    text-align: center;
}

.newsletter-cta h2 {
    font-family: var(--font-serif);
    font-size: var(--text-3xl);
    font-weight: var(--font-bold);
    color: #ffffff !important;
    margin-bottom: var(--space-md);
}

.newsletter-cta p {
    font-size: var(--text-lg);
    color: rgba(255, 255, 255, 0.95) !important;
    margin-bottom: var(--space-2xl);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.newsletter-cta .newsletter-privacy {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.85) !important;
}

/* Newsletter box inside CTA */
.newsletter-cta .newsletter-box {
    background: transparent;
    border: none;
    padding: 0;
}

.newsletter-cta .newsletter-box h2 {
    color: #ffffff !important;
}

.newsletter-cta .newsletter-box p {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* Form styling - Light Mode */
.newsletter-cta .newsletter-form-inline {
    display: flex;
    max-width: 500px;
    margin: 0 auto var(--space-md);
    gap: var(--space-sm);
}

.newsletter-cta .newsletter-form-inline .form-input,
.newsletter-cta .newsletter-form-inline input[type="email"] {
    flex: 1;
    padding: var(--space-md);
    background-color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-md);
    color: #1a202c;
    font-size: var(--text-base);
}

.newsletter-cta .newsletter-form-inline .form-input::placeholder,
.newsletter-cta .newsletter-form-inline input[type="email"]::placeholder {
    color: #718096;
}

.newsletter-cta .newsletter-form-inline .form-input:focus,
.newsletter-cta .newsletter-form-inline input[type="email"]:focus {
    outline: none;
    border-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

/* Subscribe button - Light Mode */
.newsletter-cta .newsletter-form-inline .btn,
.newsletter-cta .newsletter-form-inline button[type="submit"] {
    padding: var(--space-md) var(--space-xl);
    background-color: #1a365d;
    color: #ffffff !important;
    border: 2px solid #1a365d;
    border-radius: var(--radius-md);
    font-weight: var(--font-semibold);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.newsletter-cta .newsletter-form-inline .btn:hover,
.newsletter-cta .newsletter-form-inline button[type="submit"]:hover {
    background-color: #152a4a;
    border-color: #152a4a;
}

/* ============================================================================
   HOMEPAGE NEWSLETTER CTA - DARK MODE
   Background: Dark surface, Text: Light colors
   ========================================================================= */

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

[data-theme="dark"] .newsletter-cta h2,
[data-theme="dark"] .newsletter-cta .newsletter-box h2 {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .newsletter-cta p,
[data-theme="dark"] .newsletter-cta .newsletter-box p {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .newsletter-cta .newsletter-privacy {
    color: #94a3b8 !important;
}

/* Form input - Dark Mode */
[data-theme="dark"] .newsletter-cta .newsletter-form-inline .form-input,
[data-theme="dark"] .newsletter-cta .newsletter-form-inline input[type="email"] {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .newsletter-cta .newsletter-form-inline .form-input::placeholder,
[data-theme="dark"] .newsletter-cta .newsletter-form-inline input[type="email"]::placeholder {
    color: #64748b;
}

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

/* Subscribe button - Dark Mode */
[data-theme="dark"] .newsletter-cta .newsletter-form-inline .btn,
[data-theme="dark"] .newsletter-cta .newsletter-form-inline button[type="submit"] {
    background-color: #60a5fa;
    color: #0f172a !important;
    border-color: #60a5fa;
}

[data-theme="dark"] .newsletter-cta .newsletter-form-inline .btn:hover,
[data-theme="dark"] .newsletter-cta .newsletter-form-inline button[type="submit"]:hover {
    background-color: #93c5fd;
    border-color: #93c5fd;
}

/* ============================================================================
   INLINE NEWSLETTER (Inside articles/pages)
   ========================================================================= */

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

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

.newsletter-inline-description {
    font-size: var(--text-base, 1rem);
    color: rgba(255, 255, 255, 0.9) !important;
    margin-bottom: var(--space-lg, 24px);
    max-width: 500px;
    margin-left: auto;
    margin-right: 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: #ffffff;
    font-size: var(--text-base, 1rem);
}

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

.newsletter-inline-submit {
    padding: var(--space-md, 16px) var(--space-xl, 32px);
    background: #ffffff;
    color: #1a365d !important;
    border: none;
    border-radius: var(--radius-lg, 12px);
    font-weight: var(--font-semibold, 600);
    cursor: pointer;
    white-space: nowrap;
}

.newsletter-inline-submit:hover {
    background: #f1f5f9;
}

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

[data-theme="dark"] .newsletter-inline-title {
    color: #ffffff !important;
}

[data-theme="dark"] .newsletter-inline-description {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* ============================================================================
   ARTICLE NEWSLETTER BOX
   ========================================================================= */

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

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

.article-newsletter-description {
    font-size: var(--text-sm, 0.875rem);
    color: #4a5568 !important;
    margin-bottom: var(--space-lg, 24px);
}

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

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

.article-newsletter-submit:hover {
    background: #152a4a;
}

/* Dark mode article newsletter */
[data-theme="dark"] .article-newsletter {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .article-newsletter-title {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .article-newsletter-description {
    color: #94a3b8 !important;
}

[data-theme="dark"] .article-newsletter-input {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme="dark"] .article-newsletter-input::placeholder {
    color: #64748b;
}

[data-theme="dark"] .article-newsletter-submit {
    background: #60a5fa;
    color: #0f172a !important;
}

[data-theme="dark"] .article-newsletter-submit:hover {
    background: #93c5fd;
}

/* ============================================================================
   FOOTER NEWSLETTER
   Footer always has dark background
   ========================================================================= */

.site-footer .newsletter-box,
.footer-brand .newsletter-box {
    background: transparent;
    border: none;
    padding: 0;
}

.site-footer .newsletter-box h3,
.site-footer .newsletter-box h4 {
    color: #ffffff !important;
    font-size: var(--text-lg);
    margin-bottom: var(--space-sm);
}

.site-footer .newsletter-box p {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: var(--text-sm);
    margin-bottom: var(--space-md);
}

.site-footer .newsletter-form-inline {
    display: flex;
    gap: var(--space-sm);
}

.site-footer .newsletter-form-inline input[type="email"] {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: var(--text-sm);
}

.site-footer .newsletter-form-inline input[type="email"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.site-footer .newsletter-form-inline button {
    padding: var(--space-sm) var(--space-md);
    background: #60a5fa;
    color: #0f172a !important;
    border: none;
    border-radius: var(--radius-md);
    font-weight: var(--font-semibold);
    cursor: pointer;
    white-space: nowrap;
}

.site-footer .newsletter-form-inline button:hover {
    background: #93c5fd;
}

/* ============================================================================
   MESSAGE STATES
   ========================================================================= */

.newsletter-inline-message,
.newsletter-cta .newsletter-inline-message {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
}

.newsletter-inline-message.is-success,
.newsletter-cta .newsletter-inline-message.is-success {
    background: rgba(56, 161, 105, 0.15);
    color: #38a169;
    border: 1px solid rgba(56, 161, 105, 0.3);
}

.newsletter-inline-message.is-error,
.newsletter-cta .newsletter-inline-message.is-error {
    background: rgba(229, 62, 62, 0.15);
    color: #e53e3e;
    border: 1px solid rgba(229, 62, 62, 0.3);
}

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

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

/* ============================================================================
   MOBILE RESPONSIVE
   ========================================================================= */

@media (max-width: 640px) {
    .newsletter-cta .newsletter-form-inline,
    .newsletter-inline-form,
    .article-newsletter-form,
    .site-footer .newsletter-form-inline,
    .newsletter-inline-box form {
        flex-direction: column;
    }
    
    .newsletter-cta .newsletter-form-inline .btn,
    .newsletter-cta .newsletter-form-inline button[type="submit"],
    .newsletter-inline-submit,
    .article-newsletter-submit,
    .site-footer .newsletter-form-inline button,
    .newsletter-inline-box button {
        width: 100%;
    }
}

/* ============================================================================
   NEWSLETTER INLINE BOX (from renderNewsletterBox function)
   Used in articles, articles list, and other pages
   ========================================================================= */

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

.newsletter-inline-box h3 {
    font-size: var(--text-xl, 1.25rem);
    font-weight: var(--font-bold, 700);
    margin-bottom: var(--space-sm, 12px);
    color: #ffffff !important;
}

.newsletter-inline-box p {
    font-size: var(--text-base, 1rem);
    color: rgba(255, 255, 255, 0.9) !important;
    margin-bottom: var(--space-lg, 24px);
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

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

.newsletter-inline-box input[type="email"] {
    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: #ffffff;
    font-size: var(--text-base, 1rem);
}

.newsletter-inline-box input[type="email"]::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.newsletter-inline-box input[type="email"]:focus {
    outline: none;
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}

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

.newsletter-inline-box button:hover {
    background: #f1f5f9;
    transform: translateY(-2px);
}

.newsletter-inline-box button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

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

.newsletter-inline-box .newsletter-inline-message.is-success {
    background: rgba(56, 161, 105, 0.2);
    color: #68d391;
}

.newsletter-inline-box .newsletter-inline-message.is-error {
    background: rgba(229, 62, 62, 0.2);
    color: #fc8181;
}

/* Dark mode - newsletter inline box remains the same (gradient bg) */
[data-theme="dark"] .newsletter-inline-box {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d4a7c 100%);
}

[data-theme="dark"] .newsletter-inline-box h3 {
    color: #ffffff !important;
}

[data-theme="dark"] .newsletter-inline-box p {
    color: rgba(255, 255, 255, 0.9) !important;
}
