/* ═══════════════════════════════════════════════════════
   AUTH.CSS  –  Login & Sign-Up pages
   Strategy: body is locked to exactly 100vh (no scroll).
   The card uses clamp() spacing so it always fits inside
   the viewport on desktop, tablet, and mobile.
   ═══════════════════════════════════════════════════════ */

/* ─── CSS Variables ──────────────────────────────────── */
:root {
    --auth-card-bg: var(--card-bg);
    --auth-input-bg: rgba(0, 0, 0, 0.02);
    --auth-input-border: rgba(0, 0, 0, 0.08);
    --auth-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

.dark-theme {
    --auth-input-bg: rgba(255, 255, 255, 0.05);
    --auth-input-border: rgba(255, 255, 255, 0.1);
    --auth-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ─── Reset html so the flex container is exactly the viewport ── */
html:has(body.auth-body) {
    height: 100%;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* ─── Body: perfect dead-centre, no scroll ───────────────────── */
.auth-body {
    background-color: var(--bg-color) !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Outfit', sans-serif !important;
    /* single-axis row flex centres the wrapper both ways */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* fill exactly the viewport – no more, no less */
    width: 100vw !important;
    height: 100vh !important;
    min-height: 100vh !important;
    box-sizing: border-box !important;
    text-align: left !important;
    overflow: hidden !important;
}

/* ─── Wrapper ────────────────────────────────────────── */
.auth-wrapper {
    width: 560px !important;
    max-width: calc(100vw - 2rem) !important;
    /* flex child: prevent it from stretching to full height */
    flex-shrink: 0;
}

/* ─── Card: fits the content, scrolls internally if needed */
.auth-card {
    width: 100%;
    max-height: calc(100vh - 2rem);
    /* card cannot be taller than the viewport */
    overflow-y: auto;
    /* card content scrolls, NOT the page */
    background: var(--auth-card-bg);
    /* Responsive vertical padding via clamp */
    padding: clamp(1.25rem, 3vh, 2rem) clamp(1.5rem, 4vw, 2.75rem);
    border-radius: 20px;
    box-shadow: var(--auth-shadow);
    border: 1px solid var(--glass-border);
    text-align: center;
    box-sizing: border-box;
    animation: authFadeIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    scrollbar-width: none;
    /* hide scrollbar – Firefox */
}

.auth-card::-webkit-scrollbar {
    display: none;
    /* hide scrollbar – Chrome/Safari */
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Logo ───────────────────────────────────────────── */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    /* Responsive bottom margin */
    margin-bottom: clamp(0.6rem, 1.5vh, 1.1rem);
    color: var(--accent);
    text-decoration: none;
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.3rem, 2.5vw, 1.7rem);
    font-weight: 700;
    transition: var(--transition);
}

.auth-logo:hover {
    transform: scale(1.04);
}

.auth-logo i {
    font-size: 1.3rem;
}

/* ─── Header ─────────────────────────────────────────── */
.auth-header {
    margin-bottom: clamp(0.6rem, 1.5vh, 1.25rem);
}

.auth-header h2 {
    font-size: clamp(1.5rem, 3vw, 1.9rem);
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.25rem;
    font-family: 'Outfit', sans-serif;
}

.auth-header p {
    color: var(--text-color);
    opacity: 0.6;
    font-size: 0.9rem;
}

/* ─── Form ───────────────────────────────────────────── */
.auth-form {
    text-align: left;
}

.auth-group {
    margin-bottom: clamp(0.6rem, 1.2vh, 1rem);
    position: relative;
}

.auth-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-color);
    opacity: 0.8;
}

.auth-input-wrapper {
    position: relative;
}

.auth-input {
    width: 100%;
    /* Responsive input height via padding */
    padding: clamp(0.55rem, 1.2vh, 0.8rem) 1.1rem;
    border-radius: 10px;
    border: 1px solid var(--auth-input-border);
    background: var(--auth-input-bg);
    color: var(--text-color);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.auth-input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--auth-card-bg);
    box-shadow: 0 0 0 3px rgba(212, 163, 115, 0.12);
}

.auth-input-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-color);
    opacity: 0.3;
    cursor: pointer;
    transition: opacity 0.3s;
}

.auth-input-icon:hover {
    opacity: 0.6;
}

/* ─── Options Row (Remember / Forgot) ───────────────── */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(0.6rem, 1.2vh, 1rem);
    font-size: 0.82rem;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    color: var(--text-color);
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.auth-remember:hover {
    opacity: 1;
}

.auth-remember input {
    accent-color: var(--accent);
}

.auth-forgot {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    position: relative;
}

.auth-forgot::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.auth-forgot:hover::after {
    width: 100%;
}

/* ─── Submit Button ──────────────────────────────────── */
.auth-btn {
    width: 100%;
    padding: clamp(0.6rem, 1.2vh, 0.85rem);
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    box-shadow: 0 4px 14px rgba(212, 163, 115, 0.3);
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 22px rgba(212, 163, 115, 0.45);
    background: #c29262;
}

/* ─── Social Login ───────────────────────────────────── */
.social-login {
    margin-top: clamp(0.6rem, 1.2vh, 1.1rem);
    margin-bottom: clamp(0.4rem, 0.8vh, 0.8rem);
}

.social-divider {
    display: flex;
    align-items: center;
    color: #999;
    font-size: 0.75rem;
    margin-bottom: clamp(0.5rem, 1vh, 0.9rem);
}

.social-divider span:first-child,
.social-divider span:last-child {
    flex: 1;
    height: 1px;
    background: #eee;
}

.social-divider span:nth-child(2) {
    padding: 0 10px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.68rem;
}

.social-container {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #eee;
    background: #fff;
    transition: all 0.2s;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
}

.social-btn:hover {
    background: #f9f9f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

/* ─── Dark mode – social ─────────────────────────────── */
.dark-theme .social-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-theme .social-divider span:first-child,
.dark-theme .social-divider span:last-child {
    background: rgba(255, 255, 255, 0.1) !important;
}

.dark-theme .social-divider {
    color: #888;
}

/* ─── Footer link ────────────────────────────────────── */
.auth-footer {
    font-size: 0.85rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-top: clamp(0.3rem, 0.6vh, 0.6rem);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ─── Dark mode – explicit overrides for auth pages ────
   body.dark-theme is set by main.js from localStorage.
   Because .auth-body uses !important on background-color,
   we need a stronger selector to win in dark mode.       */
body.dark-theme.auth-body {
    background-color: var(--bg-dark) !important;
}

body.dark-theme .auth-card {
    background: var(--card-bg) !important;
    border-color: var(--glass-border) !important;
}

body.dark-theme .auth-header h2,
body.dark-theme .auth-header p,
body.dark-theme .auth-group label,
body.dark-theme .auth-remember,
body.dark-theme .auth-footer {
    color: var(--text-light) !important;
}

body.dark-theme .auth-input {
    background: var(--auth-input-bg) !important;
    border-color: var(--auth-input-border) !important;
    color: var(--text-light) !important;
}

body.dark-theme .auth-input::placeholder {
    color: rgba(255, 255, 255, 0.35) !important;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════════════ */

/* Tablet  769 px – 1024 px: slightly narrower, same height */
@media (max-width: 1024px) and (min-width: 481px) {
    .auth-wrapper {
        width: min(500px, calc(100vw - 2rem)) !important;
    }
}

/* Mobile ≤ 480 px: fill width, allow scrolling on very small phones */
@media (max-width: 480px) {

    /* Release the html scroll-lock on small phones */
    html:has(body.auth-body) {
        overflow: auto;
        height: auto;
    }

    .auth-body {
        /* Allow native scroll; vertical padding creates even breathing room */
        overflow: auto !important;
        height: auto !important;
        min-height: 100vh !important;
        padding: 2rem 0.75rem !important;
        /* Keep flex centering — it works as long as min-height ≥ content */
        align-items: center !important;
        justify-content: center !important;
    }

    .auth-wrapper {
        width: 100% !important;
        max-width: 100% !important;
    }

    .auth-card {
        max-height: none !important;
        /* let it grow naturally on mobile */
        overflow-y: visible !important;
        padding: 1.5rem 1.1rem !important;
        border-radius: 16px;
    }

    .auth-logo {
        font-size: 1.35rem;
    }

    .auth-header h2 {
        font-size: 1.5rem;
    }
}

/* Very small ≤ 360 px */
@media (max-width: 360px) {
    .auth-card {
        padding: 1.25rem 0.9rem !important;
    }

    .auth-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
    }
}