/* ============================================
   BOMAtlas Newsletter Modal
   Animated subscription modal with accessibility
   ============================================ */

/* ============================================
   SECTION 1: Base Modal Styles
   ============================================ */

.newsletter-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    padding: 16px;
}

.newsletter-modal--visible {
    display: flex;
}

.popup-box {
    background: linear-gradient(135deg, #1a1f2e 0%, #0f141b 100%);
    border: 1px solid #38444d;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalFadeInScale 300ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.newsletter-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    color: #8899a6;
    font-size: 28px;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.newsletter-close:hover {
    color: #fff;
    transform: scale(1.1);
}

.newsletter-close:active {
    transform: scale(0.95);
}

.newsletter-header {
    text-align: center;
    margin-bottom: 24px;
}

.newsletter-logo {
    font-size: 32px;
    margin-bottom: 12px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
}

.newsletter-logo-accent {
    background: linear-gradient(135deg, #FFA028 0%, #FFB85C 50%, #FF8C00 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 8s ease infinite;
}

.newsletter-header h3 {
    color: #fff;
    font-size: 22px;
    margin: 0 0 8px 0;
    font-weight: 700;
}

.newsletter-header p {
    color: #8899a6;
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

.newsletter-disclaimer {
    color: #657786;
    font-size: 11px;
    text-align: center;
    margin: 16px 0 0 0;
}

/* ============================================
   SECTION 2: Form Elements
   ============================================ */

.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#popupEmail {
    background: #0f141b;
    border: 1px solid #38444d;
    border-radius: 8px;
    padding: 16px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
}

#popupEmail:focus {
    border-color: #FFA028;
    box-shadow: 0 0 0 3px rgba(255, 160, 40, 0.1);
}

#popupEmail::placeholder {
    color: #657786;
}

#emailSubmitBtn {
    background: linear-gradient(135deg, #FFA028 0%, #FFB85C 100%);
    color: #0A1628;
    border: none;
    border-radius: 8px;
    padding: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#emailSubmitBtn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 160, 40, 0.4);
}

#emailSubmitBtn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(255, 160, 40, 0.3);
}

#emailSubmitBtn:disabled {
    cursor: not-allowed;
    opacity: 0.8;
}

.newsletter-btn-text {
    display: inline-block;
}

.newsletter-icon {
    display: none;
    width: 20px;
    height: 20px;
}

/* ============================================
   SECTION 3: State Modifiers
   ============================================ */

/* Loading State */
.newsletter-modal--loading #emailSubmitBtn {
    pointer-events: none;
}

.newsletter-modal--loading .newsletter-spinner {
    display: inline-block;
    animation: spin 1s linear infinite;
}

/* Success State */
.newsletter-modal--success #emailSubmitBtn {
    background: #22c55e !important;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.newsletter-modal--success .newsletter-checkmark {
    display: inline-block;
}

.newsletter-modal--success .newsletter-checkmark polyline {
    animation: checkmarkStroke 600ms ease-out forwards;
}

/* Error State */
.newsletter-modal--error .popup-box {
    animation: shake 500ms ease-in-out;
}

.newsletter-modal--error #emailSubmitBtn {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* ============================================
   SECTION 4: Animations
   ============================================ */

@keyframes modalFadeInScale {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-8px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(8px);
    }
}

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

@keyframes checkmarkStroke {
    0% {
        stroke-dashoffset: 100;
    }
    100% {
        stroke-dashoffset: 0;
    }
}

/* ============================================
   SECTION 5: Responsive Mobile
   ============================================ */

@media (max-width: 480px) {
    .popup-box {
        padding: 24px 20px;
        border-radius: 12px;
    }

    .newsletter-logo {
        font-size: 28px;
        margin-bottom: 10px;
    }

    .newsletter-header h3 {
        font-size: 20px !important;
    }

    .newsletter-header p {
        font-size: 13px !important;
    }

    #popupEmail,
    #emailSubmitBtn {
        font-size: 16px !important;
        padding: 14px !important;
    }

    .newsletter-close {
        font-size: 24px;
        top: 8px;
        right: 8px;
    }
}
