:root {
    /* Colors */
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --bg-body: #f3f4f6;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --danger: #ef4444;
    --success: #10b981;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;

    /* Priorities */
    --p-high: #fee2e2;
    --p-high-text: #991b1b;
    --p-med: #fef3c7;
    --p-med-text: #92400e;
    --p-low: #d1fae5;
    --p-low-text: #065f46;
}

.dark {
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-sidebar: #1e293b;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #374151;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    
    --p-high: #450a0a;
    --p-high-text: #fecaca;
    --p-med: #451a03;
    --p-med-text: #fde68a;
    --p-low: #064e3b;
    --p-low-text: #a7f3d0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    transition: background-color 0.3s, color 0.3s;
    height: 100vh;
    overflow: hidden; /* App-like feel */
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

.shake { animation: shake 0.4s ease-in-out; }

/* Layout */
.app {
    display: flex;
    height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
    background: var(--bg-body);
}

.blurred {
    filter: blur(8px);
    pointer-events: none;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    gap: 1.5rem;
    transition: transform 0.3s;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    padding: 0.6rem 2.5rem 0.6rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-body);
    color: var(--text-main);
}

.voice-btn {
    position: absolute;
    right: 5px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0.6;
}

/* Filters */
.filters {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Lists */
.lists-section {
    flex: 1;
    overflow-y: auto;
}

.section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-main);
    transition: background 0.15s;
    margin-bottom: 0.25rem;
}

.list-item:hover {
    background: var(--bg-body);
}

.list-item.active {
    background: var(--primary);
    color: white;
}

.list-item.active .list-count {
    background: rgba(255,255,255,0.2);
    color: white;
}

.list-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    overflow: hidden;
}

.list-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.list-count {
    font-size: 0.75rem;
    background: var(--bg-body);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    margin-left: auto;
    color: var(--text-muted);
}

.list-actions {
    display: none;
    margin-left: 0.5rem;
}

.list-item:hover .list-actions {
    display: flex;
    gap: 4px;
}

.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 0.9rem;
    opacity: 0.7;
    padding: 2px;
}

.icon-btn:hover { opacity: 1; }

.add-list-btn {
    width: 100%;
    text-align: left;
    padding: 0.5rem;
    color: var(--primary);
    background: none;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.add-list-btn:hover {
    background: var(--bg-body);
    border-style: solid;
}

/* Bottom Actions */
.sidebar-footer {
    border-top: 1px solid var(--border);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    font-size: 0.85rem;
    padding: 0.25rem;
}

.footer-btn:hover { color: var(--text-main); }

/* Main Content */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    position: relative;
    overflow: hidden;
}

.main-header {
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.main-title {
    font-size: 1.8rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--bg-body);
}

/* Tasks */
.tasks-container {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.task-cardPriority-low, .task-cardPriority-medium, .task-cardPriority-high {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: box-shadow 0.2s, transform 0.2s;
    animation: fadeIn 0.3s ease;
}

.task-cardPriority-low:hover, .task-cardPriority-medium:hover, .task-cardPriority-high:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.task-content {
    flex: 1;
}

.task-header-row {
    display: flex;
    justify-content: space-between;
}

.task-title {
    font-weight: 500;
    font-size: 1.05rem;
    margin-bottom: 0.25rem;
    display: block;
}

.task-notes {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.task-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.8rem;
    align-items: center;
}

.task-due {
    color: var(--text-muted);
    background: var(--bg-body);
    padding: 2px 6px;
    border-radius: 4px;
}

.task-due.overdue {
    color: var(--danger);
    background: #fee2e2;
}

.task-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.priority-high { background: var(--p-high); color: var(--p-high-text); }
.priority-medium { background: var(--p-med); color: var(--p-med-text); }
.priority-low { background: var(--p-low); color: var(--p-low-text); }

.task-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.task-cardPriority-low:hover .task-actions, .task-cardPriority-medium:hover .task-actions, .task-cardPriority-high:hover .task-actions {
    opacity: 1;
}

/* Checkbox */
.custom-checkbox {
    display: block;
    position: relative;
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-top: 3px;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: transparent;
    border: 2px solid var(--border);
    border-radius: 5px;
    transition: all 0.2s;
}

.custom-checkbox:hover input ~ .checkmark {
    border-color: var(--primary);
}

.custom-checkbox input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}

.custom-checkbox .checkmark:after {
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* Completed State */
.completed .task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

.completed {
    opacity: 0.6;
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--text-muted);
    margin-top: 4rem;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.hidden {
    display: none !important;
}

/* Lock Screen */
.lock-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-body);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lock-card {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    text-align: center;
    width: 100%;
    max-width: 320px;
}

.lock-card h2 { margin-bottom: 1.5rem; }

.lock-card input {
    width: 100%;
    padding: 0.6rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    opacity: 1;
    transition: opacity 0.2s;
    backdrop-filter: blur(2px);
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-md);
}

.modal-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-body);
    color: var(--text-main);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .app { flex-direction: column; }
    .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 1rem; }
    .lists-section, .sidebar-footer { display: none; } /* Simplify for mobile for now, or add toggle */
    /* Actually let's make sidebar collapsible or just stack */
    .sidebar { display: none; } /* Hide sidebar on mobile for simplicity in this V2, or implement toggle menu */
    
    /* Let's fix mobile sidebar to be a bottom nav kind of thing or just hidden */
    .main-header { padding: 1rem; }
}

@media (max-width: 768px) {
    .sidebar {
        display: none; /* In a real app we'd add a toggle */
    }
}