/* ============== 1. Global Styles & Variables ============== */
:root {
    --primary-color: #4a90e2;
    --secondary-color: #f5f7fa;
    --tertiary-color: #e9ecef;
    --text-color: #333;
    --border-color: #ddd;
    --danger-color: #e74c3c;
    --success-color: #2ecc71;
    --priority-high: #e74c3c;
    --priority-medium: #f39c12;
    --priority-low: #3498db;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

body.dark-theme {
    --secondary-color: #1a1a1a;
    --tertiary-color: #3a3a3a;
    --text-color: #f5f7fa;
    --border-color: #444;
    --shadow-color: rgba(255, 255, 255, 0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Roboto', sans-serif; background-color: var(--secondary-color); color: var(--text-color); display: flex; justify-content: center; padding: 20px; }
.container { width: 100%; max-width: 650px; background: white; padding: 30px; border-radius: 12px; box-shadow: 0 5px 20px var(--shadow-color); }
body.dark-theme .container { background: #2b2b2b; }


/* ============== 2. Header & Controls ============== */
header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; margin-bottom: 20px; }
header h1 { font-size: 28px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.controls > * { flex: 1 1 150px; }
input[type="search"], select { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 16px; background-color: var(--secondary-color); color: var(--text-color); }


/* ============== 3. Date Sections & Task List ============== */
.date-section-header { cursor: pointer; padding: 10px 5px; font-weight: bold; font-size: 18px; margin-top: 20px; border-bottom: 2px solid var(--primary-color); }
.date-section-header::after { content: ' ▼'; font-size: 12px; }
.date-section.collapsed .date-section-header::after { content: ' ►'; }
.date-section.collapsed .task-list { display: none; }

.task-list { list-style: none; padding-left: 0; }
.task-item { display: flex; justify-content: space-between; align-items: center; padding: 15px; border: 1px solid var(--border-color); border-left-width: 5px; border-radius: 8px; margin-top: 15px; transition: all 0.3s ease; cursor: grab; }
.task-item:hover { box-shadow: 0 2px 10px var(--shadow-color); transform: translateY(-2px); }
.task-item.completed .task-details { text-decoration: line-through; opacity: 0.6; }
.task-item.dragging { opacity: 0.5; background: var(--tertiary-color); }

.task-item.priority-high { border-left-color: var(--priority-high); }
.task-item.priority-medium { border-left-color: var(--priority-medium); }
.task-item.priority-low { border-left-color: var(--priority-low); }

.task-actions button { margin-left: 10px; background: none; border: none; cursor: pointer; padding: 5px; font-size: 18px; }


/* ============== 4. Sub-task Styling ============== */
.sub-task-list { list-style: none; padding: 10px 0 0 20px; margin-top: 10px; border-top: 1px dashed var(--border-color); }
.sub-task-item { display: flex; align-items: center; font-size: 14px; padding: 5px 0; }
.sub-task-item input[type="checkbox"] { margin-right: 10px; }
.sub-task-item.completed { text-decoration: line-through; opacity: 0.7; }


/* ============== 5. Modal Styling ============== */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); display: none; justify-content: center; align-items: center; z-index: 1000; }
.modal-overlay.show { display: flex; }
.modal-content { background: white; padding: 30px; border-radius: 12px; width: 90%; max-width: 500px; }
body.dark-theme .modal-content { background: #2b2b2b; }
#task-form { display: flex; flex-direction: column; gap: 15px; }
#task-form input, #task-form textarea, #task-form select { width: 100%; padding: 12px; border: 1px solid var(--border-color); border-radius: 8px; font-size: 16px; background-color: var(--secondary-color); color: var(--text-color); }


/* ============== 6. Toast Notifications ============== */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 2000; }
.toast { background-color: #333; color: white; padding: 15px 20px; border-radius: 8px; margin-bottom: 10px; box-shadow: 0 5px 15px rgba(0,0,0,0.2); opacity: 0; transform: translateY(20px); animation: slideIn 0.3s forwards, slideOut 0.3s forwards 3.5s; }
.toast.success { background-color: var(--success-color); }
.toast.error { background-color: var(--danger-color); }
@keyframes slideIn { to { opacity: 1; transform: translateY(0); } }
@keyframes slideOut { to { opacity: 0; transform: translateY(20px); } }


/* ============== 7. Button Styling ============== */
.button-primary { background-color: var(--primary-color); color: white; border: none; padding: 12px 20px; border-radius: 8px; cursor: pointer; font-size: 16px; transition: background-color 0.2s ease; }
.button-primary:hover { background-color: #3a7ac8; }
#cancel-btn { background-color: transparent; border: 2px solid var(--border-color); color: var(--text-color); padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 16px; transition: all 0.2s ease; }
#cancel-btn:hover { background-color: var(--tertiary-color); }
.button-tertiary { background-color: var(--tertiary-color); color: var(--text-color); border: 1px solid var(--border-color); }

