:root {
    --bg-color: #121212;
    --surface-color: #1e1e1e;
    --primary-color: #bb86fc;
    --primary-variant-color: #3700b3;
    --secondary-color: #03dac6;
    --on-surface-color: #e1e1e1;
    --on-surface-secondary-color: #a0a0a0;
    --error-color: #cf6679;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--on-surface-color);
    margin: 0;
    padding: 1rem;
    line-height: 1.6;
}
body.modal-open {
    overflow: hidden;
}

/* Tùy chỉnh thanh cuộn (Scrollbar) cho đồng bộ Dark Mode */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background-color: #4a4a4a;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background-color: var(--on-surface-secondary-color);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}
header {
    border-bottom: 1px solid var(--surface-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}
header h1 {
    margin: 0;
    text-align: center;
    color: var(--primary-color);
}
.filters {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}
button {
    background-color: var(--surface-color);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}
button:hover, button.active {
    background-color: var(--primary-color);
    color: var(--bg-color);
}
button.save-btn {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: var(--bg-color);
    width: 100%;
    margin-top: 1rem;
}
#task-list {
    list-style: none;
    padding: 0;
    position: relative;
}
.sticky-date {
    position: sticky;
    top: 0;
    background-color: var(--bg-color);
    color: var(--primary-color);
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    z-index: 10;
    border-bottom: 1px dashed var(--surface-color);
}
.task-item {
    background-color: var(--surface-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 5px solid var(--primary-variant-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
}
.task-item:hover {
    background-color: #2a2a2a;
}
.task-time {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--secondary-color);
}
.task-name {
    font-size: 1rem;
    margin-top: 0.5rem;
}
.quick-done-btn {
    background-color: var(--secondary-color);
    color: var(--bg-color);
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    font-weight: bold;
    flex-shrink: 0; /* Ngăn nút bị co lại khi tên công việc quá dài */
    transition: background-color 0.2s;
}
.quick-done-btn:hover {
    background-color: #018786; /* Màu đậm hơn của secondary-color */
    color: var(--bg-color); /* Giữ nguyên màu chữ khi hover */
}
.quick-done-btn.undo-btn {
    background-color: var(--error-color);
    color: var(--bg-color);
}
.quick-done-btn.undo-btn:hover {
    background-color: #b33951;
}
.quick-done-btn:disabled {
    background-color: transparent;
    color: var(--on-surface-secondary-color);
    border: 1px solid var(--on-surface-secondary-color);
    cursor: not-allowed;
}
.task-item.pending-action {
    opacity: 0.6;
    border-left-color: var(--error-color);
    transition: all 0.3s ease;
}
.task-item.completed-task {
    background-color: #2e7d32; /* Greenish background */
    border-left-color: #66bb6a;
    cursor: default;
    padding: 1rem;
    text-align: center;
    justify-content: center;
}
.confirmation-message {
    width: 100%;
    color: #e8f5e9;
    font-size: 0.95rem;
}
#no-tasks {
    text-align: center;
    color: var(--on-surface-secondary-color);
    padding: 2rem;
}
dialog {
    background-color: var(--surface-color);
    color: var(--on-surface-color);
    border: 1px solid var(--primary-color);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    position: relative;
    box-sizing: border-box;
    /* Ẩn thanh cuộn của modal */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
dialog::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}
dialog::backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(3px);
}
dialog h2 {
    margin-top: 0;
    color: var(--primary-color);
}
.close-modal-btn {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    background: transparent;
    border: none;
    color: var(--on-surface-secondary-color);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}
.close-modal-btn:hover {
    color: var(--error-color);
    background: transparent;
}
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--on-surface-secondary-color);
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--bg-color);
    border: 1px solid var(--on-surface-secondary-color);
    border-radius: 4px;
    color: var(--on-surface-color);
    font-size: 1rem;
    box-sizing: border-box;
    font-family: inherit;
}
.form-group textarea {
    resize: none;
    overflow: hidden;
    min-height: 80px;
}
#loader {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 8px solid var(--surface-color);
    border-top: 8px solid var(--primary-color);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    z-index: 1000;
}
@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}
.modal-actions {
    display: flex;
    justify-content: flex-end; /* Căn nút sang phải */
    gap: 1rem; /* Khoảng cách giữa các nút */
    margin-top: 1.5rem; /* Khoảng cách từ các trường nhập liệu phía trên */
}
.modal-actions button {
    width: auto; /* Ghi đè thuộc tính width: 100% từ .save-btn */
    margin-top: 0; /* Ghi đè margin-top từ .save-btn */
}