body {
    font-family: sans-serif;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f4f4f9;
}

*, *::before, *::after {
    box-sizing: border-box;
}

h1, h2 {
    color: #333;
}

.hidden {
    display: none;
}

.container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
}

textarea {
    min-height: 90px;
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    min-height: 44px; /* better touch target */
}

button:hover {
    background-color: #0056b3;
}

button.secondary {
    background-color: #6c757d;
}

button.secondary:hover {
    background-color: #545b62;
}

button.danger {
    background-color: #dc3545;
}

button.danger:hover {
    background-color: #bd2130;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Todo List */
ul {
    list-style: none;
    padding: 0;
}

li.todo-item {
    background: #fff;
    border-bottom: 1px solid #eee;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 5px solid transparent; /* For status indication */
    transition: all 0.3s ease;
}

.todo-desc {
    width: 100%;
    margin-left: 30px;
    margin-top: 5px;
    color: #555;
    font-size: 0.95em;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Priority Backgrounds for Open Tasks */
li.todo-item.priority-high {
    background-color: #fff0f0; /* Very Light Red */
}

li.todo-item.priority-medium {
    background-color: #fff8e1; /* Very Light Yellow */
}

li.todo-item.priority-low {
    background-color: #f0f8ff; /* Alice Blue */
}

/* Reminder & Overdue Highlights */
li.todo-item.reminder-active {
    border-left-color: #ffc107; /* Amber */
    box-shadow: 0 0 5px rgba(255, 193, 7, 0.4);
}

li.todo-item.overdue {
    border-left-color: #dc3545; /* Red */
    box-shadow: 0 0 5px rgba(220, 53, 69, 0.4);
}

/* Done State Overrides */
li.todo-item.done {
    background-color: #f8f9fa; /* Light Gray */
    opacity: 0.8;
    border-left-color: transparent; /* Remove highlights if done */
    box-shadow: none;
}

li.todo-item.done span.title {
    text-decoration: line-through;
    color: #888;
}

.todo-actions {
    display: flex;
    gap: 5px;
}

.priority-badge {
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255,255,255,0.5); /* Semi-transparent white to blend */
    margin-right: 10px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* Optional: Keep badge colors if needed, or rely on row color */
.priority-high .priority-badge { color: #a00; }
.priority-medium .priority-badge { color: #856404; }
.priority-low .priority-badge { color: #155724; }

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    position: relative;
    max-height: 90vh;
    overflow: auto;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.footer-links {
    text-align: center;
    color: #666;
}

.footer-links a {
    color: #007bff;
    text-decoration: none;
}

.footer-links a:hover {
    text-decoration: underline;
}

/* ------------------
   Mobile adjustments
   ------------------ */
@media (max-width: 600px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 14px;
        border-radius: 8px;
    }

    .app-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .app-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .app-toolbar-actions {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
    }

    button {
        width: 100%;
    }

    li.todo-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .todo-actions {
        justify-content: flex-end;
    }

    .priority-badge {
        margin-right: 6px;
    }

    .todo-desc {
        margin-left: 0;
    }

    .modal {
        align-items: flex-start;
        padding: 12px;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        padding: 16px;
        border-radius: 10px;
    }

    .close {
        font-size: 34px;
        right: 12px;
        top: 6px;
    }
}
