/**
 * Newspaper Digital Edition - Modal Styles
 *
 * Self-contained modal stylesheet. Loaded only when the modal renders.
 * Override any of these styles with higher-specificity CSS in your theme
 * or page builder (e.g., Bricks custom CSS targeting #nde-email-modal).
 *
 * CSS variables can be overridden in your theme's :root or on the modal
 * element directly to match your site's design.
 *
 * @since 1.10.0
 */

/* =========================================================================
   Default Variables (override in your theme to customize)
   ========================================================================= */

:root {
    --nde-dark: #333333;
    --nde-dark-hover: #444444;
    --nde-text: #555555;
    --nde-text-light: #999999;
    --nde-border: #eeeeee;
    --nde-font: Tahoma, Geneva, sans-serif;
    --nde-modal-backdrop: rgba(0, 0, 0, 0.5);
    --nde-success-color: #1e7e34;
    --nde-success-bg: #edfaef;
    --nde-error-color: #cc0000;
    --nde-error-bg: #fff0f0;
}

/* =========================================================================
   Modal Overlay
   ========================================================================= */

.nde-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--nde-modal-backdrop);
}

.nde-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* =========================================================================
   Modal Content
   ========================================================================= */

.nde-modal-content {
    position: relative;
    background: #fff;
    max-width: 400px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    font-family: var(--nde-font);
}

/* Header */
.nde-modal-header {
    background: var(--nde-dark);
    padding: 25px 28px;
    position: relative;
}

.nde-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: #ffffff;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.nde-modal-close:hover {
    opacity: 1;
}

.nde-modal-close:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
    opacity: 1;
}

.nde-modal-title {
    font-family: var(--nde-font);
    font-size: 20px;
    font-weight: bold;
    color: #ffffff;
    margin: 0 0 10px 0;
    line-height: 1.3;
}

.nde-modal-subtitle {
    font-family: var(--nde-font);
    font-size: 13px;
    color: #bbbbbb;
}

/* Body */
.nde-modal-body {
    padding: 28px;
}

.nde-modal-description {
    font-family: var(--nde-font);
    font-size: 14px;
    color: var(--nde-text);
    margin: 0 0 22px 0;
    line-height: 1.5;
}

/* =========================================================================
   Email Form
   ========================================================================= */

.nde-email-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.nde-form-field label {
    display: block;
    font-family: var(--nde-font);
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--nde-text-light);
    margin-bottom: 8px;
}

.nde-form-field input[type="email"] {
    width: 100%;
    padding: 12px 14px;
    font-family: var(--nde-font);
    font-size: 14px;
    border: 1px solid var(--nde-border);
    background: #fff;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.nde-form-field input[type="email"]:focus {
    outline: 2px solid var(--nde-dark);
    outline-offset: -2px;
    border-color: var(--nde-dark);
}

.nde-form-field input[type="email"]::placeholder {
    color: #999;
}

/* Honeypot - hidden from humans */
.nde-hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

.nde-form-actions {
    margin-top: 4px;
}

.nde-submit-button {
    background: var(--nde-dark);
    color: #ffffff;
    border: none;
    padding: 14px 24px;
    font-family: var(--nde-font);
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease;
    width: 100%;
}

.nde-submit-button:hover:not(:disabled) {
    background: var(--nde-dark-hover);
}

.nde-submit-button:focus {
    outline: 2px solid var(--nde-dark);
    outline-offset: 2px;
}

.nde-submit-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================================================
   Form Messages
   ========================================================================= */

.nde-form-message {
    padding: 12px 15px;
    font-family: var(--nde-font);
    font-size: 13px;
    border-left: 3px solid;
}

.nde-form-message.nde-message-success {
    background: var(--nde-success-bg);
    color: var(--nde-success-color);
    border-color: var(--nde-success-color);
}

.nde-form-message.nde-message-error {
    background: var(--nde-error-bg);
    color: var(--nde-error-color);
    border-color: var(--nde-error-color);
}

/* =========================================================================
   Help Text
   ========================================================================= */

.nde-modal-help {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--nde-border);
}

.nde-modal-help-label {
    font-family: var(--nde-font);
    font-size: 12px;
    font-weight: bold;
    color: var(--nde-text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.nde-modal-help p {
    font-family: var(--nde-font);
    font-size: 14px;
    color: var(--nde-text);
    margin: 0;
}

.nde-modal-help .nde-help-link {
    color: var(--nde-dark);
    text-decoration: none;
}

.nde-modal-help .nde-help-link:hover {
    text-decoration: underline;
}

/* =========================================================================
   Message Icons (colorblind-safe indicators)
   ========================================================================= */

.nde-form-message.nde-message-success::before {
    content: "\2713\00a0";
}

.nde-form-message.nde-message-error::before {
    content: "\26A0\00a0";
}

/* =========================================================================
   Mobile Improvements
   ========================================================================= */

@media (max-width: 600px) {
    .nde-modal {
        position: absolute;
        min-height: 100%;
        padding: 20px 10px;
        align-items: flex-start;
    }

    .nde-modal-backdrop {
        position: fixed;
    }

    .nde-modal-content {
        max-width: none;
        max-height: none;
        overflow: visible;
    }

    .nde-modal-close {
        width: 44px;
        height: 44px;
        top: 10px;
        right: 6px;
    }

    .nde-modal-header {
        padding: 16px 20px;
        padding-right: 50px;
    }

    .nde-modal-title {
        font-size: 17px;
        margin-bottom: 4px;
    }

    .nde-modal-body {
        padding: 16px 20px;
    }

    .nde-form-field input[type="email"] {
        padding: 12px;
        font-size: 16px;
    }

    .nde-submit-button {
        padding: 16px 24px;
    }
}

/* =========================================================================
   Reduced Motion
   ========================================================================= */

@media (prefers-reduced-motion: reduce) {
    .nde-modal,
    .nde-modal-content,
    .nde-submit-button,
    .nde-modal-close,
    .nde-form-field input[type="email"] {
        transition: none !important;
        animation: none !important;
    }
}
