/* ==========================================================================
   AI MOVIE — AUTHENTICATION MODAL STYLES (auth.css)
   Login, Registration, Avatar randomizer dice, Mobile friendly dialog
   ========================================================================== */

.auth-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(4, 7, 12, 0.82);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: authFadeIn 0.22s ease-out;
}

@keyframes authFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-modal-container {
    background: #141A24;
    border: 1px solid rgba(59, 75, 104, 0.6);
    border-radius: var(--radius-lg, 18px);
    width: 100%;
    max-width: 460px;
    padding: 1.85rem;
    position: relative;
    box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.85), 0 0 40px rgba(56, 189, 248, 0.12);
    animation: authSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
}

@keyframes authSlideUp {
    from { opacity: 0; transform: translateY(16px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-modal-close {
    position: absolute;
    top: 1.15rem;
    right: 1.15rem;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: var(--text-muted, #64748B);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
}

.auth-modal-close:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #FFFFFF;
    transform: rotate(90deg);
}

.auth-tabs-header {
    display: flex;
    gap: 0.45rem;
    background: rgba(11, 14, 20, 0.65);
    padding: 0.35rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(42, 54, 75, 0.8);
}

.auth-tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary, #94A3B8);
    padding: 0.65rem 1rem;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: inherit;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.auth-tab-btn.active {
    background: linear-gradient(135deg, #38BDF8 0%, #0284C7 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
}

.auth-alert {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-alert.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #FCA5A5;
}

.auth-alert.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86EFAC;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.15rem;
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auth-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary, #F1F5F9);
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-icon {
    position: absolute;
    left: 1rem;
    font-size: 1rem;
    pointer-events: none;
    color: var(--text-muted, #64748B);
}

.auth-input {
    width: 100%;
    background: #0B0E14;
    border: 1px solid #2A364B;
    color: var(--text-primary, #F1F5F9);
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    border-radius: 10px;
    font-size: 16px; /* 16px prevents iOS Safari auto-zoom! */
    font-family: inherit;
    transition: all 0.2s;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent-blue, #38BDF8);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
    background: #101622;
}

.auth-submit-btn {
    background: linear-gradient(135deg, #38BDF8 0%, #0284C7 100%);
    color: #FFFFFF;
    border: none;
    padding: 0.85rem 1.5rem;
    border-radius: 12px;
    font-size: 0.98rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(56, 189, 248, 0.35);
    transition: all 0.2s;
    margin-top: 0.4rem;
}

.auth-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(56, 189, 248, 0.45);
}

.auth-switch-prompt {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary, #94A3B8);
    display: flex;
    justify-content: center;
    gap: 0.4rem;
}

.auth-switch-prompt a {
    color: var(--accent-blue, #38BDF8);
    font-weight: 600;
    text-decoration: none;
}

.auth-switch-prompt a:hover {
    text-decoration: underline;
}

/* Avatar Creator Box in Register */
.auth-avatar-creator {
    background: rgba(11, 14, 20, 0.7);
    border: 1px solid rgba(42, 54, 75, 0.7);
    border-radius: 14px;
    padding: 0.85rem;
    display: flex;
    gap: 0.85rem;
    align-items: center;
}

.auth-avatar-preview-box {
    position: relative;
    flex-shrink: 0;
}

.auth-avatar-img {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    border: 2px solid var(--accent-blue, #38BDF8);
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
    background: #141A24;
    object-fit: cover;
    display: block;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-dice-btn {
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #38BDF8;
    color: #FFFFFF;
    border: 2px solid #141A24;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    transition: transform 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.auth-dice-btn:hover {
    transform: rotate(180deg) scale(1.1);
}

.auth-avatar-style-selector {
    flex: 1;
    min-width: 0;
}

.auth-avatar-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-secondary, #94A3B8);
    margin-bottom: 0.4rem;
}

.auth-style-badge {
    color: var(--accent-blue, #38BDF8);
    font-weight: 700;
}

.auth-style-pills {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.auth-pill-btn {
    background: rgba(20, 26, 36, 0.8);
    border: 1px solid #2A364B;
    color: var(--text-secondary, #94A3B8);
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-pill-btn:hover {
    border-color: var(--accent-blue, #38BDF8);
    color: var(--text-primary, #F1F5F9);
}

.auth-pill-btn.active {
    background: rgba(56, 189, 248, 0.2);
    border-color: var(--accent-blue, #38BDF8);
    color: var(--accent-blue, #38BDF8);
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   Mobile Adaptivity for Auth Modal (<= 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
    .auth-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .auth-modal-container {
        padding: 1.35rem 1.15rem calc(1.15rem + env(safe-area-inset-bottom, 0px));
        border-radius: 22px 22px 0 0;
        max-width: 100%;
        max-height: 85vh;
        max-height: 85dvh;
        border-bottom: none;
    }

    .auth-tabs-header {
        margin-bottom: 1.15rem;
    }

    .auth-tab-btn {
        padding: 0.55rem;
        font-size: 0.85rem;
    }

    .auth-input {
        padding: 0.68rem 0.85rem 0.68rem 2.4rem;
        font-size: 16px;
    }

    .auth-submit-btn {
        padding: 0.75rem;
        font-size: 0.92rem;
    }

    .auth-avatar-creator {
        padding: 0.65rem;
        gap: 0.65rem;
    }

    .auth-avatar-img {
        width: 52px;
        height: 52px;
    }
}
