:root {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #d1d5db;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

[data-theme="dark"] {
    --bg-primary: #1f2937;
    --bg-secondary: #111827;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #4b5563;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    transform: scale(1.05);
}

.btn-icon:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.stats-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    text-align: center;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    display: block;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.todo-form-section {
    background: var(--bg-primary);
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.todo-input {
    flex: 1;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
}

.todo-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-primary {
    padding: 14px 28px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.form-row-secondary {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.todo-description-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
}

.todo-description-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.todo-select,
.todo-date,
.sort-select {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.todo-select:focus,
.todo-date:focus,
.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.filters-section {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-btn {
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-primary);
}

.filter-btn:hover {
    background: var(--bg-tertiary);
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
}

.filter-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.search-sort-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    flex: 1;
    position: relative;
    min-width: 200px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: var(--transition);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.todo-list-container {
    min-height: 200px;
}

.todo-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.todo-item {
    background: var(--bg-primary);
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    animation: slideIn 0.3s ease;
}

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

.todo-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateX(4px);
}

.todo-item.completed {
    opacity: 0.7;
}

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

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

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

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

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

.todo-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    word-wrap: break-word;
}

.todo-description {
    font-size: 14px;
    color: var(--text-secondary);
    word-wrap: break-word;
}

.todo-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 8px;
}

.todo-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-category {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.badge-priority {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.priority-low {
    background: #d1fae5;
    color: #065f46;
}

.priority-medium {
    background: #fef3c7;
    color: #92400e;
}

.priority-high {
    background: #fee2e2;
    color: #991b1b;
}

.badge-date {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
}

.badge-date.overdue {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}

.todo-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-action:hover {
    background: var(--bg-tertiary);
    transform: scale(1.1);
}

.btn-action.delete:hover {
    background: var(--danger-color);
    color: white;
}

.btn-action.select {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action.select.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h2 {
    font-size: 24px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.bulk-actions-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 24px;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.selected-count {
    font-weight: 600;
    color: var(--text-primary);
}

.bulk-buttons {
    display: flex;
    gap: 12px;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
}

.btn-danger {
    padding: 10px 20px;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger:hover {
    background: #dc2626;
}

.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--bg-primary);
    padding: 16px 24px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary-color);
    z-index: 2000;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left-color: var(--success-color);
}

.toast.error {
    border-left-color: var(--danger-color);
}

.toast.warning {
    border-left-color: var(--warning-color);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-primary);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal h2 {
    margin-bottom: 16px;
    color: var(--text-primary);
}

.modal p {
    margin-bottom: 24px;
    color: var(--text-secondary);
}

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

.footer {
    margin-top: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.footer kbd {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
}

.footer-note {
    margin-top: 8px;
    font-size: 12px;
}

.hidden {
    display: none !important;
}

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .stats-dashboard {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row-secondary {
        flex-direction: column;
    }

    .todo-description-input,
    .todo-select,
    .todo-date {
        width: 100%;
    }

    .search-sort-row {
        flex-direction: column;
    }

    .sort-select {
        width: 100%;
    }

    .todo-item {
        flex-wrap: wrap;
    }

    .todo-actions {
        flex-wrap: wrap;
    }

    .bulk-actions-bar {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .bulk-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .stats-dashboard {
        grid-template-columns: 1fr;
    }

    .filter-tabs {
        flex-wrap: wrap;
    }

    .filter-btn {
        flex: 1;
        min-width: 80px;
    }
}