/**
 * Newsletter Modal - Professional Multi-Step UI/UX
 * Modern, responsive, and accessible design
 */

/* ============================================
   Modal Container & Overlay
   ============================================ */

.newsletter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.newsletter-modal.active {
    display: flex;
}

.newsletter-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease-out;
}

.newsletter-modal-container {
    position: relative;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px 30px;
    animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.newsletter-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    border: none;
    background: #f8f9fa;
    color: #666;
    font-size: 24px;
    line-height: 1;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.newsletter-modal-close:hover {
    background: #e9ecef;
    color: #333;
    transform: rotate(90deg);
}

/* ============================================
   Progress Bar
   ============================================ */

.newsletter-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
    padding: 0 20px;
}

.newsletter-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
}

.newsletter-progress-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
}

.newsletter-progress-step.active .newsletter-progress-circle {
    background: linear-gradient(135deg, #8b0000 0%, #dc3545 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    transform: scale(1.1);
}

.newsletter-progress-step.completed .newsletter-progress-circle {
    background: #28a745;
    color: white;
}

.newsletter-progress-step.completed .newsletter-progress-circle::before {
    content: '✓';
    font-size: 18px;
}

.newsletter-progress-label {
    font-size: 11px;
    color: #999;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.newsletter-progress-step.active .newsletter-progress-label {
    color: #8b0000;
    font-weight: 700;
}

.newsletter-progress-line {
    flex: 1;
    height: 2px;
    background: #e9ecef;
    margin: 0 -10px;
    position: relative;
    z-index: 1;
}

/* ============================================
   Step Container
   ============================================ */

.newsletter-step {
    text-align: center;
    animation: fadeInUp 0.4s ease-out;
}

.newsletter-step-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.newsletter-step-title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin: 0 0 12px;
}

.newsletter-step-description {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
    margin: 0 0 30px;
}

.newsletter-step-description strong {
    color: #8b0000;
    font-weight: 600;
}

/* ============================================
   Form Elements
   ============================================ */

.newsletter-form-group {
    margin-bottom: 20px;
    text-align: left;
}

.newsletter-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.newsletter-form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.newsletter-form-group input:focus {
    outline: none;
    border-color: #8b0000;
    box-shadow: 0 0 0 4px rgba(0, 113, 133, 0.1);
}

.newsletter-form-group input.readonly {
    background: #f8f9fa;
    color: #666;
    cursor: not-allowed;
}

.newsletter-form-group input.error {
    border-color: #dc3545;
}

.newsletter-form-group small {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

.newsletter-code-input {
    font-family: 'Courier New', monospace;
    font-size: 24px !important;
    letter-spacing: 8px;
    text-align: center;
    font-weight: 700;
}

/* ============================================
   Buttons
   ============================================ */

.newsletter-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.newsletter-btn-primary {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
}

.newsletter-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.4);
}

.newsletter-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.newsletter-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.newsletter-btn-link {
    background: none;
    border: none;
    color: #8b0000;
    font-size: 14px;
    cursor: pointer;
    margin-top: 15px;
    padding: 8px;
    text-decoration: underline;
    font-weight: 500;
}

.newsletter-btn-link:hover {
    color: #dc3545;
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   Messages
   ============================================ */

.newsletter-step-message {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.5;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.newsletter-step-message.error {
    background: #fee;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

.newsletter-step-message.success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.error-message {
    color: #dc3545;
    font-size: 13px;
    margin-top: 6px;
    display: block;
}

/* ============================================
   reCAPTCHA Container
   ============================================ */

.newsletter-recaptcha-container {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

#newsletter-recaptcha {
    display: inline-block;
}

/* ============================================
   Success State
   ============================================ */

.newsletter-success {
    padding: 20px 0;
}

.newsletter-success-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    font-size: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.newsletter-success-title {
    font-size: 32px;
    font-weight: 700;
    color: #28a745;
    margin: 0 0 15px;
}

.newsletter-success-description {
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin: 0 0 30px;
}

/* ============================================
   Animations
   ============================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes scaleIn {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 576px) {
    .newsletter-modal-container {
        padding: 30px 20px;
        border-radius: 15px;
    }

    .newsletter-progress {
        padding: 0 10px;
    }

    .newsletter-progress-circle {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .newsletter-progress-label {
        font-size: 10px;
    }

    .newsletter-step-icon {
        font-size: 48px;
    }

    .newsletter-step-title {
        font-size: 24px;
    }

    .newsletter-step-description {
        font-size: 14px;
    }

    .newsletter-code-input {
        font-size: 20px !important;
        letter-spacing: 4px;
    }

    .newsletter-success-icon {
        width: 80px;
        height: 80px;
        font-size: 48px;
    }

    .newsletter-success-title {
        font-size: 26px;
    }
}

/* ============================================
   Accessibility
   ============================================ */

.newsletter-modal *:focus-visible {
    outline: 2px solid #8b0000;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .newsletter-modal *,
    .newsletter-modal *::before,
    .newsletter-modal *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
