* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #257dbb;
    --secondary-color: #042241;
    --success-color: #4CAF50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    --text-color: #333;
    --bg-color: #f0f2f5;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --text-color: #ecf0f1;
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --border-color: #404040;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: var(--transition);
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 20px;
}

.todo-app {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    transition: var(--transition);
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.app-header h1 {
    font-size: 1.8rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

.theme-toggle button:hover {
    transform: rotate(30deg);
}

.stats-bar {
    display: flex;
    justify-content: space-around;
    background: rgba(37, 125, 187, 0.1);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.stat {
    text-align: center;
}

.stat-count {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-color);
    opacity: 0.8;
}

.input-area {
    width: 100%;
}

.input-wrapper {
    position: relative;
    display: flex;
    width: 100%;
    margin-bottom: 15px;
}

#task-input {
    flex: 1;
    padding: 15px 60px 15px 20px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    outline: none;
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text-color);
    transition: var(--transition);
    width: 100%;
}

#task-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 125, 187, 0.1);
}

#task-input::placeholder {
    color: var(--text-color);
    opacity: 0.6;
}

#add-task-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: white;
    font-size: 1rem;
    background: var(--primary-color);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

#add-task-btn:hover {
    transform: translateY(-50%) scale(1.1);
    background: var(--secondary-color);
}

.priority-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.priority-options {
    display: flex;
    gap: 5px;
}

.priority-btn {
    padding: 5px 12px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 15px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
}

.priority-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.priority-btn[data-priority="high"]:hover {
    background: var(--danger-color);
    color: white;
}

.priority-btn[data-priority="medium"]:hover {
    background: var(--warning-color);
    color: white;
}

.priority-btn[data-priority="low"]:hover {
    background: var(--success-color);
    color: white;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.todos-container {
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.todos-container::-webkit-scrollbar {
    width: 6px;
}

.todos-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.todos-container::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.todos-container::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

#task-list {
    list-style: none;
    width: 100%;
}

.task-item {
    background: var(--card-bg);
    margin: 8px 0;
    padding: 15px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.task-item:hover {
    transform: translateX(5px);
    box-shadow: var(--shadow);
}

.task-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--primary-color);
}

.task-item.priority-high::before {
    background: var(--danger-color);
}

.task-item.priority-medium::before {
    background: var(--warning-color);
}

.task-item.priority-low::before {
    background: var(--success-color);
}

.task-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.task-text {
    color: var(--text-color);
    font-size: 1rem;
    word-break: break-word;
}

.task-meta {
    display: flex;
    gap: 10px;
    font-size: 0.8rem;
    opacity: 0.7;
}

.task-priority {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
}

.priority-high {
    background: rgba(244, 67, 54, 0.2);
    color: var(--danger-color);
}

.priority-medium {
    background: rgba(255, 152, 0, 0.2);
    color: var(--warning-color);
}

.priority-low {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success-color);
}

.task-actions {
    display: flex;
    gap: 8px;
}

.task-actions button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: var(--transition);
    opacity: 0.7;
}

.task-actions button:hover {
    background: var(--border-color);
    opacity: 1;
    transform: scale(1.1);
}

.completed {
    text-decoration: line-through;
    opacity: 0.6;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-color);
    opacity: 0.7;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.clear-btn {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
}

.clear-btn:hover {
    background: var(--danger-color);
    color: white;
    border-color: var(--danger-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow);
    animation: modalSlideIn 0.3s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--text-color);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 20px;
}

#edit-task-input {
    width: 100%;
    height: 100px;
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 1rem;
    resize: vertical;
    margin-bottom: 15px;
}

.modal-priority {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.save-btn, .cancel-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
}

.save-btn {
    background: var(--primary-color);
    color: white;
}

.save-btn:hover {
    background: var(--secondary-color);
}

.cancel-btn {
    background: var(--border-color);
    color: var(--text-color);
}

.cancel-btn:hover {
    background: var(--danger-color);
    color: white;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .todo-app {
        padding: 1.5rem;
        max-width: 100%;
    }
    
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .stats-bar {
        padding: 10px;
    }
    
    .app-footer {
        flex-direction: column;
    }
    
    .filters {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .todo-app {
        padding: 1rem;
    }
    
    .input-wrapper {
        flex-direction: column;
        gap: 10px;
    }
    
    #add-task-btn {
        position: static;
        transform: none;
        width: 100%;
        border-radius: 8px;
        height: 45px;
    }
    
    .priority-selector {
        flex-direction: column;
        align-items: flex-start;
    }
}