/* General Styles */
:root {
    --primary-color: #4CAF50; /* Green */
    --secondary-color: #007bff; /* Blue */
    --accent-color: #FFC107; /* Yellow for warnings */
    --delete-color: #dc3545; /* Red for delete */
    --bg-gradient-start: #8BC6EC; /* Light Blue */
    --bg-gradient-end: #957FEF; /* Purple */
    --card-bg: #ffffff;
    --text-color: #333333;
    --placeholder-color: #999999;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --font-family: 'Quicksand', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-color);
    padding: 20px; /* Add some padding for smaller screens */
}

.container {
    width: 100%;
    max-width: 540px; /* Max width for the app container */
}

.todo-app {
    background: var(--card-bg);
    padding: 30px 40px;
    border-radius: 15px;
    box-shadow: 0 15px 30px var(--shadow-color);
    animation: fadeIn 0.8s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.todo-app h2 {
    color: var(--primary-color);
    display: flex;
    align-items: center;
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: 700;
}

.todo-app h2 .fas {
    margin-right: 15px;
    font-size: 1.2em;
}

.row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-gradient-end); /* Use a subtle background for the input row */
    border-radius: 30px;
    padding-left: 20px;
    margin-bottom: 25px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

input[type="text"] {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    padding: 12px;
    font-size: 1.1em;
    color: var(--text-color);
}

input[type="text"]::placeholder {
    color: var(--placeholder-color);
}

button {
    border: none;
    outline: none;
    padding: 12px 30px;
    background: var(--primary-color);
    color: #fff;
    font-size: 1.1em;
    cursor: pointer;
    border-radius: 30px;
    transition: background 0.3s ease, transform 0.2s ease;
    font-weight: 500;
    white-space: nowrap; /* Prevent button text from wrapping */
}

button:hover {
    background: var(--secondary-color); /* Hover effect */
    transform: translateY(-2px);
}

.validation-message {
    color: var(--delete-color);
    font-size: 0.9em;
    margin-top: -15px;
    margin-bottom: 15px;
    text-align: center;
    min-height: 20px; /* Reserve space to prevent layout shift */
}

ul#taskList {
    list-style: none;
    padding: 0;
}

ul#taskList li {
    background: var(--bg-color-light); /* Light background for list items */
    font-size: 1.1em;
    padding: 12px 10px 12px 50px;
    margin-bottom: 10px;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.3s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

ul#taskList li:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Checkbox styling */
ul#taskList li::before {
    content: '';
    position: absolute;
    height: 28px;
    width: 28px;
    border-radius: 50%;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="%23555" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-circle"><circle cx="12" cy="12" r="10"></circle></svg>');
    background-size: cover;
    background-position: center;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    cursor: pointer;
    transition: background-image 0.3s ease;
}

ul#taskList li.checked {
    color: var(--secondary-color);
    text-decoration: line-through;
    background-color: #f0f8ff; /* Lighter background for checked items */
    opacity: 0.8;
}

ul#taskList li.checked::before {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="%234CAF50" stroke="%234CAF50" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-8.93"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>');
}

/* Task Text and Buttons Container */
.task-content {
    flex-grow: 1; /* Allows task text to take available space */
    padding-right: 10px; /* Space between text and buttons */
    word-break: break-word; /* Prevents long words from overflowing */
}

.task-actions {
    display: flex;
    gap: 8px; /* Space between buttons */
}

/* Action Buttons (Edit, Delete) */
ul#taskList li .action-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background-color: #e9e9e9;
    color: #555;
    font-size: 0.9em;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s ease, color 0.3s ease;
    border: none;
    outline: none;
}

ul#taskList li .action-btn:hover {
    background-color: var(--border-color);
}

ul#taskList li .edit-btn:hover {
    color: var(--secondary-color); /* Blue for edit */
}

ul#taskList li .delete-btn:hover {
    color: var(--delete-color); /* Red for delete */
}

/* Edit Mode Styling */
ul#taskList li input[type="text"] {
    flex-grow: 1;
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 1em;
    outline: none;
    margin-right: 10px;
    color: var(--text-color);
}
ul#taskList li input[type="text"]:focus {
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

/* Responsive Design */
@media (max-width: 600px) {
    .todo-app {
        padding: 25px 25px;
    }

    .todo-app h2 {
        font-size: 1.8em;
    }

    .row {
        flex-direction: column; /* Stack input and button */
        border-radius: 10px; /* Adjust border radius */
        padding-left: 0;
        background: none;
    }

    input[type="text"] {
        width: 100%;
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        padding: 10px 15px;
        background: var(--card-bg); /* Match input background */
    }

    button {
        width: 100%;
        padding: 10px 20px;
        font-size: 1em;
        border-radius: 8px;
    }

    ul#taskList li {
        padding: 10px 10px 10px 45px; /* Adjust padding for smaller icons */
        font-size: 1em;
    }

    ul#taskList li::before {
        height: 25px;
        width: 25px;
        left: 8px;
    }

    ul#taskList li .action-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8em;
    }
}