/* ══════════════════════════════════════════════════════════
   Real-Time Collaborative Notes — Premium Design System
   $100K agency-grade dark UI with glassmorphism & animations
   ══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties ──────────────────────────────── */

:root {
    /* Core Palette */
    --bg-void: #050508;
    --bg-primary: #0a0a12;
    --bg-secondary: #0f0f1a;
    --bg-tertiary: #161625;
    --bg-elevated: #1c1c30;
    --bg-card: rgba(22, 22, 40, 0.55);
    --bg-card-hover: rgba(30, 30, 55, 0.75);
    --bg-glass: rgba(255, 255, 255, 0.025);
    --bg-glass-strong: rgba(255, 255, 255, 0.06);
    --bg-input: rgba(255, 255, 255, 0.04);
    --bg-input-focus: rgba(255, 255, 255, 0.07);

    /* Accent Palette — Refined */
    --accent-primary: #7c6cf0;
    --accent-primary-light: #b4a9ff;
    --accent-primary-dim: rgba(124, 108, 240, 0.15);
    --accent-secondary: #00d4c8;
    --accent-secondary-dim: rgba(0, 212, 200, 0.12);
    --accent-warning: #f0c246;
    --accent-danger: #f06050;
    --accent-success: #00c896;
    --accent-info: #4da6ff;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #7c6cf0 0%, #b4a9ff 50%, #7c6cf0 100%);
    --gradient-brand: linear-gradient(135deg, #7c6cf0 0%, #00d4c8 100%);
    --gradient-card: linear-gradient(160deg, rgba(124, 108, 240, 0.08) 0%, rgba(0, 212, 200, 0.04) 100%);
    --gradient-glow: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(124, 108, 240, 0.06), transparent 40%);
    --gradient-mesh:
        radial-gradient(ellipse 80% 60% at 10% 30%, rgba(124, 108, 240, 0.12) 0%, transparent 70%),
        radial-gradient(ellipse 60% 80% at 90% 20%, rgba(0, 212, 200, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 50% 90%, rgba(180, 169, 255, 0.05) 0%, transparent 70%);

    /* Text */
    --text-primary: #eaeaf4;
    --text-secondary: #9a9ab8;
    --text-muted: #5e5e78;
    --text-accent: #b4a9ff;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.04);
    --border-light: rgba(255, 255, 255, 0.08);
    --border-medium: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(124, 108, 240, 0.25);
    --border-glow: rgba(124, 108, 240, 0.4);

    /* Shadows */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(124, 108, 240, 0.12);
    --shadow-glow-strong: 0 0 60px rgba(124, 108, 240, 0.2);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);

    /* Radius */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --t-fast: 0.18s var(--ease-out);
    --t-normal: 0.35s var(--ease-out);
    --t-slow: 0.6s var(--ease-out);
    --t-spring: 0.5s var(--ease-spring);
}

/* ── Reset & Base ───────────────────────────────────────── */

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

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

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

/* Animated mesh background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--gradient-mesh);
    z-index: -2;
    pointer-events: none;
    animation: meshShift 20s ease-in-out infinite alternate;
}

@keyframes meshShift {
    0% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05) rotate(1deg);
    }

    100% {
        opacity: 1;
        transform: scale(1) rotate(-0.5deg);
    }
}

/* Noise texture overlay */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    z-index: -1;
    pointer-events: none;
    opacity: 0.4;
}

a {
    color: var(--accent-primary-light);
    text-decoration: none;
    transition: color var(--t-fast);
}

a:hover {
    color: #fff;
}

::selection {
    background: rgba(124, 108, 240, 0.35);
    color: #fff;
}

::-webkit-scrollbar {
    width: 5px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ── Global Animations ──────────────────────────────────── */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.92);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

@keyframes gradient-flow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

@keyframes borderGlow {

    0%,
    100% {
        border-color: rgba(124, 108, 240, 0.15);
    }

    50% {
        border-color: rgba(124, 108, 240, 0.35);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

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

@keyframes typewriter-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ── Typography ─────────────────────────────────────────── */

h1,
h2,
h3,
h4,
h5 {
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-brand);
    background-size: 200% 200%;
    animation: gradient-flow 6s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.text-secondary {
    color: var(--text-secondary);
}

.text-accent {
    color: var(--text-accent);
}

/* ── Navbar ─────────────────────────────────────────────── */

.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(5, 5, 10, 0.7);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideDown 0.5s var(--ease-out);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.navbar-brand .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-brand);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    box-shadow: 0 2px 12px rgba(124, 108, 240, 0.25);
    transition: transform var(--t-spring), box-shadow var(--t-normal);
}

.navbar-brand .logo-icon:hover {
    transform: rotate(-8deg) scale(1.08);
    box-shadow: 0 4px 20px rgba(124, 108, 240, 0.35);
}

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

.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px 6px 6px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all var(--t-normal);
}

.user-badge:hover {
    border-color: var(--border-light);
    background: var(--bg-glass-strong);
}

.user-badge .avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(124, 108, 240, 0.2);
}

/* ── Buttons ────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-family: var(--font-primary);
    font-size: 0.875rem;
    font-weight: 550;
    border: none;
    cursor: pointer;
    transition: all var(--t-normal);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    letter-spacing: -0.01em;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255, 255, 255, 0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: scale(0.96);
    transition-duration: 0.1s;
}

.btn-primary {
    background: var(--gradient-primary);
    background-size: 200% 200%;
    animation: gradient-flow 4s ease infinite;
    color: #fff;
    box-shadow: 0 4px 20px rgba(124, 108, 240, 0.3), var(--shadow-inset);
}

.btn-primary:hover {
    box-shadow: 0 8px 32px rgba(124, 108, 240, 0.45), var(--shadow-inset);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--bg-glass-strong);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-inset);
}

.btn-secondary:hover {
    border-color: var(--border-accent);
    background: var(--accent-primary-dim);
    box-shadow: var(--shadow-glow), var(--shadow-inset);
}

.btn-danger {
    background: rgba(240, 96, 80, 0.1);
    color: var(--accent-danger);
    border: 1px solid rgba(240, 96, 80, 0.15);
}

.btn-danger:hover {
    background: rgba(240, 96, 80, 0.2);
    border-color: rgba(240, 96, 80, 0.3);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
}

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

.btn-sm {
    padding: 7px 16px;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
}

.btn-lg {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-md);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* ── Cards ──────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--t-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--gradient-glow);
    opacity: 0;
    transition: opacity var(--t-normal);
    pointer-events: none;
}

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

.card:hover::before {
    opacity: 1;
}

/* ── Form Elements ──────────────────────────────────────── */

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

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 550;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.01em;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.92rem;
    transition: all var(--t-fast);
    outline: none;
    box-shadow: var(--shadow-inset);
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.12), var(--shadow-inset);
    background: var(--bg-input-focus);
}

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

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%239a9ab8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* ── Auth Pages ─────────────────────────────────────────── */

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

/* Floating animated orbs behind auth card */
.auth-page::before,
.auth-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    animation: float 8s ease-in-out infinite;
}

.auth-page::before {
    width: 400px;
    height: 400px;
    background: rgba(124, 108, 240, 0.12);
    top: 10%;
    left: 15%;
    animation-delay: 0s;
}

.auth-page::after {
    width: 350px;
    height: 350px;
    background: rgba(0, 212, 200, 0.08);
    bottom: 10%;
    right: 15%;
    animation-delay: -4s;
}

.auth-container {
    width: 100%;
    max-width: 440px;
    z-index: 1;
    animation: fadeInUp 0.8s var(--ease-out);
}

.auth-card {
    background: rgba(15, 15, 28, 0.75);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    padding: 44px;
    backdrop-filter: blur(40px) saturate(150%);
    -webkit-backdrop-filter: blur(40px) saturate(150%);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

/* Shimmer border effect */
.auth-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(124, 108, 240, 0.3), transparent 40%, transparent 60%, rgba(0, 212, 200, 0.2));
    z-index: -1;
    animation: borderGlow 4s ease-in-out infinite;
}

.auth-header {
    text-align: center;
    margin-bottom: 36px;
}

.auth-header .logo {
    width: 64px;
    height: 64px;
    background: var(--gradient-brand);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
    box-shadow: 0 8px 32px rgba(124, 108, 240, 0.3);
    animation: float 6s ease-in-out infinite;
    position: relative;
}

.auth-header .logo::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    background: var(--gradient-brand);
    z-index: -1;
    opacity: 0.4;
    filter: blur(12px);
}

.auth-header h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 8px;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.auth-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-glass-strong);
    border-radius: var(--radius-sm);
    padding: 4px;
    margin-bottom: 30px;
    border: 1px solid var(--border-subtle);
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 550;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    transition: all var(--t-normal);
    font-family: var(--font-primary);
    position: relative;
}

.auth-tab:hover:not(.active) {
    color: var(--text-secondary);
}

.auth-tab.active {
    background: var(--accent-primary);
    color: #fff;
    box-shadow: 0 2px 12px rgba(124, 108, 240, 0.35);
}

.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-form .btn-primary {
    width: 100%;
    padding: 13px;
    font-size: 0.95rem;
    margin-top: 8px;
    font-weight: 650;
}

.auth-error {
    background: rgba(240, 96, 80, 0.08);
    border: 1px solid rgba(240, 96, 80, 0.15);
    color: var(--accent-danger);
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
    backdrop-filter: blur(8px);
}

.auth-error.visible {
    display: block;
    animation: shake 0.5s ease;
}

/* ── Dashboard ──────────────────────────────────────────── */

.dashboard-page {
    min-height: 100vh;
    animation: fadeIn 0.5s var(--ease-out);
}

.dashboard-content {
    padding: 36px 28px;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 36px;
    animation: fadeInUp 0.6s var(--ease-out) 0.1s both;
}

.dashboard-header h1 {
    font-size: 1.85rem;
    font-weight: 800;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 40px;
    animation: fadeInUp 0.6s var(--ease-out) 0.2s both;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
    transition: all var(--t-normal);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-brand);
    opacity: 0;
    transition: opacity var(--t-normal);
}

.stat-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 900;
    background: var(--gradient-brand);
    background-size: 200% 200%;
    animation: gradient-flow 5s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 6px;
    font-weight: 550;
}

.documents-section {
    margin-bottom: 44px;
    animation: fadeInUp 0.6s var(--ease-out) 0.3s both;
}

.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 16px;
}

/* ── Document Card ──────────────────────────────────────── */

.doc-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 26px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--t-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Animated top border on hover */
.doc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-brand);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.5s var(--ease-out);
}

/* Subtle card glow on hover */
.doc-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(124, 108, 240, 0.06), transparent 70%);
    opacity: 0;
    transition: opacity var(--t-normal);
    pointer-events: none;
}

.doc-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    box-shadow: var(--shadow-glow), var(--shadow-md);
    transform: translateY(-4px);
}

.doc-card:hover::before {
    transform: scaleX(1);
}

.doc-card:hover::after {
    opacity: 1;
}

.doc-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.doc-card-title {
    font-size: 1.05rem;
    font-weight: 650;
    color: var(--text-primary);
    flex: 1;
    margin-right: 12px;
}

.doc-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: var(--accent-secondary-dim);
    color: var(--accent-secondary);
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    border: 1px solid rgba(0, 212, 200, 0.15);
}

.doc-card-badge.owned {
    background: var(--accent-primary-dim);
    color: var(--accent-primary-light);
    border-color: rgba(124, 108, 240, 0.15);
}

.doc-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
    position: relative;
    z-index: 1;
}

.doc-card-meta .dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--text-muted);
}

.doc-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 18px;
    opacity: 0;
    transform: translateY(6px);
    transition: all var(--t-normal);
    position: relative;
    z-index: 1;
}

.doc-card:hover .doc-card-actions {
    opacity: 1;
    transform: translateY(0);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    animation: float 4s ease-in-out infinite;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 550;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: 24px;
}

/* ── Modals ─────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--t-normal);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-2xl);
    padding: 36px;
    width: 100%;
    max-width: 500px;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.4s var(--ease-spring);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.modal::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(124, 108, 240, 0.15), transparent 50%, rgba(0, 212, 200, 0.1));
    z-index: -1;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--t-fast);
}

.modal-close:hover {
    background: rgba(240, 96, 80, 0.15);
    color: var(--accent-danger);
    border-color: rgba(240, 96, 80, 0.2);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ── Spinner ────────────────────────────────────────────── */

.spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--border-light);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ── Toast Notifications ────────────────────────────────── */

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 20px;
    background: rgba(15, 15, 28, 0.9);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 500;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-md);
    pointer-events: all;
    animation: toastIn 0.5s var(--ease-spring);
    max-width: 380px;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.toast.success {
    border-left: 3px solid var(--accent-success);
}

.toast.error {
    border-left: 3px solid var(--accent-danger);
}

.toast.info {
    border-left: 3px solid var(--accent-info);
}

/* ── Share User List ────────────────────────────────────── */

.share-user-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
}

.share-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all var(--t-fast);
}

.share-user-item:hover {
    border-color: var(--border-light);
    background: rgba(255, 255, 255, 0.04);
}

.share-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.share-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
}

/* ── Editor Page ────────────────────────────────────────── */

.editor-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s var(--ease-out);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 28px;
    background: rgba(5, 5, 10, 0.5);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    gap: 16px;
    animation: slideDown 0.4s var(--ease-out) 0.1s both;
}

.editor-doc-title {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 650;
    font-family: var(--font-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    outline: none;
    min-width: 200px;
    transition: all var(--t-fast);
    letter-spacing: -0.01em;
}

.editor-doc-title:hover {
    border-color: var(--border-light);
}

.editor-doc-title:focus {
    border-color: var(--accent-primary);
    background: var(--bg-input);
    box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.1);
}

.save-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 5px 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    font-weight: 500;
}

.save-status .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-success);
    box-shadow: 0 0 8px rgba(0, 200, 150, 0.4);
    position: relative;
}

.save-status .dot::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: inherit;
    animation: pulse-ring 2s ease-out infinite;
}

.save-status .dot.saving {
    background: var(--accent-warning);
    box-shadow: 0 0 8px rgba(240, 194, 70, 0.4);
}

.editor-container {
    flex: 1;
    display: flex;
    padding: 0;
    position: relative;
    animation: fadeIn 0.6s var(--ease-out) 0.2s both;
}

.editor-area {
    width: 100%;
    min-height: calc(100vh - 140px);
    padding: 36px 48px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.92rem;
    line-height: 1.75;
    resize: none;
    outline: none;
    letter-spacing: 0.01em;
    tab-size: 4;
    caret-color: var(--accent-primary-light);
}

.editor-area::placeholder {
    color: var(--text-muted);
    font-family: var(--font-primary);
    font-style: italic;
}

/* ── Typing Indicators ──────────────────────────────────── */

.typing-indicators {
    display: flex;
    gap: 12px;
    padding: 0 28px;
    min-height: 0;
    overflow: hidden;
    transition: all var(--t-normal);
}

.typing-indicators:not(:empty) {
    padding: 8px 28px;
    min-height: 32px;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 4px 12px;
    background: var(--bg-glass-strong);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
    animation: fadeInUp 0.3s var(--ease-out);
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-primary-light);
    animation: typingDot 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingDot {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ── Active Users Bar ───────────────────────────────────── */

.active-users-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

.active-users-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

.active-users-list {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.active-user-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    background: var(--accent-primary-dim);
    color: var(--accent-primary-light);
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    animation: scaleIn 0.3s var(--ease-spring);
}

.user-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-success);
    box-shadow: 0 0 6px rgba(0, 200, 150, 0.5);
}

/* ── Sidebar (Version History etc.) ─────────────────────── */

.sidebar-panel {
    position: fixed;
    top: 64px;
    right: -400px;
    width: 380px;
    height: calc(100vh - 64px);
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-light);
    z-index: 50;
    transition: right 0.4s var(--ease-out);
    overflow-y: auto;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.3);
}

.sidebar-panel.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

/* ── Permission Badges ─────────────────────────────────── */

.permission-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.68rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    margin-left: 8px;
    transition: all var(--t-fast);
}

.permission-badge.view {
    background: rgba(240, 194, 70, 0.1);
    color: var(--accent-warning);
    border: 1px solid rgba(240, 194, 70, 0.2);
}

.permission-badge.edit {
    background: rgba(0, 200, 150, 0.1);
    color: var(--accent-success);
    border: 1px solid rgba(0, 200, 150, 0.2);
}

.permission-badge.owner {
    background: var(--accent-primary-dim);
    color: var(--accent-primary-light);
    border: 1px solid rgba(124, 108, 240, 0.2);
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }

    .navbar-brand span {
        display: none;
    }

    .dashboard-content {
        padding: 20px 16px;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .documents-grid {
        grid-template-columns: 1fr;
    }

    .editor-toolbar {
        padding: 10px 16px;
    }

    .editor-area {
        padding: 24px 20px;
    }

    .auth-card {
        padding: 28px;
    }

    .modal {
        padding: 24px;
        margin: 16px;
    }
}

@media (max-width: 480px) {
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .active-users-bar {
        display: none;
    }
}

/* ── Remote Cursors ────────────────────────────────────── */

.remote-cursor {
    pointer-events: none;
    z-index: 5;
}

.remote-cursor-line {
    width: 2px;
    height: 20px;
    border-radius: 1px;
    animation: cursorBlink 1.2s ease-in-out infinite;
    box-shadow: 0 0 6px currentColor;
}

@keyframes cursorBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.remote-cursor-label {
    position: absolute;
    top: -18px;
    left: -2px;
    padding: 1px 6px;
    border-radius: 4px 4px 4px 0;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    font-family: var(--font-primary);
    white-space: nowrap;
    line-height: 1.4;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.2s ease;
}

/* ── Dashboard Search Bar ──────────────────────────────── */

.search-bar {
    position: relative;
    max-width: 400px;
    flex: 1;
}

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

.search-bar .form-input {
    padding-left: 40px;
    background: var(--bg-glass-strong);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    height: 42px;
    font-size: 0.88rem;
    transition: all var(--t-normal);
}

.search-bar .form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(124, 108, 240, 0.12);
    background: var(--bg-input-focus);
    width: 100%;
}

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

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-glass-strong);
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity var(--t-fast);
}

.search-bar .form-input:not(:placeholder-shown)~.search-clear {
    opacity: 1;
}

.search-clear:hover {
    background: rgba(240, 96, 80, 0.15);
    color: var(--accent-danger);
}

/* Active user chip colored border */
.active-user-chip {
    border: 1px solid rgba(124, 108, 240, 0.3);
}

/* ── Cursor Color Picker ───────────────────────────────── */

.cursor-color-wrapper {
    position: relative;
    width: 32px;
    height: 32px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-light);
    transition: all var(--t-fast);
    flex-shrink: 0;
}

.cursor-color-wrapper:hover {
    border-color: var(--border-accent);
    box-shadow: 0 0 12px rgba(124, 108, 240, 0.15);
    transform: scale(1.08);
}

.cursor-color-swatch {
    position: absolute;
    inset: 3px;
    border-radius: 4px;
    background: #7c6cf0;
    pointer-events: none;
    transition: background 0.2s ease;
}

.cursor-color-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

/* ── Remote Selection Highlights ───────────────────────── */

.remote-selection-container {
    pointer-events: none;
    z-index: 3;
}

.remote-selection-rect {
    pointer-events: none;
    border-radius: 2px;
    transition: all 0.1s ease;
}