/* style.css */
:root {
    --primary: #4F46E5;
    --success: #22C55E;
    --danger: #EF4444;
    --warning: #F59E0B;
    --bg: #F7F8FA;
    --card: #FFFFFF;
    --text: #1F2937;
    --text-muted: #6B7280;
    --border: #E5E7EB;
    --radius: 16px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --font: 'Inter', system-ui, sans-serif;
    --sidebar-width: 260px;
    --transition: 0.2s ease;
}

[data-theme="dark"] {
    --bg: #111827;
    --card: #1F2937;
    --text: #F9FAFB;
    --text-muted: #9CA3AF;
    --border: #374151;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font);
    background-color: var(--bg);
    color: var(--text);
    overflow: hidden;
    line-height: 1.5;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 0 20px 20px;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 700;
}

.nav-links, .sidebar-categories ul {
    list-style: none;
}

.nav-btn {
    width: 100%;
    text-align: left;
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background var(--transition);
}

.nav-btn:hover, .nav-btn:focus-visible {
    background-color: var(--bg);
}

.nav-btn.active {
    background-color: var(--primary);
    color: #fff;
    border-radius: 0 var(--radius) var(--radius) 0;
    width: calc(100% - 16px);
}

.sidebar-categories {
    flex: 1;
    overflow-y: auto;
    padding-top: 20px;
}

.sidebar-categories h3 {
    padding: 0 24px;
    font-size: 0.875rem;
    text-transform: uppercase;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 4px;
    border-radius: 50%;
}

.sidebar-bottom {
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 32px;
    background-color: var(--bg);
}

.header-left { display: flex; align-items: center; gap: 16px; }
.header-right { display: flex; align-items: center; gap: 12px; }

.search-bar input {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background-color: var(--card);
    color: var(--text);
    font-family: inherit;
    width: 250px;
}

.mobile-only { display: none; }

/* Progress */
.progress-container {
    padding: 0 32px 16px;
}
.progress-bar-wrap {
    height: 8px;
    background-color: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background-color: var(--success);
    width: 0%;
    transition: width 0.5s ease;
}
.progress-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 8px;
    display: block;
}

/* Task List */
.task-list-container {
    flex: 1;
    padding: 0 32px 100px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.task-item {
    background-color: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, opacity 0.2s;
    user-select: none;
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-title {
    text-decoration: line-through;
}

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

.task-item.completed .task-checkbox {
    background-color: var(--success);
    border-color: var(--success);
}
.task-item.completed .task-checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
}

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

.task-title {
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.priority-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.p-high { background-color: var(--danger); }
.p-medium { background-color: var(--warning); }
.p-low { background-color: var(--success); }

/* Swipe Actions */
.swipe-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    color: white;
    font-weight: bold;
    z-index: -1;
    border-radius: var(--radius);
}
.swipe-left-bg { background-color: var(--danger); justify-content: flex-end; }
.swipe-right-bg { background-color: var(--success); justify-content: flex-start; }

/* Kanban */
.kanban-container {
    display: flex;
    gap: 20px;
    padding: 0 32px 32px;
    height: 100%;
    overflow-x: auto;
}
.kanban-column {
    flex: 1;
    min-width: 280px;
    background-color: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
}
.kanban-column h3 { margin-bottom: 16px; font-size: 1rem; }
.kanban-tasks {
    flex: 1;
    overflow-y: auto;
}
.kanban-tasks .task-item { box-shadow: none; border: 1px solid var(--border); }

/* Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px 32px;
}
.stat-card {
    background-color: var(--card);
    padding: 24px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}
.stat-card h3 { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 8px;}
.stat-card p { font-size: 2rem; font-weight: 700; color: var(--primary); }

.hidden { display: none !important; }

/* FAB */
.fab {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 64px;
    height: 64px;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 2rem;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.4);
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    z-index: 100;
}
.fab:hover { transform: scale(1.05); }
.fab:active { transform: scale(0.95); }

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal {
    background-color: var(--card);
    width: 90%;
    max-width: 500px;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.close-btn { background: none; border: none; font-size: 1.5rem; color: var(--text); cursor: pointer; }

/* Forms */
.form-group { margin-bottom: 16px; width: 100%; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text);
}

input[type="text"], input[type="date"], input[type="time"], select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--bg);
    color: var(--text);
    font-family: inherit;
    font-size: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary);
    border-color: transparent;
}

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

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    font-size: 1rem;
}
.btn-primary { background-color: var(--primary); color: white; }
.btn-secondary { background-color: var(--border); color: var(--text); }

/* Settings */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.data-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

/* Confetti */
#confetti-canvas {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        transform: translateX(-100%);
        z-index: 500;
        height: 100%;
    }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
    .mobile-only { display: block; }
    .task-list-container { padding: 0 16px 100px; }
    .main-header { padding: 16px; }
    .search-bar input { width: 150px; }
    .form-row { flex-direction: column; gap: 0; }
}
