/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 1rem;
    color: var(--text-primary);
    line-height: 1.6;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Container */
.container {
    max-width: 42rem;
    margin: 0 auto;
    background: var(--bg-primary);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-1rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

h1 {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Task input form */
.task-input-section {
    margin-bottom: 2rem;
}

.task-form {
    display: flex;
    gap: 0.75rem;
}

.task-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
}

.task-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

/* Task stats */
.task-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.task-count {
    color: var(--text-primary);
    font-weight: 600;
}

.completed-count {
    color: var(--text-secondary);
}

/* Task list */
.task-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    transition: all 0.2s;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-1rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.task-item:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

.task-item.completed {
    opacity: 0.7;
    background: var(--bg-secondary);
}

.task-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--success-color);
}

.task-text {
    flex: 1;
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-word;
}

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

.btn-delete {
    padding: 0.5rem 0.75rem;
    background: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-delete:hover {
    background: var(--danger-color);
    color: white;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 3rem 1rem;
    font-size: 1rem;
}

.empty-state.hidden {
    display: none;
}

/* Responsive design */
@media (max-width: 640px) {
    body {
        padding: 0.5rem;
    }

    .container {
        padding: 1.5rem;
        border-radius: 0.75rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .task-form {
        flex-direction: column;
    }

    .btn-text {
        display: inline;
    }

    .task-stats {
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-start;
    }

    .task-item {
        padding: 0.75rem;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .container {
        max-width: 36rem;
    }
}
