/* Trinity ToDo — Dark Theme */
:root {
    --bg: #1a1a2e;
    --bg-card: #16213e;
    --bg-input: #0f3460;
    --bg-hover: #1a3a6a;
    --accent: #e94560;
    --accent-light: #ff6b81;
    --text: #eee;
    --text-muted: #8892a4;
    --text-completed: #555;
    --border: #2a2a4a;
    --success: #4caf50;
    --danger: #e94560;
    --priority-high: #ff9800;
    --priority-urgent: #e94560;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
}

/* ── Login ──────────────────────────────────────────────── */
#login-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1rem;
}

.login-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 360px;
}

.login-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.login-card input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
}

.login-card button {
    width: 100%;
    padding: 0.75rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
}

.login-card button:hover { background: var(--accent-light); }

.error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 0.5rem;
    text-align: center;
}

/* ── Header ─────────────────────────────────────────────── */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

header h1 { font-size: 1.25rem; }

.header-actions { display: flex; gap: 0.5rem; }

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
}

.icon-btn:hover { color: var(--text); background: var(--bg-hover); }

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-card);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 16px rgba(0,0,0,0.4);
    transition: transform 0.2s ease;
}

.sidebar[hidden] { display: none; }

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.sidebar ul {
    list-style: none;
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.sidebar li {
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar li:hover { background: var(--bg-hover); }
.sidebar li.active { background: var(--bg-input); color: var(--accent); font-weight: 600; }

.sidebar li .list-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
}

.sidebar-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border);
}

.sidebar-footer input {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
}

.sidebar-footer button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.overlay[hidden] { display: none; }

/* ── Main Content ───────────────────────────────────────── */
main {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
}

.add-item {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.add-item input {
    flex: 1;
    padding: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 1rem;
}

.add-item input:focus {
    outline: none;
    border-color: var(--accent);
}

.add-item button {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
}

.add-item button:hover { background: var(--accent-light); }

/* ── ToDo Items ─────────────────────────────────────────── */
.todo-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background 0.15s;
}

.todo-item:hover { background: var(--bg-hover); }

.todo-item.completed .todo-title {
    text-decoration: line-through;
    color: var(--text-completed);
}

.todo-checkbox {
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.todo-checkbox:hover { border-color: var(--success); }

.todo-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.todo-checkbox.checked::after {
    content: '\2713';
    color: #fff;
    font-size: 0.8rem;
    font-weight: bold;
}

.todo-content { flex: 1; min-width: 0; }

.todo-title {
    font-size: 0.95rem;
    word-break: break-word;
}

.todo-meta {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.todo-meta span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.todo-meta .overdue { color: var(--danger); font-weight: 600; }

.priority-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.priority-dot.p1 { background: var(--priority-high); }
.priority-dot.p2 { background: var(--priority-urgent); }

.text-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.5rem 0;
}

.text-btn:hover { color: var(--text); }

#completed-section { margin-top: 1.5rem; }

/* ── Modal ──────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 200;
}

.modal[hidden] { display: none; }

.modal-content {
    background: var(--bg-card);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 1.25rem;
    max-height: 85vh;
    overflow-y: auto;
}

@media (min-width: 600px) {
    .modal {
        align-items: center;
    }
    .modal-content {
        border-radius: var(--radius);
    }
}

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

.modal-content label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0.75rem 0 0.25rem;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 0.6rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
}

.modal-content textarea { resize: vertical; }

.modal-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 1.25rem;
    gap: 0.75rem;
}

.primary-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
}

.primary-btn:hover { background: var(--accent-light); }

.danger-btn {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    font-size: 0.95rem;
}

.danger-btn:hover { background: var(--danger); color: #fff; }

/* ── Filter Bar ─────────────────────────────────────────── */
.filter-bar {
    padding: 0.5rem 1rem;
    max-width: 600px;
    margin: 0 auto;
}

.person-filters {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.person-chip {
    padding: 0.3rem 0.7rem;
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    transition: all 0.15s;
    user-select: none;
}

.person-chip:hover { border-color: var(--text-muted); }
.person-chip.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ── Assignee Badges ────────────────────────────────────── */
.assignee-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    font-size: 0.7rem;
    background: var(--bg-input);
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Assignee Picker (Modal) ────────────────────────────── */
.assignee-picker {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.4rem 0;
}

.assignee-picker .person-chip {
    font-size: 0.85rem;
}

/* ── Sidebar sections ───────────────────────────────────── */
.sidebar-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 0.75rem 1.25rem 0.25rem;
    letter-spacing: 0.05em;
}

#person-filter-list {
    list-style: none;
    padding: 0;
}

#person-filter-list li {
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#person-filter-list li:hover { background: var(--bg-hover); }
#person-filter-list li.active { color: var(--accent); font-weight: 600; }

/* ── Empty State ────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state p { font-size: 1.1rem; }
