/* ========================================
   CSS Reset and Base Styles
   ======================================== */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #ef1d97 0%, #b45021 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    line-height: 1.6;
}

/* ========================================
   Container
   ======================================== */

.container {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px;
    max-width: 600px;
    width: 100%;
    animation: fadeIn 0.5s ease-in;
}

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

/* ========================================
   Header
   ======================================== */

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1rem;
}

/* ========================================
   Input Section
   ======================================== */

.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#taskInput {
    flex: 1;
    padding: 15px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    outline: none;
}

#taskInput:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#addButton {
    padding: 15px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

#addButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#addButton:active {
    transform: translateY(0);
}

/* ========================================
   Stats Section
   ======================================== */

.stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #666;
}

.stats span {
    font-weight: 600;
}

/* ========================================
   Task List
   ======================================== */

.task-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Custom scrollbar */
.task-list::-webkit-scrollbar {
    width: 8px;
}

.task-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.task-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.task-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ========================================
   Task Item
   ======================================== */

.task-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    margin-bottom: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
    border-left: 4px solid transparent;
}

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

.task-item:hover {
    background: #e9ecef;
    border-left-color: #667eea;
    transform: translateX(5px);
}

.task-content {
    flex: 1;
    cursor: pointer;
    user-select: none;
    word-break: break-word;
    padding-right: 15px;
    color: #333;
    font-size: 1rem;
}

/* Completed task styling */
.task-item.completed {
    opacity: 0.7;
}

.task-item.completed .task-content {
    text-decoration: line-through;
    color: #999;
}

/* ========================================
   Delete Button
   ======================================== */

.delete-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.delete-btn:hover {
    background: #ee5a52;
    transform: scale(1.05);
}

.delete-btn:active {
    transform: scale(0.95);
}

/* ========================================
   Empty State
   ======================================== */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
    font-size: 1.1rem;
    display: none;
}

.empty-state.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 600px) {
    .container {
        padding: 25px;
    }

    header h1 {
        font-size: 2rem;
    }

    .input-section {
        flex-direction: column;
    }

    #addButton {
        width: 100%;
    }

    .stats {
        flex-direction: column;
        gap: 8px;
    }

    .task-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .delete-btn {
        width: 100%;
        align-self: stretch;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 1.7rem;
    }

    #taskInput,
    #addButton {
        padding: 12px 16px;
        font-size: 0.95rem;
    }
}