:root {
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-color: #1e293b;
    --border-color: #cbd5e1;
    --hover-bg: #f1f5f9;
    --primary: #3b82f6;
    --danger: #ef4444;
    --grid-line: #e2e8f0;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
.app-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1rem;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.date-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

.date-container input {
    padding: 0.5rem;
    border: none;
    border-bottom: 2px solid var(--text-color);
    background: transparent;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1rem;
    transition: background 0.2s, transform 0.1s;
}

button:active {
    transform: scale(0.98);
}

.primary-btn {
    background-color: var(--primary);
    color: white;
}

.primary-btn:hover {
    background-color: #2563eb;
}

.danger-btn {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
}

.danger-btn:hover {
    background-color: #fef2f2;
}

/* Layout */
.app-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .app-container {
        grid-template-columns: 1fr 1fr;
    }
}

/* Sections */
.section {
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Top Priorities */
.top-priorities-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 2px solid var(--text-color);
    border-radius: 4px;
    background: var(--card-bg);
    min-height: 156px;
}

/* Placeholders inside Top Priorities to show exactly 3 boxes empty or filled */
.drop-zone {
    min-height: 60px;
    transition: background-color 0.2s;
}

.drop-zone.drag-over {
    background-color: var(--hover-bg);
}

.top-priorities-list .priority-placeholder {
    display: none;
    padding: 1rem;
    color: #94a3b8;
    text-align: center;
    font-style: italic;
    border-bottom: 2px solid var(--text-color);
}

.top-priorities-list .priority-placeholder:last-child {
    border-bottom: none;
}

.top-priorities-list:empty::before {
    content: "Drop up to 3 priorities here";
    display: block;
    padding: 1rem;
    color: #94a3b8;
    text-align: center;
    font-style: italic;
}

/* Brain Dump */
.brain-dump-input-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.brain-dump-input-wrapper textarea {
    flex: 1;
    resize: vertical;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.brain-dump-input-wrapper textarea:focus {
    border-color: var(--primary);
}

.brain-dump-grid {
    border: 3px solid var(--text-color);
    background-color: var(--card-bg);
    background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 20px 20px;
    min-height: 500px;
    border-radius: 4px;
    padding: 1rem;
}

.brain-dump-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 100%;
}

/* Time Box Schedule */
.time-range-controls {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    background: var(--card-bg);
    padding: 1rem;
    border: 1px solid var(--text-color);
    border-radius: 4px;
}

.time-select-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.time-select-group label {
    font-weight: 600;
    white-space: nowrap;
}

.time-select {
    flex: 1;
    padding: 0.6rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    background-color: var(--bg-color);
    cursor: pointer;
    transition: border-color 0.2s;
}

.time-select:focus {
    border-color: var(--primary);
}

@media (max-width: 480px) {
    .time-range-controls {
        flex-direction: column;
    }
}

.time-schedule {
    border: 1px solid var(--text-color);
    background: var(--card-bg);
    border-radius: 4px;
}

.time-row,
.time-header {
    display: grid;
    grid-template-columns: 50px 1fr 1fr;
    border-bottom: 1px solid var(--text-color);
}

.time-row:last-child {
    border-bottom: none;
}

.time-header {
    font-weight: 600;
    text-align: center;
    background: transparent;
}

.time-header>div {
    padding: 0.5rem;
    border-right: 1px solid var(--text-color);
}

.time-header>div:last-child {
    border-right: none;
}

.time-label,
.th-hour {
    font-weight: 600;
    text-align: center;
    padding: 0.5rem;
    border-right: 1px solid var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-slot {
    padding: 0.5rem;
    min-height: 60px;
    border-right: 1px solid var(--text-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-slot:last-child {
    border-right: none;
}

/* Task Cards */
/* Task Cards */
.task-card {
    background-color: var(--card-bg);
    border: 2px solid var(--text-color);
    border-radius: 4px;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: grab;
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    touch-action: none;
    transition: background-color 0.2s, opacity 0.2s;
}

.task-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.drag-handle {
    color: #94a3b8;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    /* Larger touch target for mobile */
}

/* Custom Checkbox Styling */
.task-checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-right: 0.25rem;
}

.task-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--primary);
}

.task-text {
    flex: 1;
    word-break: break-word;
    outline: none;
    transition: color 0.2s, text-decoration 0.2s;
}

.task-card.completed .task-text {
    color: #94a3b8;
    text-decoration: line-through;
}

.task-text[contenteditable="true"]:focus {
    border-bottom: 2px dashed var(--primary);
}

.delete-btn {
    background: transparent;
    color: #94a3b8;
    border: none;
    font-size: 1.25rem;
    padding: 0 0.25rem;
    cursor: pointer;
    transition: color 0.1s;
}

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

/* Specific styling for Top Priorities cards */
#top-priorities .task-card {
    background-color: #e0f2fe;
    /* Soft Blue */
    border: none;
    border-bottom: 2px solid var(--text-color);
    border-radius: 0;
    box-shadow: none;
    min-height: 50px;
}

#top-priorities .task-card:last-child {
    border-bottom: none;
}

/* Specific styling for Time Box Schedule cards */
.time-slot .task-card {
    background-color: #dcfce3;
    /* Soft Green */
    border: 1px solid var(--text-color);
    padding: 0.5rem;
    font-size: 0.875rem;
}

/* Brain Dump cards */
#brain-dump-list .task-card {
    background-color: #ffffff;
    /* Explicitly white default */
}

/* Hide checkboxes in Brain Dump */
#brain-dump-list .task-checkbox-wrapper {
    display: none;
}