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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #f9fafb;
        --text-secondary: #d1d5db;
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --border-color: #334155;
    }
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
    transition: var(--transition);
}

.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px;
}

.app-wrapper {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

/* Header */
.app-header {
    text-align: center;
    padding: 40px 24px 32px;
    background: var(--primary-gradient);
    color: white;
}

.app-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.025em;
}

.app-subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Form */
.task-form {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.input-wrapper {
    display: flex;
    gap: 12px;
}

.task-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 0.95rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.task-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.task-input::placeholder {
    color: var(--text-secondary);
}

.btn-add {
    padding: 14px 24px;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-md);
}

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

.btn-add:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.25rem;
    font-weight: 300;
}

/* Tasks Container */
.tasks-container {
    padding: 24px;
    min-height: 300px;
}

.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    cursor: pointer;
    overflow: hidden;
}

.task-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
    transform: translateX(4px);
}

/* Checkbox */
.task-checkbox {
    width: 22px;
    height: 22px;
    min-width: 22px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
}

.task-checkbox.checked {
    background: var(--primary-gradient);
    border-color: var(--primary-color);
}

.task-checkbox.checked::after {
    content: '✓';
    color: white;
    font-size: 14px;
    font-weight: 700;
}

/* Task Text */
.task-text {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
    transition: var(--transition);
}

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

/* Delete Button */
.delete-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

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

.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    transform: scale(1.1);
}

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

.empty-state.visible {
    display: block;
}

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

.empty-state p {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 8px;
}

.empty-state small {
    font-size: 0.875rem;
}

/* Footer */
.app-footer {
    padding: 24px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-primary);
}

.footer-content strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 600;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.footer-content p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes pulse {
    0%, 100% {
        background-color: transparent;
    }
    50% {
        background-color: rgba(16, 185, 129, 0.1);
    }
}

.animate-add {
    animation: slideInUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-delete {
    animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.animate-complete {
    animation: pulse 0.6s ease;
}

/* Confetti */
#confetti-container {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    overflow: visible;
    z-index: 9999;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    opacity: 1;
    animation: confetti-fall 3s ease-out forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .app-title {
        font-size: 1.75rem;
    }
    
    .btn-text {
        display: none;
    }
    
    .btn-add {
        padding: 14px 18px;
    }
    
    .task-form {
        padding: 20px;
    }
    
    .tasks-container {
        padding: 20px;
    }
}
