/* ══════════════════════════════════════════════════════════════
   auth.css — Auth Pages (Login, Register, Forgot Password)
   Design: Full blue live background + floating white card
   ══════════════════════════════════════════════════════════════ */

/* ─── Full-Page Animated Background ─── */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: linear-gradient(135deg, #1a73e8 0%, #0d47a1 50%, #1565c0 100%);
    position: relative;
    overflow: hidden;
}

/* Live background — floating shapes (INSIDE auth-page so they render above the gradient) */
.auth-bg-shapes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.auth-bg-shapes span {
    position: absolute;
    display: block;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.07);
    animation: float-up ease-in-out infinite;
}
.auth-bg-shapes span:nth-child(1) {
    width: 80px; height: 80px;
    bottom: -80px; left: 8%;
    animation-duration: 16s;
    animation-delay: 0s;
    background: rgba(255,255,255,0.08);
}
.auth-bg-shapes span:nth-child(2) {
    width: 50px; height: 50px;
    bottom: -50px; left: 20%;
    animation-duration: 12s;
    animation-delay: -2s;
    background: rgba(255,255,255,0.1);
}
.auth-bg-shapes span:nth-child(3) {
    width: 140px; height: 140px;
    bottom: -140px; left: 35%;
    animation-duration: 20s;
    animation-delay: -4s;
    background: rgba(255,255,255,0.05);
}
.auth-bg-shapes span:nth-child(4) {
    width: 60px; height: 60px;
    bottom: -60px; left: 50%;
    animation-duration: 14s;
    animation-delay: -6s;
    background: rgba(255,255,255,0.09);
}
.auth-bg-shapes span:nth-child(5) {
    width: 100px; height: 100px;
    bottom: -100px; left: 65%;
    animation-duration: 18s;
    animation-delay: -3s;
    background: rgba(255,255,255,0.06);
}
.auth-bg-shapes span:nth-child(6) {
    width: 45px; height: 45px;
    bottom: -45px; left: 78%;
    animation-duration: 11s;
    animation-delay: -5s;
    background: rgba(255,255,255,0.12);
}
.auth-bg-shapes span:nth-child(7) {
    width: 70px; height: 70px;
    bottom: -70px; left: 88%;
    animation-duration: 15s;
    animation-delay: -7s;
    background: rgba(255,255,255,0.08);
}
.auth-bg-shapes span:nth-child(8) {
    width: 120px; height: 120px;
    bottom: -120px; left: 42%;
    animation-duration: 22s;
    animation-delay: -1s;
    background: rgba(255,255,255,0.04);
}

/* Circles float from bottom to top, drift sideways */
@keyframes float-up {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-110vh) translateX(80px) rotate(720deg);
        opacity: 0;
    }
}

/* ─── Back Button — Own card at top-left ─── */
.auth-back-card {
    position: fixed;
    top: var(--space-5);
    left: var(--space-5);
    z-index: 10;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 100px;
    padding: var(--space-2) var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: #ffffff;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}
.auth-back-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-2px);
}
.auth-back-card svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ─── Left Panel — Branding (on blue bg) ─── */
.auth-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-10);
    position: relative;
    z-index: 1;
    color: #ffffff;
}
.auth-panel__content {
    max-width: 380px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.auth-panel__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-10);
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: #ffffff;
}
.auth-panel__logo svg {
    opacity: 0.9;
}
.auth-panel__title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: var(--space-4);
}
.auth-panel__desc {
    font-size: var(--font-size-base);
    opacity: 0.85;
    line-height: 1.6;
    margin-bottom: var(--space-8);
}

/* Feature list */
.auth-panel__features {
    list-style: none;
    text-align: left;
}
.auth-panel__features li {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--font-size-sm);
    padding: var(--space-2) 0;
    opacity: 0.9;
}
.auth-panel__features li svg {
    flex-shrink: 0;
    opacity: 0.7;
}

/* ─── Cartoon Letter Characters ─── */
.auth-letters-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding: var(--space-4) 0 var(--space-2);
    z-index: 1;
    min-height: 110px;
}

.auth-letter {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 -1px;
    animation: letter-idle 2.5s ease-in-out infinite;
    cursor: default;
    user-select: none;
    transition: transform 0.2s ease;
}

/* Stagger idle animation per letter */
.auth-letter:nth-child(1) { animation-delay: 0s; }
.auth-letter:nth-child(2) { animation-delay: 0.15s; }
.auth-letter:nth-child(3) { animation-delay: 0.3s; }
.auth-letter:nth-child(4) { animation-delay: 0.45s; }
.auth-letter:nth-child(5) { animation-delay: 0.6s; }
.auth-letter:nth-child(6) { animation-delay: 0.75s; }

/* The letter character - Manual graffiti bubble style */
.auth-letter__char {
    font-family: 'Arial Black', 'Arial', sans-serif;
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    color: var(--letter-fill, #64B5F6);
    -webkit-text-stroke: 6px var(--letter-stroke, #1a237e);
    paint-order: stroke fill;
    text-shadow:
        /* Shine highlight (top-left) */
        -1px -2px 1px rgba(255, 255, 255, 0.5),
        /* Depth outline layers */
        2px 2px 0 var(--letter-stroke, #1a237e),
        3px 3px 0 var(--letter-stroke, #1a237e),
        /* Drop shadow */
        4px 5px 3px rgba(0, 0, 0, 0.35);
    position: relative;
    z-index: 1;
}

/* Inner shine overlay via pseudo-element */
.auth-letter__char::after {
    content: attr(data-char);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.45) 0%,
        rgba(255, 255, 255, 0.15) 30%,
        transparent 55%
    );
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 0;
    text-shadow: none;
    z-index: 3;
    pointer-events: none;
}

/* ─── Goggle-style Eyes ─── */
.auth-letter__face {
    position: absolute;
    top: var(--eye-top, 20%);
    left: var(--eye-left, 50%);
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
    z-index: 5;
    pointer-events: none;
}

/* Unique eye position per letter */
.auth-letter:nth-child(1) .auth-letter__face { --eye-top: 15%; --eye-left: 50%; }
.auth-letter:nth-child(2) .auth-letter__face { --eye-top: 25%; --eye-left: 55%; }
.auth-letter:nth-child(3) .auth-letter__face { --eye-top: 18%; --eye-left: 45%; }
.auth-letter:nth-child(4) .auth-letter__face { --eye-top: 22%; --eye-left: 52%; }
.auth-letter:nth-child(5) .auth-letter__face { --eye-top: 12%; --eye-left: 48%; }
.auth-letter:nth-child(6) .auth-letter__face { --eye-top: 20%; --eye-left: 54%; }

/* Eye - large white goggle */
.auth-letter__eye {
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    border: 2.5px solid #666;
    position: relative;
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.1),
        0 2px 4px rgba(0,0,0,0.15);
    overflow: hidden;
}

/* Pupil - movable via JS */
.auth-letter__pupil {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #333;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.15s ease-out;
    z-index: 2;
}

/* Pupil highlight */
.auth-letter__pupil::after {
    content: '';
    position: absolute;
    width: 3px;
    height: 3px;
    background: #fff;
    border-radius: 50%;
    top: 1px;
    right: 1px;
}

/* ─── Color palette — graffiti bubble ─── */
.auth-letter:nth-child(1) { --letter-fill: #64B5F6; --letter-stroke: #1a237e; }
.auth-letter:nth-child(2) { --letter-fill: #FF8A80; --letter-stroke: #4a0e0e; }
.auth-letter:nth-child(3) { --letter-fill: #FFD54F; --letter-stroke: #5d4037; }
.auth-letter:nth-child(4) { --letter-fill: #CE93D8; --letter-stroke: #311b92; }
.auth-letter:nth-child(5) { --letter-fill: #81D4FA; --letter-stroke: #0d47a1; }
.auth-letter:nth-child(6) { --letter-fill: #F48FB1; --letter-stroke: #880e4f; }

/* ─── Idle bobbing ─── */
@keyframes letter-idle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

/* ─── Snake animation (triggered on view switch) ─── */
.auth-letter.snake-move {
    animation: snake-chain 0.6s ease forwards !important;
}
.auth-letter.snake-move:nth-child(1) { animation-delay: 0s !important; }
.auth-letter.snake-move:nth-child(2) { animation-delay: 0.06s !important; }
.auth-letter.snake-move:nth-child(3) { animation-delay: 0.12s !important; }
.auth-letter.snake-move:nth-child(4) { animation-delay: 0.18s !important; }
.auth-letter.snake-move:nth-child(5) { animation-delay: 0.24s !important; }
.auth-letter.snake-move:nth-child(6) { animation-delay: 0.30s !important; }

@keyframes snake-chain {
    0%   { transform: translateY(0) rotate(0deg); }
    25%  { transform: translateY(-20px) rotate(-10deg) scale(1.1); }
    50%  { transform: translateY(10px) rotate(8deg) scale(0.95); }
    75%  { transform: translateY(-8px) rotate(-4deg) scale(1.03); }
    100% { transform: translateY(0) rotate(0deg) scale(1); }
}

/* Hover individual letter */
.auth-letter:hover {
    transform: translateY(-10px) scale(1.15) !important;
    z-index: 10;
}

/* ─── Button spin animation ─── */
.btn--submitting {
    position: relative;
    pointer-events: none;
    opacity: 0.85;
}
.btn--submitting::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    vertical-align: middle;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ─── Right Panel — Form ─── */
.auth-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-8);
    position: relative;
    z-index: 1;
}

.auth-card {
    background: #ffffff;
    border-radius: var(--space-4);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1);
    width: 100%;
    max-width: 420px;
    padding: var(--space-8);
    /* No base animation — controlled via JS classes only */
}

/* ─── Card view switching transitions (3D spin) ─── */
.auth-card--fade-out {
    animation: card-spin-out 0.3s ease-in forwards !important;
}
.auth-card--fade-in {
    animation: card-spin-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards !important;
}
@keyframes card-spin-out {
    from { transform: perspective(800px) rotateY(0deg) scale(1); opacity: 1; }
    to   { transform: perspective(800px) rotateY(20deg) scale(0.95); opacity: 0; }
}
@keyframes card-spin-in {
    from { transform: perspective(800px) rotateY(-20deg) scale(0.95); opacity: 0; }
    to   { transform: perspective(800px) rotateY(0deg) scale(1); opacity: 1; }
}

/* ─── Left panel text switching ─── */
.panel-text--fade-out {
    animation: panel-fade-out 0.3s ease-in forwards;
}
.panel-text--fade-in {
    animation: panel-fade-in 0.4s ease-out forwards;
}
@keyframes panel-fade-out {
    0%   { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-20px); opacity: 0; }
}
@keyframes panel-fade-in {
    0%   { transform: translateY(20px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* ─── Bubble particles (spawned by JS on view switch) ─── */
.auth-bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    pointer-events: none;
    animation: bubble-rise ease-out forwards;
    z-index: 100;
}
@keyframes bubble-rise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }
    60% {
        opacity: 0.5;
    }
    100% {
        transform: translateY(-100vh) scale(0.4);
        opacity: 0;
    }
}

/* Card header */
.auth-card__header {
    margin-bottom: var(--space-6);
}
.auth-card__title {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}
.auth-card__subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

/* Google OAuth Button */
.btn-google {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-6);
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}
.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.btn-google__icon {
    width: 20px;
    height: 20px;
}

/* Divider */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-5) 0;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e0e0e0;
}

/* Form */
.auth-form .form-group { margin-bottom: var(--space-4); }
.auth-form .form-group label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-1);
}
.auth-form .form-input {
    padding: var(--space-3) var(--space-4);
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    width: 100%;
    font-size: var(--font-size-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.auth-form .form-input:focus {
    outline: none;
    border-color: #1a73e8;
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.auth-form__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}
.auth-form__remember {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
}
.auth-form__forgot {
    font-size: var(--font-size-sm);
    color: #1a73e8;
    text-decoration: none;
    font-weight: 500;
}
.auth-form__forgot:hover { text-decoration: underline; }

.auth-card__footer {
    text-align: center;
    margin-top: var(--space-6);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}
.auth-card__footer a {
    color: #1a73e8;
    font-weight: 600;
    text-decoration: none;
}
.auth-card__footer a:hover { text-decoration: underline; }

/* Error message */
.auth-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: var(--space-3) var(--space-4);
    border-radius: 8px;
    font-size: var(--font-size-sm);
    margin-bottom: var(--space-4);
    display: none;
}
.auth-error.visible { display: block; }

/* Password toggle */
.password-wrapper {
    position: relative;
}
.password-toggle {
    position: absolute;
    right: var(--space-3);
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px;
    display: flex;
    align-items: center;
}
.password-toggle:hover { color: var(--text-primary); }

/* ─── Responsive ─── */
@media (max-width: 900px) {
    .auth-page {
        grid-template-columns: 1fr;
    }
    .auth-panel {
        display: none;
    }
    .auth-form-panel {
        min-height: 100vh;
    }
    /* Show mobile logo */
    .auth-mobile-logo {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: var(--space-2);
        margin-bottom: var(--space-6);
        font-size: var(--font-size-lg);
        font-weight: 700;
        color: #1a73e8;
    }
    .auth-back-card {
        background: rgba(255, 255, 255, 0.85);
        color: var(--text-secondary);
        border: 1px solid rgba(0,0,0,0.08);
    }
    .auth-back-card:hover {
        background: #ffffff;
        color: var(--text-primary);
    }
}
@media (min-width: 901px) {
    .auth-mobile-logo { display: none; }
}

@media (max-width: 500px) {
    .auth-form-panel { padding: var(--space-6) var(--space-4); }
    .auth-card { padding: var(--space-6); }
    .auth-back-card { top: var(--space-3); left: var(--space-3); }
}
