:root {
    /* Light Mode Variables - Standard Blue */
    --bg-color: #f0f4f8;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --accent-color: #2563eb;
    --accent-hover: #1d4ed8;
    --card-bg: rgba(255, 255, 255, 0.8);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

body.dark-mode {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #60a5fa;
    --card-bg: rgba(30, 41, 59, 0.8);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
    transition: background-color 0.3s ease;
    overflow-x: hidden;
}

/* Background Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: move 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: #3b82f6;
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 300px;
    height: 300px;
    background: #8b5cf6;
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.blob-3 {
    width: 250px;
    height: 250px;
    background: #10b981;
    top: 40%;
    left: 30%;
    animation-delay: -10s;
}

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(100px, 100px) scale(1.1); }
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.app-container {
    width: 100%;
    max-width: 800px;
    position: relative;
    z-index: 1;
}

/* Header */
header .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.controls {
    display: flex;
    gap: 1rem;
}

#theme-toggle, #install-button {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 45px;
    height: 45px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

#theme-toggle:hover {
    background: var(--accent-color);
    color: white;
}

.hidden { display: none; }

/* Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
}

.stat-card span {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-color);
}

.stat-card label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Progress Bar */
.progress-wrapper {
    margin-top: 1rem;
}

.progress-bar {
    height: 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), var(--success));
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#progress-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Action Bar */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

#task-input {
    width: 100%;
    padding: 1.2rem;
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    font-size: 1.1rem;
    outline: none;
    transition: border-color 0.2s;
}

.dark-mode #task-input {
    background: rgba(0, 0, 0, 0.2);
}

#task-input:focus {
    border-color: var(--accent-color);
}

.input-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

select, input[type="date"] {
    padding: 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
}

.dark-mode select, .dark-mode input[type="date"] {
    background: rgba(0, 0, 0, 0.2);
}

#add-task-btn {
    padding: 0.8rem 2rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    flex-grow: 1;
}

#add-task-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
}

/* Filter & Search */
.filter-search {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex-grow: 1;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

#search-input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.3);
    color: var(--text-primary);
    outline: none;
}

.filters {
    display: flex;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--accent-color);
    color: white;
}

/* Task List */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

#clear-all-btn {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 0.4rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

#clear-all-btn:hover {
    background: var(--danger);
    color: white;
}

.task-list {
    list-style: none;
}

.task-item {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: grab;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.task-item:active { cursor: grabbing; }

.task-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
}

.task-checkbox i {
    color: white;
    font-size: 0.8rem;
    display: none;
}

.task-checkbox.checked i { display: block; }

.task-content { flex-grow: 1; }

.task-text {
    font-weight: 600;
    margin-bottom: 0.3rem;
    transition: color 0.2s, text-decoration 0.2s;
}

.task-item.completed .task-text {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.task-info {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.priority-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    text-transform: uppercase;
    font-weight: 700;
    font-size: 0.7rem;
}

.priority-high { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.priority-medium { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.priority-low { background: rgba(16, 185, 129, 0.1); color: var(--success); }

.task-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.edit-btn:hover { background: var(--accent-color); color: white; }
.delete-btn:hover { background: var(--danger); color: white; }

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal.show { display: flex; }

.modal-content {
    width: 90%;
    max-width: 500px;
}

.modal-content h3 { margin-bottom: 1.5rem; }

#edit-task-input {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.5);
}

.modal-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

#cancel-edit {
    padding: 0.8rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
}

#save-edit {
    padding: 0.8rem 1.5rem;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* Responsive */
@media (max-width: 600px) {
    .stats-container { grid-template-columns: 1fr; }
    .input-meta { flex-direction: column; }
    .filter-search { flex-direction: column-reverse; align-items: stretch; }
}
