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

:root {
    --bg: #0f0f14;
    --bg-raised: #1a1a24;
    --bg-surface: #22222f;
    --bg-hover: #2a2a3a;
    --border: #2e2e40;
    --border-light: #3a3a50;
    --text: #e8e8f0;
    --text-muted: #8888a0;
    --text-dim: #5c5c78;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-soft: rgba(124,58,237,0.15);
    --red: #ef4444;
    --orange: #f97316;
    --yellow: #eab308;
    --green: #22c55e;
    --blue: #3b82f6;
    --radius: 8px;
    --radius-sm: 5px;
    --radius-lg: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 150ms ease;
}

html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── AUTH PAGES ──────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: radial-gradient(ellipse at top, #1a1030 0%, var(--bg) 70%);
}
.auth-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}
.auth-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .25rem;
}
.auth-logo h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.5px; }
.auth-sub { color: var(--text-muted); margin-bottom: 1.5rem; }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-switch { text-align: center; margin-top: 1.25rem; color: var(--text-muted); font-size: .9rem; }

/* ── FORM ELEMENTS ───────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.field input, .field select, .field textarea {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    color: var(--text);
    padding: .6rem .75rem;
    border-radius: var(--radius-sm);
    transition: border var(--transition);
    outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; }
.field-row { display: flex; gap: 1rem; }
.field-row .field { flex: 1; }

/* ── BUTTONS ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .55rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 500;
    font-size: .9rem;
    transition: all var(--transition);
    white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-full { width: 100%; justify-content: center; padding: .7rem; }
.btn-sm { padding: .3rem .6rem; font-size: .8rem; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: rgba(239,68,68,0.15); border-color: var(--red); }
.btn-icon {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm); font-size: 1.1rem; transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }
.btn-ghost { border: none; background: none; color: var(--text-muted); padding: .4rem .6rem; }
.btn-ghost:hover { color: var(--text); background: var(--bg-hover); }

/* ── ALERTS ──────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: .75rem; }
.alert-error { background: rgba(239,68,68,0.12); color: #fca5a5; border: 1px solid rgba(239,68,68,0.25); }

/* ── APP LAYOUT ──────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ─────────────────────────────────────────── */
.sidebar {
    width: 260px;
    background: var(--bg-raised);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    z-index: 100;
}
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1rem .75rem;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-weight: 700;
    font-size: 1.1rem;
}
.sidebar-close { display: none; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.2rem; }
.sidebar-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .6rem 1rem;
    margin: 0 .5rem .5rem;
    border-radius: var(--radius);
    background: var(--bg-surface);
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent); color: #fff; font-weight: 700; font-size: .85rem;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: .9rem; }
.user-handle { font-size: .75rem; color: var(--text-dim); }
.sidebar-nav { padding: .5rem; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem .75rem; border-radius: var(--radius-sm);
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: .9rem; font-weight: 500; width: 100%; text-align: left;
    transition: all var(--transition);
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-section { padding: .5rem .5rem 0; }
.section-title {
    display: flex; align-items: center; justify-content: space-between;
    font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
    color: var(--text-dim); padding: .5rem .75rem .35rem;
}
.filter-item {
    display: flex; align-items: center; gap: .5rem;
    padding: .4rem .75rem; border-radius: var(--radius-sm);
    cursor: pointer; font-size: .85rem; color: var(--text-muted);
    transition: all var(--transition);
}
.filter-item:hover { background: var(--bg-hover); color: var(--text); }
.filter-item.active { background: var(--accent-soft); color: var(--accent); }
.filter-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.filter-item .delete-filter {
    margin-left: auto; opacity: 0; background: none; border: none;
    color: var(--text-dim); cursor: pointer; font-size: .85rem; padding: 0 2px;
}
.filter-item:hover .delete-filter { opacity: 1; }
.sidebar-footer { margin-top: auto; padding: .5rem; border-top: 1px solid var(--border); }
.logout-btn { color: var(--text-dim) !important; }

/* ── MAIN CONTENT ────────────────────────────────────── */
.main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.top-bar {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky; top: 0; z-index: 50;
}
.hamburger { display: none; background: none; border: none; color: var(--text); cursor: pointer; }
.search-box {
    display: flex; align-items: center; gap: .5rem;
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: .45rem .7rem; flex: 1; max-width: 360px;
}
.search-box input { background: none; border: none; color: var(--text); outline: none; width: 100%; }
.search-box svg { color: var(--text-dim); flex-shrink: 0; }
.top-bar-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.top-bar-actions select {
    background: var(--bg-surface); border: 1px solid var(--border);
    color: var(--text); padding: .45rem .5rem; border-radius: var(--radius-sm);
    font-size: .85rem; outline: none; cursor: pointer;
}

/* ── STATS BAR ───────────────────────────────────────── */
.stats-bar {
    display: flex; gap: .75rem; padding: 1rem 1.25rem;
    overflow-x: auto;
}
.stat-card {
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .75rem 1rem;
    min-width: 130px; flex-shrink: 0;
}
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: .75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* ── TASK LIST ───────────────────────────────────────── */
.task-list { padding: .5rem 1.25rem 2rem; }
.task-list-empty {
    text-align: center; padding: 4rem 1rem; color: var(--text-dim);
}
.task-list-empty svg { margin-bottom: 1rem; opacity: 0.3; }
.task-list-empty p { font-size: 1.05rem; }

.task-row {
    display: flex; align-items: center; gap: .75rem;
    padding: .7rem .85rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.task-row:hover { background: var(--bg-raised); border-color: var(--border); }
.task-check {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2px solid var(--border-light); flex-shrink: 0;
    cursor: pointer; transition: all var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.task-check:hover { border-color: var(--accent); }
.task-check.done { background: var(--green); border-color: var(--green); }
.task-check.done::after { content: '✓'; color: #fff; font-size: .7rem; font-weight: 700; }
.task-info { flex: 1; min-width: 0; }
.task-title-text { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-row.completed .task-title-text { text-decoration: line-through; color: var(--text-dim); }
.task-meta { display: flex; align-items: center; gap: .5rem; margin-top: .2rem; flex-wrap: wrap; }
.priority-badge {
    font-size: .7rem; font-weight: 700; padding: .1rem .4rem; border-radius: 3px;
    text-transform: uppercase; letter-spacing: .3px;
}
.priority-1 { background: rgba(239,68,68,0.15); color: #fca5a5; }
.priority-2 { background: rgba(249,115,22,0.15); color: #fdba74; }
.priority-3 { background: rgba(234,179,8,0.15); color: #fde047; }
.priority-4 { background: rgba(59,130,246,0.15); color: #93c5fd; }
.status-badge {
    font-size: .7rem; padding: .15rem .45rem; border-radius: 3px;
    font-weight: 600;
}
.tag-chip {
    font-size: .65rem; padding: .1rem .4rem; border-radius: 3px; font-weight: 600;
}
.due-text { font-size: .75rem; color: var(--text-dim); }
.due-text.overdue { color: var(--red); font-weight: 600; }
.task-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--transition); }
.task-row:hover .task-actions { opacity: 1; }

/* ── BOARD VIEW ──────────────────────────────────────── */
.board-view { padding: 1rem 1.25rem 2rem; overflow-x: auto; }
.board-columns { display: flex; gap: 1rem; min-height: 70vh; }
.board-col {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    min-width: 280px; width: 280px; flex-shrink: 0;
    display: flex; flex-direction: column;
}
.board-col-header {
    display: flex; align-items: center; gap: .5rem;
    padding: .85rem 1rem; font-weight: 600; font-size: .9rem;
    border-bottom: 1px solid var(--border);
}
.board-col-dot { width: 10px; height: 10px; border-radius: 50%; }
.board-col-count {
    margin-left: auto; background: var(--bg-surface);
    padding: .1rem .45rem; border-radius: 10px; font-size: .75rem;
    color: var(--text-muted); font-weight: 600;
}
.board-col-body { padding: .5rem; flex: 1; display: flex; flex-direction: column; gap: .4rem; overflow-y: auto; }
.board-card {
    background: var(--bg-surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .7rem .85rem;
    cursor: pointer; transition: all var(--transition);
}
.board-card:hover { border-color: var(--border-light); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.board-card-title { font-weight: 500; font-size: .9rem; margin-bottom: .35rem; }
.board-card-meta { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.board-card.completed .board-card-title { text-decoration: line-through; color: var(--text-dim); }

/* ── MODALS ──────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 200; padding: 1rem; backdrop-filter: blur(4px);
}
.modal {
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-lg); width: 100%; max-width: 520px;
    box-shadow: var(--shadow); overflow: hidden;
}
.modal-sm { max-width: 380px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.05rem; font-weight: 700; }
.modal-body { padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.modal-footer {
    display: flex; justify-content: flex-end; gap: .5rem;
    padding: 1rem 1.25rem; border-top: 1px solid var(--border);
}

/* ── TAG PICKER ──────────────────────────────────────── */
.tag-picker { display: flex; flex-wrap: wrap; gap: .4rem; }
.tag-option {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .3rem .6rem; border-radius: 20px; font-size: .8rem;
    cursor: pointer; border: 2px solid transparent;
    transition: all var(--transition); font-weight: 500;
}
.tag-option.selected { border-color: currentColor; }

/* ── DETAIL PANEL ────────────────────────────────────── */
.detail-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 200; backdrop-filter: blur(4px);
}
.detail-panel {
    position: absolute; right: 0; top: 0; bottom: 0;
    width: 460px; max-width: 100%;
    background: var(--bg-raised); border-left: 1px solid var(--border);
    box-shadow: var(--shadow); padding: 1.5rem;
    overflow-y: auto;
}
.detail-panel h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.detail-section { margin-bottom: 1rem; }
.detail-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: .25rem; }
.detail-value { font-size: .95rem; }
.detail-desc { color: var(--text-muted); line-height: 1.6; white-space: pre-wrap; }
.detail-actions { display: flex; gap: .5rem; margin-top: 1.5rem; }

/* ── RESPONSIVE ──────────────────────────────────────── */
.hidden { display: none !important; }

@media (max-width: 768px) {
    .sidebar {
        position: fixed; left: -280px; width: 280px;
        transition: left 200ms ease; box-shadow: var(--shadow);
    }
    .sidebar.open { left: 0; }
    .sidebar-close { display: block; }
    .hamburger { display: flex; }
    .btn-label { display: none; }
    .stats-bar { padding: .75rem; }
    .stat-card { min-width: 110px; padding: .6rem .75rem; }
    .task-list { padding: .5rem .75rem 2rem; }
    .field-row { flex-direction: column; gap: 1rem; }
    .detail-panel { width: 100%; }
}
