:root {
    --bg-gradient-start: #6366f1;
    --bg-gradient-end: #8b5cf6;
    --container-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --input-border: #e5e7eb;
    --input-focus-border: #6366f1;
    --button-primary: #34b0d3;
    --button-primary-hover: #0891b2;
    --button-theme: #8b5cf6;
    --button-theme-hover: #7c3aed;
    --button-danger: #b45309;
    --button-danger-hover: #92400e;
    --task-bg: #f9fafb;
    --task-bg-hover: #f3f4f6;
    --task-border: #6366f1;
    --stats-border: #e5e7eb;
    --shadow: rgba(99, 102, 241, 0.1);
}

html.dark-theme {
    --bg-gradient-start: #1f2937;
    --bg-gradient-end: #111827;
    --container-bg: #2d2d44;
    --text-primary: #f3f4f6;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --input-border: #4b5563;
    --input-focus-border: #818cf8;
    --button-primary: #22d3ee;
    --button-primary-hover: #06b6d4;
    --button-theme: #a78bfa;
    --button-theme-hover: #c4b5fd;
    --button-danger: #b45309;
    --button-danger-hover: #92400e;
    --task-bg: #3d3d52;
    --task-bg-hover: #464661;
    --task-border: #818cf8;
    --stats-border: #4b5563;
    --shadow: rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    transition: background 0.3s ease;
}

.container {
    background: var(--container-bg);
    border-radius: 12px;
    box-shadow: 0 10px 40px var(--shadow);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    position: relative;
    transition: all 0.3s ease, box-shadow 0.3s ease;
}

h1 {
    color: var(--text-primary);
    margin-bottom: 30px;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.5px;
    transition: color 0.3s ease;
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--button-theme);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle:hover {
    background: var(--button-theme-hover);
    transform: scale(1.1) rotate(20deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    display: inline-block;
    transition: transform 0.3s ease;
}

.input-section {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
}

#taskInput {
    flex: 1;
    width: 100%;
    max-width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    font-size: 16px;
    text-overflow: ellipsis;
    background: var(--container-bg);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#taskInput::placeholder {
    color: var(--text-muted);
}

#taskInput:focus {
    outline: none;
    border-color: var(--input-focus-border);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.add-btn {
    padding: 12px 16px;
    background: var(--button-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(52, 176, 211, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
}

.add-btn:hover {
    background: var(--button-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 176, 211, 0.4);
}

.add-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(52, 176, 211, 0.3);
}

.task-list {
    list-style: none;
    margin-bottom: 24px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--task-bg);
    border-left: 4px solid var(--task-border);
    border-radius: 8px;
    margin-bottom: 12px;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.task-item:hover {
    background: var(--task-bg-hover);
    box-shadow: 0 4px 12px var(--shadow);
}

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

.task-item.completed .task-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--button-primary);
    transition: all 0.3s ease;
}

.task-text {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    word-break: break-word;
    transition: all 0.3s ease;
    line-height: 1.5;
}

.delete-btn {
    padding: 8px 12px;
    background: var(--button-danger);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    box-shadow: 0 2px 8px rgba(180, 83, 9, 0.2);
}

.delete-btn:hover {
    background: var(--button-danger-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(180, 83, 9, 0.3);
}

.delete-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(180, 83, 9, 0.2);
}

.stats {
    display: flex;
    justify-content: space-around;
    padding-top: 20px;
    border-top: 2px solid var(--stats-border);
    font-size: 14px;
    color: var(--text-secondary);
    text-align: center;
    transition: all 0.3s ease;
}

.stats span {
    flex: 1;
    font-weight: 500;
}

.stats strong {
    color: var(--text-primary);
    font-weight: 700;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 50px 20px;
    font-size: 18px;
    font-weight: 500;
    transition: color 0.3s ease;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 40px;
    }

    .delete-btn {
        margin-right: -15px;
        border-radius: 6px 0 0 6px;
    }
}