/* ===================================================
   WEEBNATION — Auth Pages Stylesheet (MVP)
   =================================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=JetBrains+Mono:wght@400;500&display=swap');

/* ===================================================
   DESIGN TOKENS
   =================================================== */
:root {
    /* Colors — Dark (default) */
    --bg: #0e0e12;
    --card-surface: #16161e;
    --accent: #ff315a;
    --accent-hover: #e6264d;
    --accent-glow: rgba(255, 49, 90, 0.4);
    --accent-glow-soft: rgba(255, 49, 90, 0.15);
    --text-primary: #f0eee8;
    --text-muted: rgba(240, 238, 232, 0.45);
    --border: rgba(255, 255, 255, 0.06);
    --border-focus: rgba(255, 49, 90, 0.4);

    /* Typography */
    --font-display: 'Bebas Neue', cursive;
    --font-body: 'DM Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Radii */
    --radius-input: 12px;
    --radius-pill: 100px;
    --radius-card: 20px;

    /* Shadows */
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-focus: 0 0 0 3px rgba(255, 49, 90, 0.15), 0 0 16px rgba(255, 49, 90, 0.1);

    /* Transitions */
    --transition: 0.2s ease;
}

/* --- Light Theme Overrides --- */
.light-theme {
    --bg: #eef0f5;
    --card-surface: #fafbfe;
    --text-primary: #1a1b2e;
    --text-muted: rgba(26, 27, 46, 0.5);
    --border: rgba(0, 0, 0, 0.1);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.06), 0 8px 32px rgba(0, 0, 0, 0.04);
}

/* ===================================================
   RESET & BASE
   =================================================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: background-color var(--transition), color var(--transition);
    position: relative;
    overflow-x: hidden;
}

/* --- Grain / Noise Overlay --- */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 128px 128px;
}

/* --- Particle Canvas --- */
#particleCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ===================================================
   AUTH CONTAINER
   =================================================== */
.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
}

/* ===================================================
   AUTH CARD
   =================================================== */
.auth-card {
    background-color: var(--card-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    padding: 40px 36px;
    box-shadow: var(--shadow-card);
    transition: background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

/* --- Header / Branding --- */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.brand {
    font-family: var(--font-display);
    font-size: 2.8rem;
    letter-spacing: 2px;
    line-height: 1;
    margin-bottom: 8px;
    user-select: none;
}

.brand-weeb {
    color: var(--accent);
}

.brand-nation {
    color: var(--text-primary);
}

.auth-subtitle {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ===================================================
   FORM
   =================================================== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Hidden form */
.auth-form.hidden {
    display: none;
}

/* --- Input Group --- */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-status {
    min-height: 16px;
    font-size: 0.75rem;
    line-height: 1.2;
    color: var(--text-muted);
}

.field-status.is-checking {
    color: var(--text-muted);
}

.field-status.is-success {
    color: #2fbf71;
}

.field-status.is-error {
    color: #ff5b6e;
}

.input-group label {
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.3px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition);
}

.input-wrapper input {
    width: 100%;
    padding: 13px 14px 13px 42px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--text-primary);
    background-color: var(--card-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-input);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-wrapper input:focus {
    border-color: var(--border-focus);
    box-shadow: var(--shadow-focus);
}

.input-wrapper input:focus~.input-icon {
    color: var(--accent);
}

/* Password toggle */
.password-toggle {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    width: 20px;
    height: 20px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition);
}

.password-toggle:hover {
    color: var(--text-primary);
}

/* --- Form Row (Remember Me / Forgot) --- */
.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    background: var(--card-surface);
    cursor: pointer;
    position: relative;
    transition: border-color var(--transition), background-color var(--transition);
    flex-shrink: 0;
}

.checkbox-group input[type="checkbox"]:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

.checkbox-group input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-group span {
    font-size: 0.82rem;
    color: var(--text-muted);
    user-select: none;
}

.forgot-link {
    font-size: 0.82rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: opacity var(--transition);
    white-space: nowrap;
}

.forgot-link:hover {
    opacity: 0.8;
}

/* --- Password Strength --- */
.password-strength {
    display: flex;
    gap: 4px;
    margin-top: -8px;
}

.strength-bar {
    flex: 1;
    height: 3px;
    border-radius: 3px;
    background-color: var(--border);
    transition: background-color 0.3s ease;
}

.strength-bar.active.weak {
    background-color: #ff4d4d;
}

.strength-bar.active.medium {
    background-color: #ffaa33;
}

.strength-bar.active.strong {
    background-color: #33cc66;
}

/* ===================================================
   BUTTONS
   =================================================== */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    font-family: var(--font-body);
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition), transform 0.1s ease;
    border: none;
    outline: none;
    text-decoration: none;
    width: 100%;
}

.btn:active {
    transform: scale(0.98);
}

/* Primary */
.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

/* Outline */
.btn-outline {
    background-color: transparent;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}

.btn-outline:hover {
    background-color: var(--accent);
    color: #ffffff;
}

/* Google Button */
.btn-google {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-weight: 500;
}

.btn-google:hover {
    border-color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.03);
}

.light-theme .btn-google:hover {
    background-color: rgba(0, 0, 0, 0.03);
}

.btn-google .google-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ===================================================
   DIVIDER
   =================================================== */
.divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 4px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--border);
}

.divider span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ===================================================
   SWITCH PROMPT (Bottom of card)
   =================================================== */
.switch-prompt {
    text-align: center;
    margin-top: 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.switch-prompt a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition);
}

.switch-prompt a:hover {
    opacity: 0.8;
}

/* ===================================================
   TERMS TEXT
   =================================================== */
.terms-text {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.terms-text a {
    color: var(--accent);
    text-decoration: none;
}

.terms-text a:hover {
    text-decoration: underline;
}

/* ===================================================
   RESPONSIVE — LARGE DESKTOP (≥1440px)
   =================================================== */
@media (min-width: 1440px) {
    .auth-container {
        max-width: 480px;
    }

    .auth-card {
        padding: 48px 44px;
    }

    .brand {
        font-size: 3.2rem;
    }

    .auth-subtitle {
        font-size: 1rem;
    }

    .input-wrapper input {
        padding: 15px 14px 15px 44px;
        font-size: 0.95rem;
    }

    .btn {
        padding: 14px 28px;
        font-size: 0.95rem;
    }
}

/* ===================================================
   RESPONSIVE — TABLET (≤768px)
   =================================================== */
@media (max-width: 768px) {
    .auth-card {
        padding: 32px 28px;
    }

    .brand {
        font-size: 2.4rem;
    }
}

/* ===================================================
   RESPONSIVE — MOBILE (≤480px)
   =================================================== */
@media (max-width: 480px) {
    body {
        padding: 16px;
        align-items: flex-start;
        padding-top: 60px;
    }

    .auth-card {
        padding: 28px 20px;
        border-radius: 16px;
    }

    .brand {
        font-size: 2rem;
    }

    .auth-subtitle {
        font-size: 0.85rem;
    }

    .btn {
        padding: 12px 20px;
        font-size: 0.88rem;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* ===================================================
   FORGOT PASSWORD STYLES
   =================================================== */

.form-description {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: color var(--transition);
}

.back-link:hover {
    color: var(--accent);
}

.success-icon,
.error-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.success-icon svg {
    color: #10b981;
    animation: scaleIn 0.3s ease;
}

.error-icon svg {
    color: var(--accent);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.success-title,
.error-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
}

.success-text,
.error-text {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.6;
    text-align: center;
}

.success-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 24px;
    border-radius: var(--radius-pill);
    background-color: var(--card-surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 500;
    box-shadow: var(--shadow-card);
    animation: toastIn 0.3s ease forwards;
    pointer-events: auto;
    white-space: nowrap;
}

.toast.removing {
    animation: toastOut 0.25s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-8px) scale(0.95); }
}

/* Responsive */
@media (max-width: 480px) {
    .toast-container {
        bottom: 72px;
    }
}
