/**
 * ChopZen Newsletter Popup Styles
 * Zen aesthetic with minimal design
 */

/* ==================== */
/* Popup Overlay        */
/* ==================== */

.chopzen-newsletter-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.chopzen-newsletter-popup.popup-visible {
    opacity: 1;
    visibility: visible;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(27, 28, 25, 0.8);
    backdrop-filter: blur(4px);
}

/* ==================== */
/* Popup Container      */
/* ==================== */

.popup-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(20px) scale(0.95);
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;

    /* Huashu Modern: 渐变宣纸背景 */
    background: linear-gradient(135deg, #f8f6f1 0%, #f0ece3 100%);

    /* Huashu Modern: 微妙点状纹理叠加 */
    background-image:
        radial-gradient(circle at 1px 1px, rgba(143, 0, 13, 0.03) 1px, transparent 0),
        linear-gradient(135deg, #f8f6f1 0%, #f0ece3 100%);

    /* Huashu Modern: 柔和阴影 */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);

    color: var(--wp--preset--color--on-surface, #1b1c19);
}

.popup-visible .popup-container {
    transform: translate(-50%, -50%) translateY(0) scale(1);
}

.popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--wp--preset--color--contrast, #1b1c19);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
    transition: transform 0.2s ease, color 0.2s ease;
    border-radius: 50%;
}

.popup-close:hover {
    transform: scale(1.1);
    color: var(--wp--preset--color--primary, #8f000d);
    background-color: rgba(143, 0, 13, 0.05);
}

.popup-close:focus {
    outline: 2px solid var(--wp--preset--color--primary, #8f000d);
    outline-offset: 2px;
}

/* Popup Logo */
.popup-logo {
    text-align: center;
    margin-bottom: 16px;
}

.popup-logo img {
    width: 120px;
    height: auto;
    display: inline-block;
}

.popup-logo .logo-fallback {
    font-family: var(--wp--preset--font-family--noto-serif-sc, 'Noto Serif SC', serif);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--wp--preset--color--primary, #8f000d);
    letter-spacing: 0.05em;
}

/* ==================== */
/* Popup Content        */
/* ==================== */

.popup-content {
    padding: 48px 40px;
    text-align: center;

    /* Huashu Modern: 渐变金色边框 */
    border: 1px solid rgba(212, 163, 115, 0.3);
}

.popup-state {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== */
/* Typography           */
/* ==================== */

.popup-header h2 {
    /* Zen Editorial: Use brand primary color for heading */
    color: var(--wp--preset--color--primary, #8f000d);
    font-family: var(--wp--preset--font-family--noto-serif-sc, 'Noto Serif SC', serif);
    font-size: clamp(1.5rem, 4vw, 2rem);
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.popup-subtitle {
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-size: clamp(1rem, 2.5vw, 1.125rem);
    color: var(--wp--preset--color--contrast, #1b1c19);
    margin: 0 0 24px;
    line-height: 1.6;
}

.popup-benefits {
    text-align: left;
    margin: 32px 0;
    padding: 24px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(212, 163, 115, 0.2);
}

.popup-benefits > p:first-child {
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--wp--preset--color--contrast, #1b1c19);
    margin: 0 0 16px;
}

.popup-benefits ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popup-benefits li {
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-size: 0.9375rem;
    color: var(--wp--preset--color--contrast, #1b1c19);
    line-height: 1.6;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(212, 163, 115, 0.15);
}

.popup-benefits li:last-child {
    border-bottom: none;
}

/* ==================== */
/* Form Container       */
/* ==================== */

.popup-form-container {
    margin: 32px 0;
}

.popup-cta {
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--wp--preset--color--primary, #8f000d);
    margin: 0 0 8px;
}

.popup-incentive {
    font-family: var(--wp--preset--font-family--serif, 'Noto Serif SC', serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--wp--preset--color--secondary, #d4a373);
    margin: 0 0 24px;
}

#mailpoet-form-wrapper {
    margin: 24px 0 0;
}

.form-loading {
    padding: 16px;
    color: var(--wp--preset--color--contrast, #1b1c19);
    font-style: italic;
}

/* ==================== */
/* Disclaimer           */
/* ==================== */

.popup-disclaimer {
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-size: 0.8125rem;
    color: var(--wp--preset--color--contrast-medium, #666);
    margin: 24px 0 0;
    font-style: italic;
}

/* ==================== */
/* Success State        */
/* ==================== */

#popup-success h2 {
    color: var(--wp--preset--color--primary, #8f000d);
}

.popup-note {
    font-size: 0.875rem;
    color: var(--wp--preset--color--contrast-medium, #666);
    margin: 8px 0 24px;
}

.popup-cta-button {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, #d4a373 0%, #c9956b 100%);
    color: #1b1c19;
    text-decoration: none;
    border-radius: 8px;
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-weight: 600;
    font-size: 1rem;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(212, 163, 115, 0.3);
}

.popup-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(212, 163, 115, 0.4);
}

.popup-cta-button:focus {
    outline: 2px solid var(--wp--preset--color--secondary, #d4a373);
    outline-offset: 2px;
}

/* ==================== */
/* Already Subscribed    */
/* ==================== */

.popup-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 24px;
}

.popup-close-button {
    padding: 14px 32px;
    background-color: transparent;
    color: var(--wp--preset--color--contrast, #1b1c19);
    border: 2px solid rgba(212, 163, 115, 0.5);
    border-radius: 8px;
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.popup-close-button:hover {
    background: linear-gradient(135deg, #d4a373 0%, #c9956b 100%);
    color: #1b1c19;
    border-color: transparent;
}

/* ==================== */
/* MailPoet Form Styles */
/* ==================== */

.footer-newsletter-widget .mailpoet_form,
#mailpoet-form-wrapper .mailpoet_form {
    margin: 0;
}

.footer-newsletter-widget input[type="email"],
#mailpoet-form-wrapper input[type="email"] {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(212, 163, 115, 0.3);
    border-radius: 8px;
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-size: 1rem;
    background-color: rgba(255, 255, 255, 0.7);
    color: var(--wp--preset--color--on-surface, #1b1c19);
    transition: border-color 0.2s ease;
}

.footer-newsletter-widget input[type="email"]:focus,
#mailpoet-form-wrapper input[type="email"]:focus {
    outline: none;
    border-color: var(--wp--preset--color--primary, #8f000d);
}

.footer-newsletter-widget button[type="submit"],
#mailpoet-form-wrapper button[type="submit"] {
    width: 100%;
    padding: 14px 32px;
    background: linear-gradient(135deg, #d4a373 0%, #c9956b 100%);
    color: #1b1c19;
    border: none;
    border-radius: 8px;
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.footer-newsletter-widget button[type="submit"]:hover,
#mailpoet-form-wrapper button[type="submit"]:hover {
    background-color: #7a000a;
    transform: translateY(-2px);
}

.footer-newsletter-widget button[type="submit"]:disabled,
#mailpoet-form-wrapper button[type="submit"]:disabled {
    background-color: var(--wp--preset--color--contrast-medium, #666);
    cursor: not-allowed;
    transform: none;
}

/* ==================== */
/* Footer Widget Styles  */
/* ==================== */

.footer-newsletter-widget {
    padding: 32px 0;
}

.footer-newsletter-widget .widget-title {
    font-family: var(--wp--preset--font-family--serif, 'Noto Serif SC', serif);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--wp--preset--color--base, #fbf9f4);
    margin: 0 0 16px;
}

.footer-newsletter-widget p {
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-size: 0.9375rem;
    color: var(--wp--preset--color--base, #fbf9f4);
    margin: 0 0 8px;
}

.footer-newsletter-widget .form-incentive {
    font-size: 0.875rem;
    color: var(--wp--preset--color--secondary, #d4a373);
    margin: 8px 0 0;
}

/* ==================== */
/* Responsive           */
/* ==================== */

@media (max-width: 768px) {
    .popup-container {
        width: 95%;
        max-height: 95vh;
    }

    .popup-content {
        padding: 32px 24px;
    }

    .popup-benefits {
        padding: 16px;
    }

    .popup-actions {
        flex-direction: column;
    }

    .popup-cta-button,
    .popup-close-button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .popup-header h2 {
        font-size: 1.5rem;
    }

    .popup-incentive {
        font-size: 1.125rem;
    }
}

/* ==================== */
/* Accessibility         */
/* ==================== */

@media (prefers-reduced-motion: reduce) {
    .chopzen-newsletter-popup,
    .popup-container,
    .popup-close,
    .popup-cta-button,
    .popup-state,
    .popup-cta-button:hover {
        transition: none;
        animation: none;
    }

    .popup-cta-button:hover {
        transform: none;
    }
}

.popup-close:focus-visible,
.popup-cta-button:focus-visible,
.popup-close-button:focus-visible,
input[type="email"]:focus-visible,
button[type="submit"]:focus-visible {
    outline: 2px solid var(--wp--preset--color--primary, #8f000d);
    outline-offset: 2px;
}

@media (prefers-contrast: high) {
    .popup-container {
        border: 2px solid var(--wp--preset--color--contrast, #1b1c19);
    }

    .popup-benefits {
        border-width: 2px;
    }
}

/* ==================== */
/* Error States          */
/* ==================== */

.form-error {
    padding: 16px;
    background-color: #fef2f2;
    border: 1px solid #dc2626;
    border-radius: 4px;
    color: #991b1b;
    font-size: 0.9375rem;
    text-align: center;
}

.mailpoet_form_error {
    padding: 12px;
    background-color: #fef2f2;
    border: 1px solid #dc2626;
    border-radius: 4px;
    color: #991b1b;
    font-size: 0.875rem;
    margin-top: 12px;
}

/* ==================== */
/* Loading States        */
/* ==================== */

.form-loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(143, 0, 13, 0.3);
    border-top-color: var(--wp--preset--color--primary, #8f000d);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

button[type="submit"][disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

button[type="submit"][disabled]::after {
    display: inline-block;
    content: "";
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid rgba(251, 249, 244, 0.3);
    border-top-color: var(--wp--preset--color--base, #fbf9f4);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

/* ==================== */
/* MailPoet Response     */
/* ==================== */

.mailpoet_response {
    padding: 12px;
    margin-top: 12px;
    border-radius: 4px;
    font-size: 0.875rem;
    text-align: center;
}

.mailpoet_response.error {
    background-color: #fef2f2;
    border: 1px solid #dc2626;
    color: #991b1b;
}

.mailpoet_response.success {
    background-color: #f0fdf4;
    border: 1px solid #16a34a;
    color: #166534;
}

/* ==================== */
/* Zen Editorial Enhancements */
/* ==================== */

.popup-submit,
.newsletter-form-quick button[type="submit"] {
    /* Zen Editorial: Add gradient to submit button */
    background: linear-gradient(135deg, var(--wp--preset--color--primary, #8f000d) 0%, #7a000a 100%);
    border: none;
    color: white;
    padding: 0.875rem 1.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.popup-submit:hover,
.newsletter-form-quick button[type="submit"]:hover {
    /* Zen Editorial: Darker gradient on hover */
    background: linear-gradient(135deg, #7a000a 0%, #6a0009 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(143, 0, 13, 0.25);
}

.popup-gift {
    /* Zen Editorial: Highlight free gift with warm gold color */
    background-color: rgba(212, 163, 115, 0.1);
    border-left: 3px solid var(--wp--preset--color--secondary, #d4a373);
    padding: 0.75rem 1rem;
    margin: 1rem 0;
    font-size: 0.95rem;
}

/* Zen Editorial: Loading state animation */
.loading-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.loading-text::after {
    content: '';
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Zen Editorial: Success state styling */
.success-text {
    color: #2d6a4f;
    font-weight: 500;
}

/* Zen Editorial: Error state styling */
.error-text {
    color: #d00000;
    font-weight: 500;
}

/* ==================== */
/* Fallback Form Styles */
/* ==================== */

.fallback-subscribe-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fallback-subscribe-form .form-group {
    position: relative;
}

.fallback-subscribe-form input[type="email"] {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-size: 1rem;
    color: var(--wp--preset--color--contrast, #1b1c19);
    background-color: white;
    border: 1px solid rgba(143, 0, 13, 0.15);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.fallback-subscribe-form input[type="email"]:focus {
    outline: none;
    border-color: var(--wp--preset--color--primary, #8f000d);
    box-shadow: 0 0 0 3px rgba(143, 0, 13, 0.1);
}

.fallback-subscribe-form input[type="email"]::placeholder {
    color: rgba(27, 28, 25, 0.5);
}

.fallback-subscribe-form .subscribe-button {
    width: 100%;
    padding: 14px 16px;
    background: linear-gradient(135deg, #d4a373 0%, #c9956b 100%);
    color: #1b1c19;
    border: none;
    border-radius: 8px;
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
    box-shadow: 0 2px 8px rgba(212, 163, 115, 0.3);
}

.fallback-subscribe-form .subscribe-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(212, 163, 115, 0.4);
}

.fallback-subscribe-form .form-note {
    font-family: var(--wp--preset--font-family--sans, 'Manrope', sans-serif);
    font-size: 0.875rem;
    color: var(--wp--preset--color--contrast, #1b1c19);
    text-align: center;
    opacity: 0.8;
}
