/* Variables for easy theme switching */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #388E3C;
    --background-color: #f4f7f6;
    --card-background: #ffffff;
    --text-color: #333;
    --completed-color: #9e9e9e;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Header Styling */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem 0;
    text-align: center;
    box-shadow: var(--shadow);
}

header h1 {
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.anycoder-link {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.anycoder-link:hover {
    color: white;
    text-decoration: underline;
}

/* Main Layout */
main {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.todo-container {
    width: 100%;
    max-width: 650px;
    background: var(--card-background);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.todo-container h2 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    padding-bottom: 5px;
    border-bottom: 2px solid #eee;
}

/* Input Form Styling */
.input-form {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.input-form input[type="text"] {
    flex-grow: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.input-form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

.input-form button {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background-color 0.3s, transform 0.1s;
}

.input-form button:hover {
    background-color: var(--secondary-color);
}
.input-form button:active {
    transform: scale(0.98);
}

/* Task List Styling */
.todo-list {
    list-style: none;
    padding: 0;
}

.todo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #eee;
    transition: opacity 0.3s;
}

.todo-item:last-child {
    border-bottom: none;
}

.task-content {
    flex-grow: 1;
    padding-right: 15px;
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}

/* Completed State */
.todo-item.completed {
    opacity: 0.8;
}

.todo-item.completed .task-content {
    text-decoration: line-through;
    color: var(--completed-color);
}

.todo-item button.delete-btn {
    background: none;
    border: none;
    color: #ff5252;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 5px;
    opacity: 0.6;
    transition: opacity 0.3s, color 0.3s;
}

.todo-item button.delete-btn:hover {
    opacity: 1;
    color: #f44336;
}

.empty-state {
    text-align: center;
    color: var(--completed-color);
    padding: 30px 0;
    font-style: italic;
}

/* Footer Styling */
footer {
    padding: 15px;
    text-align: center;
    font-size: 0.9rem;
    color: #666;
    border-top: 1px solid #eee;
    margin-top: auto;
    background-color: #ffffff;
}

/* Responsive Adjustments (Mobile-First) */
@media (max-width: 650px) {
    main {
        padding: 10px;
    }
    .todo-container {
        padding: 20px 15px;
        margin: 0;
        border-radius: 0;
        box-shadow: none;
    }

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

    .input-form input[type="text"],
    .input-form button {
        width: 100%;
    }
}