/* CSS Reset and Box Sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 40px 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
}

header h1 {
    color: #ffffff;
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 4px 12px #00000026;
    margin-bottom: 8px;
}

header h1::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: #ffffff4d;
    margin: 16px auto;
    border-radius: 2px;
}

/* Main Container */
main {
    max-width: 680px;
    margin: 0 auto;
    background: #fffffff2;
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 25px 50px #00000026;
    border: 1px solid #ffffff33;
    overflow: hidden;
}

/* Todo Input Section */
.todo-input-section {
    padding: 40px;
    background: #ffffff1a;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid #ffffff1a;
}

.todo-form .input-group {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

#todo-input {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid #ffffff33;
    border-radius: 16px;
    font-size: 16px;
    background: #ffffffe6;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px #0000001a;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #2d3748;
}

#todo-input::placeholder {
    color: #a0aec0;
}

#todo-input:focus {
    outline: none;
    border-color: #ffffff99;
    box-shadow: 0 8px 32px #00000026, 0 0 0 3px #ffffff1a;
    transform: translateY(-2px);
}

.add-btn {
    padding: 16px 32px;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 32px #4facfe4d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.5px;
}

.add-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px #4facfe66;
}

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

.error-message {
    color: #ff6b6b;
    font-size: 14px;
    margin-top: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.error-message.show {
    opacity: 1;
}

/* Todo Controls */
.todo-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px 40px;
    background: #f8fafc;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
}

#todo-count {
    color: #64748b;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.025em;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    background: #ffffffb3;
    padding: 4px;
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px #0000000d;
}

.filter-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-size: 14px;
    letter-spacing: 0.025em;
}

.filter-btn:hover {
    background: #6366f11a;
    color: #6366f1;
}

.filter-btn.active {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px #6366f14d;
}

/* Todo List */
.todo-list {
    list-style: none;
    min-height: 240px;
    padding: 8px;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    margin: 8px 0;
    border-radius: 16px;
    background: #ffffffe6;
    backdrop-filter: blur(10px);
    border: 1px solid #e2e8f080;
    box-shadow: 0 4px 12px #0000000d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.todo-item:hover {
    background: #ffffff;
    box-shadow: 0 8px 25px #0000001a;
    transform: translateY(-2px);
}

.todo-item.completed {
    background: #f8fafce6;
    opacity: 0.7;
}

.todo-item.completed .todo-text {
    text-decoration: line-through;
    color: #94a3b8;
}

.todo-checkbox {
    width: 24px;
    height: 24px;
    margin-right: 20px;
    cursor: pointer;
    accent-color: #6366f1;
    transform: scale(1.2);
}

.todo-text {
    flex: 1;
    font-size: 16px;
    line-height: 1.5;
    cursor: pointer;
    color: #334155;
    font-weight: 500;
}

.todo-edit-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #6366f1;
    border-radius: 12px;
    font-size: 16px;
    background: #fffffff2;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px #6366f133;
}

.todo-actions {
    display: flex;
    gap: 12px;
}

.edit-btn,
.delete-btn, 
.cancel-btn,
.save-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.025em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}



.edit-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px #f59e0b4d;
}

.edit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px #f59e0b66;
}

.save-btn {
    background: linear-gradient(135deg, rgb(36, 113, 36) 0%, rgb(0, 70, 0) 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px #4df50b4d;
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px #f59e0b66;
}

.delete-btn,
.cancel-btn {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px #ef44444d;
}

.delete-btn:hover,
.cancel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px #ef444466;
}

/* List Actions */
.list-actions {
    padding: 32px 40px;
    background: #f8fafccc;
    backdrop-filter: blur(10px);
    text-align: center;
}

.clear-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #64748b 0%, #475569 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.025em;
    box-shadow: 0 4px 12px #64748b4d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.clear-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px #64748b66;
}

.clear-btn:disabled {
    background: #cbd5e1;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 32px;
    color: #ffffffcc;
    font-style: italic;
    font-size: 14px;
    text-shadow: 0 2px 4px #0000001a;
}

/* Hidden class for filtering */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .todo-form .input-group {
        flex-direction: column;
    }
    
    .add-btn {
        width: 100%;
    }
    
    .todo-controls {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .todo-item {
        padding: 12px 15px;
    }
    
    .todo-actions {
        flex-direction: column;
        gap: 5px;
    }
}