:root {
    /* Color Palette - Vibrant Blue & Purple */
    --accent-primary: hsl(230, 80%, 65%);
    --accent-secondary: hsl(280, 70%, 60%);
    --bg-main: hsl(220, 30%, 96%);
    --text-primary: hsl(230, 25%, 25%);
    --text-secondary: hsl(230, 15%, 55%);
    --surface: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-main: 0 15px 35px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 45px rgba(0, 0, 0, 0.12);
    --transition-speed: 0.3s;
}

/* Dark Mode */
.dark {
    --bg-main: hsl(230, 20%, 10%);
    --text-primary: hsl(220, 15%, 90%);
    --text-secondary: hsl(220, 10%, 55%);
    --surface: hsl(230, 20%, 15%);
    --glass-bg: rgba(30, 30, 50, 0.7);
    --glass-border: rgba(60, 60, 80, 0.4);
    --shadow-main: 0 15px 35px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 20px 45px rgba(0, 0, 0, 0.35);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    overflow-x: hidden;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* Background Animated Blobs */
.background-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: move 20s infinite alternate;
}

.dark .blob {
    opacity: 0.2;
}

.blob-1 {
    background: var(--accent-primary);
    top: -100px;
    left: -100px;
}

.blob-2 {
    background: var(--accent-secondary);
    bottom: -100px;
    right: -100px;
    animation-delay: -5s;
}

.blob-3 {
    background: hsl(200, 80%, 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(50px, 100px) scale(1.2); }
}

/* App Container */
.app-container {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 40px;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow-main);
    transition: background var(--transition-speed), box-shadow var(--transition-speed);
}

/* Header */
.header-row {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

#dateDisplay {
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 5px;
}

/* Theme Toggle */
.theme-toggle {
    position: absolute;
    right: 0;
    background: none;
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    transition: all var(--transition-speed);
}

.theme-toggle:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.dark .icon-sun { display: inline; }
.dark .icon-moon { display: none; }
.icon-sun { display: none; }
.icon-moon { display: inline; }

/* Stats Card */
.stats-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 15px 25px;
    margin-bottom: 30px;
    border: 1px solid var(--glass-border);
    transition: background var(--transition-speed);
}

.dark .stats-card {
    background: rgba(255, 255, 255, 0.05);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stat-divider {
    width: 1px;
    height: 30px;
    background: var(--glass-border);
}

/* Input Styles */
.input-wrapper {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    background: var(--surface);
    border: 2px solid transparent;
    padding: 15px 20px;
    border-radius: 18px;
    font-size: 1rem;
    color: var(--text-primary);
    box-shadow: 0 5px 15px rgba(0,0,0,0.03);
    transition: all var(--transition-speed);
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 10px 25px rgba(100, 108, 255, 0.15);
}

input[type="text"]::placeholder {
    color: var(--text-secondary);
}

button[id="addBtn"] {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    width: 54px;
    height: 54px;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all var(--transition-speed);
    box-shadow: 0 10px 20px rgba(100, 108, 255, 0.3);
    flex-shrink: 0;
}

button[id="addBtn"]:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 15px 30px rgba(100, 108, 255, 0.4);
}

button[id="addBtn"]:active {
    transform: scale(0.95);
}

/* Filter Tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 10px 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-speed);
    font-family: inherit;
}

.dark .filter-btn {
    background: rgba(255, 255, 255, 0.05);
}

.filter-btn:hover {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border-color: transparent;
    box-shadow: 0 5px 15px rgba(100, 108, 255, 0.3);
}

/* Todo List */
.todo-list {
    list-style: none;
}

.todo-item {
    background: var(--surface);
    border-radius: 18px;
    padding: 15px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 5px 15px rgba(0,0,0,0.02);
    transition: all var(--transition-speed);
    border: 1px solid transparent;
    animation: slideIn 0.4s ease-out forwards;
}

.todo-item:hover {
    transform: translateX(10px);
    border-color: var(--glass-border);
    box-shadow: var(--shadow-hover);
}

.todo-item.editing {
    border-color: var(--accent-primary);
}

.todo-item.editing:hover {
    transform: none;
}

.todo-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
    cursor: pointer;
}

.checkbox-custom {
    width: 24px;
    height: 24px;
    border: 2px solid var(--accent-primary);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.todo-item.completed .checkbox-custom {
    background: var(--accent-primary);
}

.checkbox-custom::after {
    content: '✓';
    color: white;
    font-size: 14px;
    display: none;
}

.todo-item.completed .checkbox-custom::after {
    display: block;
}

.todo-text {
    font-size: 1rem;
    font-weight: 500;
    word-break: break-word;
}

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

/* Inline Edit Input */
.edit-input {
    flex: 1;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--accent-primary);
    padding: 4px 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    font-family: inherit;
    outline: none;
    border-radius: 0;
    box-shadow: none;
}

.delete-btn {
    background: transparent;
    border: none;
    color: #ff6b6b;
    padding: 8px;
    cursor: pointer;
    opacity: 0;
    transition: opacity var(--transition-speed);
    border-radius: 12px;
}

.todo-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: rgba(255, 107, 107, 0.1);
}

/* Clear Completed Button */
.clear-completed-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-family: inherit;
    font-weight: 500;
    padding: 12px;
    cursor: pointer;
    transition: color var(--transition-speed);
    text-align: center;
}

.clear-completed-btn:hover {
    color: #ff6b6b;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 0;
    display: none;
    color: var(--text-secondary);
}

.empty-state p {
    color: var(--text-secondary);
    margin-top: 15px;
    font-size: 0.9rem;
}

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

@media (max-width: 500px) {
    .app-container {
        max-width: 90%;
        padding: 30px 20px;
    }

    h1 { font-size: 1.8rem; }

    .todo-item:hover .delete-btn {
        opacity: 1;
    }

    .delete-btn {
        opacity: 0.6;
    }
}
