/* ═══════════════════════════════════════════════════════════════════════════
   Nexo — Design System
   Dark/Light theme with glassmorphism, cyan/teal accent
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Google Font ─────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── CSS Variables: Dark Theme (default) ─────────────────────────────────── */
:root {
    /* Background */
    --bg-primary: #06060b;
    --bg-secondary: #0d0d14;
    --bg-card: rgba(255, 255, 255, 0.03);
    --bg-card-hover: rgba(255, 255, 255, 0.06);
    --bg-glass: rgba(15, 15, 25, 0.7);
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-input-focus: rgba(255, 255, 255, 0.08);
    --bg-header: rgba(6, 6, 11, 0.8);

    /* Accent */
    --accent: #00d4aa;
    --accent-light: #00f0c0;
    --accent-dark: #00a888;
    --accent-glow: rgba(0, 212, 170, 0.15);
    --accent-glow-strong: rgba(0, 212, 170, 0.3);

    /* Text */
    --text-primary: #e8eaf0;
    --text-secondary: #8b8fa3;
    --text-muted: #5a5e72;
    --text-accent: #00d4aa;
    --text-on-accent: #000;

    /* Border */
    --border: rgba(255, 255, 255, 0.06);
    --border-hover: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(0, 212, 170, 0.3);

    /* Error */
    --error: #ff4d6a;
    --error-bg: rgba(255, 77, 106, 0.1);

    /* Success */
    --success: #00d4aa;
    --success-bg: rgba(0, 212, 170, 0.1);

    /* Orbs */
    --orb1: rgba(0, 212, 170, 0.12);
    --orb2: rgba(0, 100, 200, 0.08);
    --orb3: rgba(120, 0, 255, 0.06);

    /* Misc */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ─── CSS Variables: Light Theme ──────────────────────────────────────────── */
[data-theme="light"] {
    --bg-primary: #f0f2f5;
    --bg-secondary: #e8eaee;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-card-hover: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.65);
    --bg-input: rgba(0, 0, 0, 0.04);
    --bg-input-focus: rgba(0, 0, 0, 0.06);
    --bg-header: rgba(240, 242, 245, 0.85);

    --text-primary: #1a1a2e;
    --text-secondary: #555770;
    --text-muted: #8b8fa3;
    --text-accent: #00997a;
    --text-on-accent: #000;

    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(0, 0, 0, 0.14);
    --border-accent: rgba(0, 168, 136, 0.35);

    --error: #e0334e;
    --error-bg: rgba(224, 51, 78, 0.08);

    --success: #00997a;
    --success-bg: rgba(0, 153, 122, 0.08);

    --orb1: rgba(0, 212, 170, 0.08);
    --orb2: rgba(0, 100, 200, 0.05);
    --orb3: rgba(120, 0, 255, 0.04);

    --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.1);

    --accent: #00b894;
    --accent-light: #00d4aa;
    --accent-dark: #00997a;
    --accent-glow: rgba(0, 184, 148, 0.12);
    --accent-glow-strong: rgba(0, 184, 148, 0.2);
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background 0.4s ease, color 0.3s ease;
}

/* ─── Background Orbs ─────────────────────────────────────────────────────── */
.bg-orbs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.4;
    animation: orbFloat 20s ease-in-out infinite;
    transition: background 0.5s ease;
}

.bg-orb--1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--orb1), transparent 70%);
    top: -200px;
    right: -200px;
    animation-delay: 0s;
}

.bg-orb--2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--orb2), transparent 70%);
    bottom: -150px;
    left: -150px;
    animation-delay: -7s;
}

.bg-orb--3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--orb3), transparent 70%);
    top: 40%;
    left: 30%;
    animation-delay: -14s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ─── App Container ───────────────────────────────────────────────────────── */
#app {
    position: relative;
    z-index: 1;
    min-height: 100vh;
}

/* ─── Theme Toggle ────────────────────────────────────────────────────────── */
.theme-toggle {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    padding: 0 4px;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--border-hover);
}

.theme-toggle__knob {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    box-shadow: 0 2px 6px var(--accent-glow-strong);
}

[data-theme="light"] .theme-toggle__knob {
    transform: translateX(22px);
}

.theme-toggle__icon {
    font-size: 10px;
    line-height: 1;
}

/* Auth screen toggle position */
.auth-theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════════════════════════════════════ */

.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    animation: fadeSlideUp 0.6s ease-out;
}

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

.auth-logo__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 14px;
}

.auth-logo__name {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent-light), var(--accent), #00a0ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-logo__tagline {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 8px;
    font-weight: 300;
}

.auth-card {
    background: var(--bg-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    transition: background 0.3s ease, border-color 0.3s ease;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 32px;
}

.auth-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    background: var(--accent);
    color: var(--text-on-accent);
    box-shadow: 0 2px 8px var(--accent-glow-strong);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

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

.form-input:focus {
    background: var(--bg-input-focus);
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input:hover:not(:focus) {
    border-color: var(--border-hover);
}

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

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.5;
}

.form-hint--error {
    color: var(--error);
}

/* Password Requirements */
.password-requirements {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.password-req {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.password-req__icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1.5px solid var(--border-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.password-req.met {
    color: var(--success);
}

.password-req.met .password-req__icon {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}

.btn--primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: var(--text-on-accent);
    box-shadow: 0 4px 16px var(--accent-glow-strong);
}

.btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px var(--accent-glow-strong);
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
}

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

.btn--primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn--ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn--ghost:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn--danger {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.btn--danger:hover {
    color: var(--error);
    background: var(--error-bg);
}

/* Alert Messages */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-out;
}

.alert--error {
    background: var(--error-bg);
    color: var(--error);
    border: 1px solid rgba(255, 77, 106, 0.2);
}

.alert--success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid rgba(0, 212, 170, 0.2);
}

.alert--info {
    background: rgba(77, 159, 255, 0.1);
    color: #4d9fff;
    border: 1px solid rgba(77, 159, 255, 0.2);
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD
   ═══════════════════════════════════════════════════════════════════════════ */

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transition: background 0.3s ease;
}

.header__inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header__logo {
    font-size: 1.4rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header__user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header__email {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Main Content */
.main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 24px 80px;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 32px;
    animation: fadeSlideUp 0.4s ease-out;
}

.stat-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: var(--transition);
}

.stat-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
}

.stat-card__label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Search */
.search-bar {
    margin-bottom: 24px;
    position: relative;
    animation: fadeSlideUp 0.5s ease-out;
}

.search-bar__icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1rem;
    pointer-events: none;
}

.search-bar__input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.search-bar__input:focus {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-bar__input::placeholder {
    color: var(--text-muted);
}

/* Word List */
.word-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.word-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    transition: var(--transition);
    animation: fadeSlideUp 0.4s ease-out;
    animation-fill-mode: backwards;
}

.word-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.word-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.word-card__word {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent);
}

.word-card__actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.word-card:hover .word-card__actions {
    opacity: 1;
}

.word-card__sentence {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.word-card__sentence mark {
    background: var(--accent-glow-strong);
    color: var(--accent-light);
    padding: 1px 4px;
    border-radius: 3px;
}

[data-theme="light"] .word-card__sentence mark {
    color: var(--accent-dark);
}

.word-card__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.word-card__date {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    animation: fadeSlideUp 0.5s ease-out;
}

.empty-state__icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.empty-state__title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state__text {
    font-size: 0.95rem;
    color: var(--text-secondary);
    max-width: 400px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
    animation: fadeIn 0.4s ease-out;
}

.pagination__btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.pagination__btn:hover:not(:disabled) {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.pagination__btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination__btn.active {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
    font-weight: 600;
}

.pagination__info {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 0 8px;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    flex-direction: column;
    gap: 16px;
}

.loading-screen .spinner {
    width: 36px;
    height: 36px;
    border-width: 3px;
}

/* ─── Animations ──────────────────────────────────────────────────────────── */
@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

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

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .auth-card {
        padding: 28px 24px;
        border-radius: var(--radius-lg);
    }

    .auth-logo__name {
        font-size: 2rem;
    }

    .stats-bar {
        flex-direction: column;
    }

    .header__inner {
        padding: 12px 16px;
    }

    .header__email {
        display: none;
    }

    .main {
        padding: 20px 16px 60px;
    }

    .word-card {
        padding: 16px;
    }

    .word-card__actions {
        opacity: 1;
    }
}

/* ─── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ─── Toast Notifications ─────────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease-out;
    max-width: 360px;
}

.toast--success {
    border-color: rgba(0, 212, 170, 0.3);
}

.toast--error {
    border-color: rgba(255, 77, 106, 0.3);
}

.toast.removing {
    animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(60px);
    }
}
