/* ===========================
   AUTH MODAL - TourBook Africa
   Clean Light Theme
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&display=swap');

/* ===== CSS Variables ===== */
.auth-modal-overlay {
    --auth-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Colors - Light Theme */
    --auth-primary: #48831f;
    --auth-primary-hover: #3d7019;
    --auth-primary-light: #e8f5e0;
    --auth-primary-glow: rgba(72, 131, 31, 0.15);
    --auth-bg: #ffffff;
    --auth-surface: #ffffff;
    --auth-surface-hover: #f8faf8;
    --auth-border: #e2e8f0;
    --auth-border-hover: #cbd5e1;
    --auth-text: #1a202c;
    --auth-text-muted: #64748b;
    --auth-text-subtle: #94a3b8;
    --auth-input-bg: #f8fafc;
    --auth-error: #dc2626;
    --auth-success: #16a34a;

    /* Sizing */
    --auth-radius-sm: 6px;
    --auth-radius-md: 10px;
    --auth-radius-lg: 16px;
    --auth-radius-full: 50px;

    /* Shadows */
    --auth-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 10px 20px -5px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.03);
    --auth-glow: 0 4px 14px -3px rgba(72, 131, 31, 0.4);
}

/* ===== Modal Overlay ===== */
.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(15, 23, 42, 0);
    backdrop-filter: blur(0);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--auth-font);
}

.auth-modal-overlay.active {
    display: flex;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    opacity: 1;
}

.auth-modal-overlay.closing {
    background: rgba(15, 23, 42, 0);
    backdrop-filter: blur(0);
    opacity: 0;
}

/* ===== Modal Container ===== */
.auth-modal {
    position: relative;
    width: 100%;
    max-width: 380px;
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-modal-overlay.active .auth-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.auth-modal-overlay.closing .auth-modal {
    transform: translateY(24px) scale(0.96);
    opacity: 0;
}

/* ===== Close Button (Inside Modal) ===== */
.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-border);
    border-radius: 50%;
    color: var(--auth-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
}

.auth-modal-close:hover {
    background: var(--auth-border);
    color: var(--auth-text);
    transform: rotate(90deg);
}

.auth-modal-close .material-symbols-outlined {
    font-size: 16px;
}

/* ===== Auth Card ===== */
.auth-card {
    position: relative;
    background: var(--auth-surface);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-lg);
    padding: 24px;
    padding-top: 20px;
    box-shadow: var(--auth-shadow);
}

/* ===== Card Header ===== */
.auth-card-header {
    text-align: center;
    margin-bottom: 20px;
}

.auth-card-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--auth-text);
    margin: 0 0 4px 0;
    letter-spacing: -0.3px;
}

.auth-card-header p {
    font-size: 13px;
    color: var(--auth-text-muted);
    margin: 0;
}

/* ===== Role Switcher ===== */
.auth-role-switcher {
    display: flex;
    padding: 3px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-full);
    margin-bottom: 16px;
}

.auth-role-option {
    flex: 1;
    position: relative;
}

.auth-role-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.auth-role-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--auth-radius-full);
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-role-option input:checked + .auth-role-button {
    background: #ffffff;
    color: var(--auth-text);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.auth-role-button .material-symbols-outlined {
    font-size: 16px;
}

/* ===== Tabs ===== */
.auth-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--auth-border);
}

.auth-tab-button {
    flex: 1;
    padding: 10px 0;
    font-family: var(--auth-font);
    font-size: 14px;
    font-weight: 600;
    color: var(--auth-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.auth-tab-button:hover {
    color: var(--auth-text);
}

.auth-tab-button.active {
    color: var(--auth-primary);
    border-bottom-color: var(--auth-primary);
}

/* ===== Tab Content ===== */
.auth-tab-content {
    display: none;
    animation: authFadeIn 0.25s ease;
}

.auth-tab-content.active {
    display: block;
}

@keyframes authFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Social Login ===== */
.auth-social-login {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.auth-social-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex: 1;
    height: 40px;
    font-family: var(--auth-font);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.2px;
    border-radius: var(--auth-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.auth-social-button.google {
    background: #ffffff;
    color: #374151;
    border: 1px solid var(--auth-border);
}

.auth-social-button.google:hover {
    background: #f9fafb;
    border-color: var(--auth-border-hover);
}

.auth-social-button.facebook {
    background: #1877f2;
    color: #ffffff;
    border: 1px solid #1877f2;
}

.auth-social-button.facebook:hover {
    background: #166fe5;
}

.auth-social-button svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ===== Divider ===== */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

.auth-divider-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--auth-text-subtle);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== Form ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ===== Input Group ===== */
.auth-input-group {
    position: relative;
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-text-subtle);
    pointer-events: none;
    transition: color 0.2s ease;
}

.auth-input-icon .material-symbols-outlined {
    font-size: 18px;
    display: block;
}

.auth-input-group:focus-within .auth-input-icon {
    color: var(--auth-primary);
}

.auth-form-input {
    width: 100%;
    height: 44px;
    padding: 0 14px 0 44px;
    font-family: var(--auth-font);
    font-size: 14px;
    color: var(--auth-text);
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    outline: none;
    transition: all 0.2s ease;
}

.auth-form-input::placeholder {
    color: var(--auth-text-subtle);
}

.auth-form-input:hover {
    border-color: var(--auth-border-hover);
}

.auth-form-input:focus {
    background: #ffffff;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px var(--auth-primary-glow);
}

/* Password Input */
.auth-input-group.password .auth-form-input {
    padding-right: 44px;
}

/* OTP Input Group - ensure status message displays below */
.auth-input-group.otp {
    flex-wrap: wrap;
}

.auth-input-group.otp .auth-input-icon {
    top: 22px; /* Half of input height (44px) */
}

.auth-otp-status {
    width: 100%;
    flex-basis: 100%;
    font-size: 0.75rem !important;
    margin-top: 0.25rem;
    padding: 0.25rem 0;
    text-align: left;
    order: 999; /* Push to bottom */
}

.auth-password-toggle {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--auth-text-subtle);
    cursor: pointer;
    border-radius: var(--auth-radius-sm);
    transition: all 0.2s ease;
}

.auth-password-toggle:hover {
    color: var(--auth-text);
    background: var(--auth-surface-hover);
}

.auth-password-toggle .material-symbols-outlined {
    font-size: 18px;
}

/* ===== Forgot Password ===== */
.auth-forgot-password {
    text-align: right;
    margin-top: -4px;
}

.auth-forgot-password a {
    font-size: 12px;
    font-weight: 500;
    color: var(--auth-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.auth-forgot-password a:hover {
    color: var(--auth-primary-hover);
    text-decoration: underline;
}

/* ===== Submit Button ===== */
.auth-submit-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 46px;
    margin-top: 4px;
    font-family: var(--auth-font);
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background: var(--auth-primary);
    border: none;
    border-radius: var(--auth-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-submit-button:hover {
    background: var(--auth-primary-hover);
    box-shadow: var(--auth-glow);
}

.auth-submit-button:active {
    transform: scale(0.98);
}

.auth-submit-button .material-symbols-outlined {
    font-size: 18px;
}

/* Loading State */
.auth-submit-button.loading {
    pointer-events: none;
    opacity: 0.8;
}

.auth-submit-button.loading .auth-btn-text {
    display: none;
}

.auth-submit-button.loading .auth-btn-loader {
    display: block;
}

.auth-btn-loader {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

/* ===== Terms Checkbox ===== */
.auth-terms-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 4px;
}

.auth-terms-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 1px;
    accent-color: var(--auth-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.auth-terms-checkbox label {
    font-size: 12px;
    line-height: 1.5;
    color: var(--auth-text-muted);
    cursor: pointer;
}

.auth-terms-checkbox a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-terms-checkbox a:hover {
    text-decoration: underline;
}

/* ===== Footer ===== */
.auth-footer {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--auth-border);
}

.auth-footer p {
    font-size: 12px;
    color: var(--auth-text-muted);
    margin: 0;
}

.auth-footer a {
    color: var(--auth-primary);
    font-weight: 500;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ===== Messages ===== */
.auth-error-message,
.auth-success-message {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--auth-radius-sm);
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 12px;
}

.auth-error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--auth-error);
}

.auth-success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--auth-success);
}

.auth-error-message.show,
.auth-success-message.show {
    display: flex;
}

.auth-error-message .material-symbols-outlined,
.auth-success-message .material-symbols-outlined {
    font-size: 16px;
}

/* ===== Trust Badge ===== */
.auth-trust-badge {
    display: none;
}

/* ===== Headline (Hidden) ===== */
.auth-headline {
    display: none;
}

/* ===========================
   RESPONSIVE DESIGN
   =========================== */

/* Mobile - Small (< 360px) */
@media (max-width: 359px) {
    .auth-modal-overlay {
        padding: 12px;
    }

    .auth-modal {
        max-width: 100%;
    }

    .auth-card {
        padding: 20px 16px;
    }

    .auth-card-header h2 {
        font-size: 18px;
    }

    .auth-social-button {
        height: 36px;
        font-size: 8px;
        gap: 3px;
        padding: 0 6px;
    }

    .auth-social-button svg {
        width: 12px;
        height: 12px;
    }

    .auth-form-input {
        height: 42px;
        font-size: 13px;
    }

    .auth-submit-button {
        height: 44px;
    }
}

/* Mobile - Regular (360px - 479px) */
@media (min-width: 360px) and (max-width: 479px) {
    .auth-modal {
        max-width: 340px;
    }

    .auth-card {
        padding: 22px 20px;
    }

    .auth-social-button {
        height: 38px;
        font-size: 8.5px;
        gap: 4px;
        padding: 0 8px;
    }

    .auth-social-button svg {
        width: 13px;
        height: 13px;
    }
}

/* Tablet and up (480px+) */
@media (min-width: 480px) {
    .auth-modal {
        max-width: 380px;
    }

    .auth-card {
        padding: 28px;
    }

    .auth-card-header h2 {
        font-size: 22px;
    }

    .auth-social-button {
        height: 40px;
        font-size: 9px;
        gap: 5px;
    }

    .auth-social-button svg {
        width: 14px;
        height: 14px;
    }

    .auth-form-input {
        height: 46px;
    }

    .auth-submit-button {
        height: 48px;
        font-size: 15px;
    }
}

/* Desktop (768px+) */
@media (min-width: 768px) {
    .auth-modal-close {
        width: 30px;
        height: 30px;
        top: 14px;
        right: 14px;
    }

    .auth-modal-close .material-symbols-outlined {
        font-size: 17px;
    }

    .auth-social-button {
        height: 42px;
        font-size: 10px;
        gap: 6px;
    }

    .auth-social-button svg {
        width: 15px;
        height: 15px;
    }
}

/* ===== Prevent Body Scroll ===== */
body.auth-modal-open {
    overflow: hidden;
}
