/* Base Styles */
body[data-theme="light"] {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #059669;
    --danger-color: #dc2626;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --header-bg: #2563eb;
    --header-text: #ffffff;
}

body[data-theme="dark"] {
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --text-color: #f3f4f6;
    --text-light: #9ca3af;
    --border-color: #374151;
    --bg-color: #111827;
    --card-bg: #1f2937;
    --header-bg: #2563eb;
    --header-text: #ffffff;
}

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

/* Container and Card Styles */
.container {
    width: 100%;
    max-width: 500px;
}

.app {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Header */
.app-header {
    background-color: var(--header-bg);
    padding: 1.5rem;
    color: var(--header-text);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--header-text);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: 50%;
    transition: transform 0.3s;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.app-header p {
    margin-top: 0.25rem;
    opacity: 0.9;
    font-size: 0.875rem;
}

.icon {
    display: inline-block;
    vertical-align: middle;
}

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

.input-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

#task-input {
    flex: 1;
    padding: 0.875rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: border-color 0.2s;
    height: 46px;
}

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

#task-input.error {
    border-color: var(--danger-color);
}

.error-message {
    margin-top: 0.5rem;
    color: var(--danger-color);
    font-size: 0.75rem;
    animation: fadeIn 0.3s ease;
}

.hidden {
    display: none;
}

/* Filter Tabs */
.filter-tabs {
    padding: 1rem 1.5rem;
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.filter-tabs button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-light);
    padding-bottom: 0.5rem;
    position: relative;
    transition: color 0.2s;
}

.filter-tabs button:hover {
    color: var(--text-color);
}

.filter-tabs button.active {
    color: var(--primary-color);
}

.filter-tabs button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

/* Task List */
.task-list-container {
    max-height: 320px;
    overflow-y: auto;
    padding: 0.5rem;
}

#task-list {
    list-style-type: none;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    transition: background-color 0.2s;
    animation: slideIn 0.3s ease;
}

.task-item:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.checkbox-container {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 1.5px solid var(--border-color);
    margin-right: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}

.checkbox-container:hover {
    border-color: var(--primary-color);
}

.checkbox-container.checked {
    background-color: var(--success-color);
    border-color: var(--success-color);
}

.task-text {
    flex: 1;
    font-size: 0.875rem;
    word-break: break-word;
}

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

.delete-btn {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
}

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

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

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: var(--text-light);
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.empty-state .icon {
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

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

/* Footer */
.app-footer {
    background-color: rgba(245, 245, 245, 0.5);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-light);
}

#clear-completed {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    font-size: 0.75rem;
    transition: color 0.2s;
}

#clear-completed:hover {
    color: var(--primary-color);
}

/* Button */
button[type="submit"] {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

button[type="submit"]:hover {
    background-color: var(--primary-hover);
}

button:focus {
    outline: none;
}

/* Progress Bar */
.progress-container {
    margin-top: 1rem;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.progress-bar {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 8px;
    overflow: hidden;
}

.progress-fill {
    background-color: #10b981;
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Search Box */
.search-container {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

#search-input {
    width: 100%;
    padding: 0.875rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9375rem;
    height: 46px;
    background-color: rgba(245, 245, 245, 0.5);
    transition: all 0.2s;
}

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

/* Highlight search results */
.highlight {
    background-color: rgba(79, 70, 229, 0.1);
    border-radius: 2px;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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