/* ==========================================
   🎯 TO-DO LIST APP – FULLY COMMENTED CSS
   Author: Jishan
   ========================================== */

/* 🌐 Global Theme Variables */
:root {
    --primary: #6366f1;         /* Indigo - Primary action color */
    --primary-dark: #4f46e5;    /* Darker indigo for hover */
    --secondary: #f43f5e;       /* Red - Delete/Alert color */
    --dark: #1e293b;            /* Text color */
    --light: #f8fafc;           /* Background color */
    --success: #10b981;         /* Green - Success state */
    --warning: #f59e0b;         /* Yellow - Edit button */
    --gray: #64748b;            /* Muted text/icons */
}

/* 🔄 Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* 📄 Body Styling */
body {
    background-color: #f1f5f9;  /* Light gray background */
    color: var(--dark);         /* Dark text */
    min-height: 100vh;
    padding: 2rem;
    transition: background-color 0.3s ease;
}

/* 📦 Container for the entire app */
.container {
    max-width: 800px;
    margin: 0 auto;
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
                0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* 📌 Header Section */
header {
    background-color: var(--primary);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 🏷️ Heading */
h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

/* 🔢 Task Count Badge */
.todo-count {
    background-color: rgba(255, 255, 255, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* 📝 Form Section */
.task-form {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

/* 🔤 Input + Button */
.form-group {
    display: flex;
    gap: 0.5rem;
}

/* 🧾 Text Input */
input[type="text"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease;
}

/* 🖱️ Input Focus */
input[type="text"]:focus {
    border-color: var(--primary);
}

/* 🖲️ Buttons */
button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* 💠 Primary Button */
.btn-primary {
    background-color: var(--primary);
    color: white;
}

/* 🔁 Hover Effect */
.btn-primary:hover {
    background-color: var(--primary-dark);
}

/* 📋 Task List */
.task-list {
    padding: 0;
    list-style: none;
}

/* 🧩 Task Item */
.task-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: background-color 0.2s;
}

/* 🔁 Task Item Hover */
.task-item:hover {
    background-color: #f8fafc;
}

/* ✅ Task Checkbox */
.task-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--primary); /* Custom checkbox color */
    cursor: pointer;
}

/* 📃 Task Text */
.task-text {
    flex: 1;
    font-size: 1rem;
    transition: color 0.2s;
}

/* ✅ Completed Task */
.task-text.completed {
    text-decoration: line-through;
    color: var(--gray);
}

/* ✏️🗑️ Action Buttons (Edit/Delete) */
.task-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

/* 📌 Show Actions on Hover */
.task-item:hover .task-actions {
    opacity: 1;
}

/* 🔘 Icon Button Style */
.btn-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: transparent;
    color: var(--gray);
    transition: all 0.2s ease;
    position: relative;
}

/* 🎨 Icon Button Hover */
.btn-icon:hover {
    background-color: #f1f5f9;
    color: var(--dark);
}

/* ✏️ Edit Button */
.btn-edit {
    color: var(--warning);
}

/* 🗑️ Delete Button */
.btn-delete {
    color: var(--secondary);
}

/* 🧭 Tooltip on Hover (Optional) */
.btn-icon:hover::after {
    content: attr(title);
    position: absolute;
    bottom: -1.8rem;
    font-size: 0.75rem;
    background-color: var(--gray);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    white-space: nowrap;
}

/* 📭 Empty State UI */
.empty-state {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--gray);
}

/* 📋 Empty State Icon */
.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #e2e8f0;
}

/* 🧾 Edit Mode */
.edit-form {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

/* ✍️ Edit Input Field */
.edit-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.25rem;
}

/* 🔀 Filter Tabs Container */
.filter-tabs {
    display: flex;
    border-bottom: 1px solid #e2e8f0;
}

/* 📌 Individual Filter Tab */
.filter-tab {
    flex: 1;
    text-align: center;
    padding: 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

/* 💡 Hover Effect on Tabs */
.filter-tab:hover {
    color: var(--primary);
}

/* 🔵 Active Filter Tab */
.filter-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* 📱 Responsive Design */
@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    .form-group {
        flex-direction: column;
    }

    button {
        width: 100%;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .filter-tab {
        font-size: 0.875rem;
    }
}

/* 🌙 Dark Mode Support (Add class "dark-mode" to <body>) */
body.dark-mode {
    background-color: #0f172a;
    color: var(--light);
}

body.dark-mode .container {
    background-color: #1e293b;
}

body.dark-mode .task-item:hover {
    background-color: #334155;
}

body.dark-mode .task-text.completed {
    color: #94a3b8;
}

body.dark-mode .btn-icon:hover {
    background-color: #334155;
    color: var(--light);
}
