/* ═══════════════════════════════════════════════════════════
   AUTH PAGES — Premium Redesign
   Login · Register · Username Selection
   ═══════════════════════════════════════════════════════════ */

:root {
    --auth-bg: #f8f9fb;
    --auth-surface: #ffffff;
    --auth-border: #e8eaef;
    --auth-border-focus: #4f46e5;
    --auth-text: #1a1a2e;
    --auth-text-secondary: #64748b;
    --auth-text-muted: #94a3b8;
    --auth-accent: #4f46e5;
    --auth-accent-hover: #4338ca;
    --auth-accent-light: rgba(79, 70, 229, 0.08);
    --auth-error: #ef4444;
    --auth-error-bg: rgba(239, 68, 68, 0.06);
    --auth-success: #22c55e;
    --auth-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --auth-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --auth-shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.08);
    --auth-radius: 12px;
    --auth-radius-lg: 16px;
    --auth-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --auth-panel-bg: #ffffff;
    --auth-input-bg: #f8f9fb;
    --auth-divider: #e8eaef;
    --auth-google-bg: #ffffff;
    --auth-google-border: #dadce0;
    --auth-google-hover: #f8f9fa;
}

body.dark {
    --auth-bg: #0d1117;
    --auth-surface: #161b22;
    --auth-border: rgba(255, 255, 255, 0.08);
    --auth-border-focus: #818cf8;
    --auth-text: #e6e8eb;
    --auth-text-secondary: #8b949e;
    --auth-text-muted: #6e7681;
    --auth-accent: #818cf8;
    --auth-accent-hover: #6366f1;
    --auth-accent-light: rgba(129, 140, 248, 0.1);
    --auth-error: #f87171;
    --auth-error-bg: rgba(248, 113, 113, 0.08);
    --auth-success: #4ade80;
    --auth-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --auth-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
    --auth-shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.35);
    --auth-panel-bg: #161b22;
    --auth-input-bg: #0d1117;
    --auth-divider: rgba(255, 255, 255, 0.06);
    --auth-google-bg: #1c2128;
    --auth-google-border: rgba(255, 255, 255, 0.1);
    --auth-google-hover: #21262d;
}

/* ── Full Page Layout ── */
.auth-page {
    min-height: 100vh;
    display: flex;
    background: var(--auth-bg);
    position: relative;
    overflow: hidden;
}

/* Subtle background pattern */
.auth-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 800px;
    height: 800px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--auth-accent-light) 0%, transparent 70%);
    pointer-events: none;
    animation: auth-glow 8s ease-in-out infinite alternate;
}

.auth-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--auth-accent-light) 0%, transparent 70%);
    pointer-events: none;
    animation: auth-glow 8s ease-in-out 4s infinite alternate;
}

@keyframes auth-glow {
    0% { opacity: 0.4; transform: scale(1); }
    100% { opacity: 0.8; transform: scale(1.1); }
}

/* ── Banner Side ── */
.auth-banner {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 100vh;
}

.auth-banner-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.65) 0%,
        rgba(0, 0, 0, 0.35) 50%,
        rgba(79, 70, 229, 0.25) 100%
    );
    z-index: 1;
}

.auth-banner-content {
    position: relative;
    z-index: 2;
    padding: 48px;
    max-width: 520px;
}

.auth-banner-quote {
    font-size: 22px;
    line-height: 1.6;
    color: #fff;
    font-style: italic;
    font-weight: 500;
    opacity: 0;
    animation: auth-fadeUp 0.8s ease 0.3s forwards;
}

.auth-banner-quote::before {
    content: '\201C';
    display: block;
    font-size: 64px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.3);
    font-style: normal;
    margin-bottom: 8px;
}

/* ── Panel Side ── */
.auth-panel {
    flex: 0 0 520px;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 48px 56px;
    background: var(--auth-panel-bg);
    position: relative;
    z-index: 2;
    overflow-y: auto;
}

/* ── Logo ── */
.auth-logo {
    position: absolute;
    top: 32px;
    left: 56px;
    z-index: 10;
}

.auth-logo .hikari-logo,
.auth-logo .hikari-login-logo {
    display: flex !important;
}

.auth-logo .hikari-login-logo span {
    color: var(--auth-text) !important;
}

.auth-logo .hikari-login-logo svg {
    color: var(--auth-accent);
}

/* ── Header ── */
.auth-header {
    margin-bottom: 32px;
}

.auth-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--auth-text);
    margin: 0 0 8px;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.auth-subtitle {
    font-size: 15px;
    color: var(--auth-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* ── Form ── */
.auth-form {
    width: 100%;
}

.auth-field {
    margin-bottom: 20px;
    position: relative;
}

.auth-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--auth-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    color: var(--auth-text);
    background: var(--auth-input-bg);
    border: 1.5px solid var(--auth-border);
    border-radius: var(--auth-radius);
    outline: none;
    transition: all var(--auth-transition);
    font-family: inherit;
}

.auth-input::placeholder {
    color: var(--auth-text-muted);
}

.auth-input:focus {
    border-color: var(--auth-border-focus);
    background: var(--auth-surface);
    box-shadow: 0 0 0 3px var(--auth-accent-light);
}

.auth-input.is-invalid {
    border-color: var(--auth-error);
    box-shadow: 0 0 0 3px var(--auth-error-bg);
}

/* Input with icon */
.auth-input-wrap {
    position: relative;
}

.auth-input-wrap .auth-input {
    padding-left: 44px;
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: var(--auth-text-muted);
    pointer-events: none;
    transition: color var(--auth-transition);
}

.auth-input:focus ~ .auth-input-icon,
.auth-input-wrap:focus-within .auth-input-icon {
    color: var(--auth-accent);
}

/* Password toggle */
.auth-pass-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--auth-text-muted);
    font-size: 18px;
    transition: color var(--auth-transition);
}

.auth-pass-toggle:hover {
    color: var(--auth-text);
}

/* Row for side-by-side fields */
.auth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ── Field Hint ── */
.auth-field-hint {
    font-size: 12px;
    color: var(--auth-text-muted);
    margin-top: 4px;
}

/* ── Errors ── */
.auth-errors {
    background: var(--auth-error-bg);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-radius: var(--auth-radius);
    padding: 12px 16px;
    margin-bottom: 20px;
    animation: auth-shake 0.4s ease;
}

.auth-errors p {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-error);
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-errors p i {
    font-size: 16px;
}

@keyframes auth-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ── Success message ── */
.auth-success {
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.15);
    border-radius: var(--auth-radius);
    padding: 12px 16px;
    margin-bottom: 20px;
}

.auth-success p {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-success);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ── Primary Button ── */
.auth-btn-primary {
    width: 100%;
    padding: 13px 24px;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    background: var(--auth-accent);
    border: none;
    border-radius: var(--auth-radius);
    cursor: pointer;
    transition: all var(--auth-transition);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.01em;
}

.auth-btn-primary:hover {
    background: var(--auth-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.3);
}

.auth-btn-primary:active {
    transform: translateY(0);
    box-shadow: none;
}

/* Ripple effect */
.auth-btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.auth-btn-primary:hover::after {
    transform: translateX(100%);
}

/* ── Google Button ── */
.auth-btn-google {
    width: 100%;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--auth-text);
    background: var(--auth-google-bg);
    border: 1.5px solid var(--auth-google-border);
    border-radius: var(--auth-radius);
    cursor: pointer;
    transition: all var(--auth-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none !important;
}

.auth-btn-google:hover {
    background: var(--auth-google-hover);
    border-color: var(--auth-border-focus);
    transform: translateY(-1px);
    box-shadow: var(--auth-shadow-sm);
    color: var(--auth-text);
    text-decoration: none !important;
}

.auth-btn-google:active {
    transform: translateY(0);
}

.auth-btn-google svg {
    flex-shrink: 0;
}

/* ── Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-divider);
}

.auth-divider span {
    font-size: 12px;
    font-weight: 700;
    color: var(--auth-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Footer link ── */
.auth-footer {
    margin-top: 28px;
    text-align: center;
}

.auth-footer p {
    margin: 0;
    font-size: 14px;
    color: var(--auth-text-secondary);
}

.auth-footer a {
    color: var(--auth-accent);
    font-weight: 700;
    text-decoration: none;
    transition: color var(--auth-transition);
}

.auth-footer a:hover {
    color: var(--auth-accent-hover);
    text-decoration: underline;
}

/* ── Forgot Password ── */
.auth-forgot {
    text-align: right;
    margin-top: -12px;
    margin-bottom: 20px;
}

.auth-forgot a {
    font-size: 13px;
    color: var(--auth-accent);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--auth-transition);
}

.auth-forgot a:hover {
    color: var(--auth-accent-hover);
    text-decoration: underline;
}

/* ── Username Availability Indicator ── */
.auth-username-status {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    display: none;
}

.auth-username-status.checking {
    display: block;
    color: var(--auth-text-muted);
    animation: auth-spin 0.8s linear infinite;
}

.auth-username-status.available {
    display: block;
    color: var(--auth-success);
}

.auth-username-status.taken {
    display: block;
    color: var(--auth-error);
}

@keyframes auth-spin {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

.auth-username-feedback {
    font-size: 12px;
    margin-top: 4px;
    font-weight: 600;
}

.auth-username-feedback.available {
    color: var(--auth-success);
}

.auth-username-feedback.taken {
    color: var(--auth-error);
}

/* ── Entrance Animations ── */
.auth-animate {
    opacity: 0;
    transform: translateY(16px);
    animation: auth-fadeUp 0.5s ease forwards;
}

.auth-animate:nth-child(1) { animation-delay: 0.05s; }
.auth-animate:nth-child(2) { animation-delay: 0.1s; }
.auth-animate:nth-child(3) { animation-delay: 0.15s; }
.auth-animate:nth-child(4) { animation-delay: 0.2s; }
.auth-animate:nth-child(5) { animation-delay: 0.25s; }
.auth-animate:nth-child(6) { animation-delay: 0.3s; }
.auth-animate:nth-child(7) { animation-delay: 0.35s; }
.auth-animate:nth-child(8) { animation-delay: 0.4s; }
.auth-animate:nth-child(9) { animation-delay: 0.45s; }
.auth-animate:nth-child(10) { animation-delay: 0.5s; }

@keyframes auth-fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Username Page — centered card variant ── */
.auth-page-centered {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-bg);
    position: relative;
    overflow: hidden;
    padding: 24px;
}

.auth-page-centered::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -15%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--auth-accent-light) 0%, transparent 70%);
    pointer-events: none;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: var(--auth-panel-bg);
    border-radius: var(--auth-radius-lg);
    border: 1px solid var(--auth-border);
    box-shadow: var(--auth-shadow-lg);
    padding: 40px;
    position: relative;
    z-index: 2;
}

.auth-card-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-card-logo .hikari-logo,
.auth-card-logo .hikari-login-logo {
    display: inline-flex !important;
    justify-content: center;
}

.auth-card-logo .hikari-login-logo span {
    color: var(--auth-text) !important;
}

/* Avatar preview for username page */
.auth-avatar-wrap {
    text-align: center;
    margin-bottom: 20px;
}

.auth-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--auth-accent-light);
    box-shadow: var(--auth-shadow);
}

.auth-welcome-name {
    font-size: 14px;
    color: var(--auth-text-secondary);
    margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
    .auth-banner {
        display: none;
    }

    .auth-panel {
        flex: 1;
        max-width: 100%;
        padding: 48px 40px;
        align-items: center;
    }

    .auth-panel > * {
        max-width: 440px;
        width: 100%;
    }

    .auth-logo {
        position: relative;
        top: auto;
        left: auto;
        margin-bottom: 32px;
    }
}

@media (max-width: 575px) {
    .auth-panel {
        padding: 32px 24px;
    }

    .auth-logo {
        margin-bottom: 24px;
    }

    .auth-title {
        font-size: 24px;
    }

    .auth-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-card {
        padding: 28px 24px;
    }
}
