:root {
    /* Palette: Light (Calm Focus) */
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --border: #e2e8f0;
    --danger: #ef4444;
    --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: 12px;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a;
        /* Slate 900 */
        --card-bg: #1e293b;
        /* Slate 800 */
        --text-main: #f1f5f9;
        /* Slate 100 */
        --text-muted: #94a3b8;
        /* Slate 400 */
        --primary: #14b8a6;
        /* Teal 500 */
        --primary-hover: #2dd4bf;
        /* Teal 400 */
        --border: #334155;
        /* Slate 700 */
        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding-top: 4rem;
    /* Space from top */
}

/* Layout */
.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile-first constraint for focus */
    padding: 0 1.5rem;
}

/* Header */
header {
    margin-bottom: 2rem;
    text-align: left;
}

h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.date-display {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 2rem;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background-color: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Input Area */
.input-group {
    position: relative;
    margin-bottom: 2rem;
}

#task-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    /* Left padding for icon */
    font-size: 1rem;
    color: var(--text-main);
    background-color: var(--card-bg);
    border: 1px solid transparent;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    outline: none;
}

#task-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.input-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Task List */
.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-bottom: 4rem;
}

.task-item {
    background-color: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.3s ease;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.task-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Custom Checkbox */
.checkbox-wrapper {
    position: relative;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.task-checkbox {
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    position: absolute;
    z-index: 10;
}

.custom-checkbox {
    width: 100%;
    height: 100%;
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.task-checkbox:checked+.custom-checkbox {
    background-color: var(--primary);
    border-color: var(--primary);
}

.check-icon {
    color: white;
    width: 14px;
    height: 14px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.task-checkbox:checked+.custom-checkbox .check-icon {
    opacity: 1;
    transform: scale(1);
}

/* Text */
.task-text {
    flex-grow: 1;
    font-size: 1rem;
    transition: color 0.2s ease;
    word-break: break-word;
}

/* Delete Button */
.delete-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    opacity: 0;
    /* Hidden by default */
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.task-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background-color: #fee2e2;
    color: var(--danger);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.5s ease;
}

.empty-icon {
    color: var(--border);
    width: 64px;
    height: 64px;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

.leaving {
    animation: fadeOut 0.3s ease forwards;
    pointer-events: none;
}