/* Custom properties for easy theme management */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #333;
    --border-color: #e9ecef;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header & Branding */
.header {
    background: var(--primary-color);
    color: white;
    padding: 1rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
}

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

.branding {
    font-size: 0.85rem;
}

.branding a {
    color: #ffd700; /* Gold color for visibility */
    text-decoration: none;
    transition: color 0.3s;
}

.branding a:hover {
    color: white;
    text-decoration: underline;
}

/* Main Container (Mobile-first sizing) */
.container {
    flex-grow: 1;
    width: 90%;
    max-width: 600px;
    margin: 20px auto;
    padding: 15px;
}

/* Input Section */
.todo-input {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: var(--card-bg);
    padding: 10px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

#new-todo-input {
    flex-grow: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

#new-todo-input:focus {
    border-color: var(--primary-color);
}

#add-todo-btn {
    padding: 10px 15px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s, transform 0.1s;
    white-space: nowrap;
}

#add-todo-btn:hover {
    background: #0056b3;
}

#add-todo-btn:active {
    transform: scale(0.98);
}

/* Todo List */
.todo-list-container {
    background: var(--card-bg);
    padding: 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.todo-list {
    list-style: none;
    padding: 0;
}

.todo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s;
}

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

.todo-item:hover {
    background-color: #f8f9fa;
}

.todo-content {
    display: flex;
    align-items: center;
    flex-grow: 1;
    cursor: pointer;
    padding-right: 10px;
    /* Ensure content wraps if text is long */
    overflow: hidden; 
}

.todo-text {
    margin-left: 10px;
    font-size: 1rem;
    word-break: break-word;
    flex-shrink: 1;
}

/* Completed State */
.completed .todo-text {
    text-decoration: line-through;
    color: var(--secondary-color);
}

.completed .checkbox {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.checkbox {
    min-width: 20px; /* fixed size for checkbox */
    height: 20px;
    border: 2px solid var(--secondary-color);
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.checkbox i {
    font-size: 0.75rem;
    line-height: 1;
    visibility: hidden;
}

.completed .checkbox i {
    visibility: visible;
}

/* Actions */
.todo-actions {
    flex-shrink: 0;
}

.todo-actions button {
    background: none;
    border: none;
    cursor: pointer;
    margin-left: 5px;
    padding: 5px;
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
}

.todo-actions button:hover {
    opacity: 1;
}

.delete-btn {
    color: var(--danger-color);
}

/* Empty State Message */
.empty-message {
    padding: 20px;
    text-align: center;
    color: var(--secondary-color);
    font-style: italic;
}

/* Footer */
footer {
    padding: 15px;
    text-align: center;
    background: #343a40;
    color: #fff;
    font-size: 0.9rem;
    margin-top: auto;
}

/* Responsive adjustments for small screens */
@media (max-width: 480px) {
    .todo-input {
        flex-direction: column;
        padding: 15px;
    }

    #add-todo-btn {
        width: 100%;
    }
    
    .todo-item {
        padding: 10px;
    }
}