/**
 * Newsletter Modal Styles
 * Akhand News - Modern, Responsive Newsletter Popup
 * 
 * Features:
 * - Clean, minimalist design
 * - Fully responsive (mobile, tablet, desktop)
 * - Smooth animations and transitions
 * - Accessible color contrast
 */

/* ===== MODAL CONTAINER ===== */
.newsletter-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    z-index: 9999;
    animation: newsletterFadeIn 0.3s ease-out;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.newsletter-modal.show {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

/* Modal Overlay (Backdrop) */
.newsletter-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
}

/* ===== MODAL CONTENT ===== */
.newsletter-modal-content {
    position: relative;
    z-index: 2;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    animation: newsletterSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== CLOSE BUTTON ===== */
.newsletter-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
}

.newsletter-close-btn:hover {
    background-color: #f5f5f5;
    color: #333;
}

.newsletter-close-btn:active {
    transform: scale(0.95);
}

/* ===== MODAL HEADER ===== */
.newsletter-modal-header {
    padding: 40px 32px 24px;
    text-align: center;
}

.newsletter-modal-title {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.newsletter-modal-subtitle {
    margin: 12px 0 0;
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* ===== MODAL BODY ===== */
.newsletter-modal-body {
    padding: 24px 32px;
}

/* ===== FORM STYLES ===== */
.newsletter-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Form Group */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Form Input Styling */
.form-input {
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
}

.form-input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-input::placeholder {
    color: #999;
}

/* Form Input Error State */
.form-input.error {
    border-color: #e74c3c;
    background-color: #fef5f5;
}

.form-error {
    font-size: 12px;
    color: #e74c3c;
    min-height: 16px;
    margin-top: -2px;
}

/* ===== SUBMIT BUTTON ===== */
.form-submit-btn {
    padding: 12px 24px;
    margin-top: 8px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    background-color: #f58220;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
        Arial, sans-serif;
}

.form-submit-btn:hover:not(:disabled) {
    background-color: #d66e1a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(226, 170, 74, 0.3);
}

.form-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.form-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Button Text & Spinner */
.btn-text {
    display: inline;
}

.btn-spinner {
    display: inline-flex;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* ===== SUCCESS MESSAGE ===== */
.form-success {
    padding: 12px;
    background-color: #d4edda;
    color: #155724;
    font-size: 14px;
    border-radius: 6px;
    text-align: center;
    margin-top: 8px;
    animation: slideDown 0.3s ease;
}

/* ===== ERROR MESSAGE ===== */
.form-message-error {
    padding: 12px;
    background-color: #f8d7da;
    color: #721c24;
    font-size: 14px;
    border-radius: 6px;
    text-align: center;
    margin-top: 8px;
    animation: slideDown 0.3s ease;
}

/* ===== MODAL FOOTER ===== */
.newsletter-modal-footer {
    padding: 16px 32px 24px;
    text-align: center;
}

.newsletter-privacy-note {
    margin: 0;
    font-size: 12px;
    color: #999;
    line-height: 1.4;
}

.newsletter-privacy-note a {
    color: #4a90e2;
    text-decoration: none;
    transition: color 0.2s ease;
}

.newsletter-privacy-note a:hover {
    color: #2e5c8a;
    text-decoration: underline;
}

/* ===== ANIMATIONS ===== */
@keyframes newsletterFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes newsletterSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== RESPONSIVE DESIGN ===== */

/* Tablets (768px and below) */
@media (max-width: 768px) {
    .newsletter-modal {
        padding: 12px;
    }

    .newsletter-modal-content {
        width: 100%;
        max-width: 500px;
        margin: auto;
    }

    .newsletter-modal-header {
        padding: 28px 20px 16px;
        flex-shrink: 0;
    }

    .newsletter-modal-title {
        font-size: 24px;
    }

    .newsletter-modal-body {
        padding: 12px 20px;
        flex-shrink: 0;
        overflow-y: auto;
    }

    .newsletter-modal-footer {
        padding: 12px 20px 16px;
        flex-shrink: 0;
    }

    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 11px 12px;
        min-height: 44px;
    }

    .form-submit-btn {
        padding: 12px 20px;
        min-height: 44px;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    .newsletter-modal {
        padding: 0;
        align-items: flex-end;
        justify-content: flex-end;
    }

    .newsletter-modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        max-height: 95dvh;
        border-radius: 12px;
        margin: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .newsletter-modal-header {
        padding: 20px 16px 12px;
        flex-shrink: 0;
    }

    .newsletter-modal-title {
        font-size: 20px;
        margin: 0;
    }

    .newsletter-modal-subtitle {
        font-size: 13px;
        margin: 8px 0 0;
    }

    .newsletter-modal-body {
        padding: 12px 16px;
        flex-shrink: 0;
        overflow-y: auto;
        max-height: calc(95dvh - 140px);
    }

    .newsletter-modal-footer {
        padding: 12px 16px 16px;
        flex-shrink: 0;
    }

    .newsletter-form {
        gap: 12px;
    }

    .form-group {
        gap: 4px;
    }

    .form-label {
        font-size: 12px;
        font-weight: 600;
    }

    .form-input {
        padding: 12px;
        font-size: 16px;
        min-height: 44px;
        box-sizing: border-box;
    }

    .form-submit-btn {
        padding: 13px 16px;
        font-size: 15px;
        min-height: 48px;
        margin-top: 4px;
    }

    .newsletter-close-btn {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
    }

    .newsletter-close-btn svg {
        width: 24px;
        height: 24px;
    }

    .newsletter-privacy-note {
        font-size: 11px;
    }
}

/* ===== UTILITY CLASSES ===== */

/* Prevent body scroll when modal is open */
body.newsletter-modal-open {
    overflow: hidden;
}

/* Print styles */
@media print {
    .newsletter-modal {
        display: none !important;
    }
}
