/**
 * Authentication / Access Page Styles
 *
 * Shared styles for client sign-in/sign-up, forgot-password, and admin login.
 * These pages have a branded dark-gradient aesthetic that stays consistent
 * regardless of the selected theme.
 */

/* Theme-aware icon toggles */
.dark-hidden,
.light-hidden {
    display: inline-block;
}
html[data-theme="dark"] .dark-hidden,
html[data-theme="light"] .light-hidden {
    display: none;
}
@media (prefers-color-scheme: dark) {
    html[data-theme="system"] .dark-hidden { display: none; }
    html[data-theme="system"] .light-hidden { display: inline-block; }
}
@media (prefers-color-scheme: light) {
    html[data-theme="system"] .dark-hidden { display: inline-block; }
    html[data-theme="system"] .light-hidden { display: none; }
}

/* Base typography reset for auth pages */
.auth-page,
.auth-page * {
    font-family: var(--font-sans);
}

/* Fade-in entrance */
.anim-fade-in {
    animation: fadeIn 0.35s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Slide-up entrance */
.anim-slide-up {
    animation: slideUp 0.4s ease-out;
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Client auth: brand gradient background */
.brand-bg {
    background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 40%, #0f172a 100%);
    position: relative;
}
.brand-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(99, 102, 241, 0.06) 0%, transparent 50%);
}

/* Decorative blurred orb */
.glass-dot {
    position: absolute;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.15);
    filter: blur(40px);
}

/* Frosted trust badge */
.trust-badge {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Admin login: darker, more saturated gradient background */
.admin-bg {
    background: linear-gradient(160deg, #0a0f1a 0%, #0f172a 35%, #1a1f3a 70%, #0f172a 100%);
    position: relative;
}
.admin-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.8) 0%, transparent 70%);
}
.admin-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

/* Admin login card */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.glow-ring {
    box-shadow: 0 0 60px rgba(59, 130, 246, 0.08), 0 0 120px rgba(59, 130, 246, 0.04);
}

/* Dark input fields used on admin login */
.input-dark {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.2s ease;
}
.input-dark:focus {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: rgba(15, 23, 42, 0.8);
}

/* Mobile auth layout helpers */
@media (max-width: 1023px) {
    .mobile-scroll {
        min-height: 100dvh;
        height: auto;
        overflow-y: auto;
    }
}

@media (max-width: 640px) {
    .admin-bg {
        min-height: 100dvh;
        height: auto;
    }
}

/* ============================================================
   CLIENT AUTH THEME DROPDOWN
   ============================================================
   The auth top bar uses the same themeManager/themeUI.js wiring as
   the dashboard sidebars, but the panel opens downward and uses the
   current theme's surface tokens so it blends with the form panel.
   ============================================================ */

.auth-theme-menu {
    position: relative;
}

.auth-theme-menu .theme-menu-panel {
    position: absolute;
    top: 100%;
    bottom: auto;
    left: auto;
    right: 0;
    margin-top: 0.5rem;
    min-width: 11rem;
    width: auto;
    z-index: 50;
    display: none;
    overflow: hidden;
    background-color: var(--color-panel, #ffffff);
    border: 1px solid var(--color-line, #e2e8f0);
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.15);
}

.auth-theme-menu .theme-menu-panel.theme-menu-open {
    display: block;
    animation: authThemeMenuFadeIn 0.18s ease-out;
}

@keyframes authThemeMenuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-theme-menu .theme-menu-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border-radius: 0.625rem;
    color: var(--color-ink-secondary, #64748b);
    background: transparent;
    border: none;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.auth-theme-menu .theme-menu-option:hover,
.auth-theme-menu .theme-menu-option:focus-visible {
    background-color: var(--color-subtle, #f1f5f9);
    color: var(--color-ink, #0f172a);
    outline: none;
}

.auth-theme-menu .theme-menu-option.active {
    color: var(--color-inverse-ink, #f8fafc);
    background-color: var(--color-accent, #3b82f6);
}

.auth-theme-menu .theme-menu-check {
    margin-left: auto;
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background-color: var(--color-inverse-ink, #f8fafc);
    color: var(--color-accent, #3b82f6);
    font-size: 0.625rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.auth-theme-menu .theme-menu-option.active .theme-menu-check {
    opacity: 1;
}

.auth-theme-menu.theme-menu-open .theme-menu-chevron {
    transform: rotate(180deg);
}
