/* ========== Week planner ========== */
.week-section {
    padding-top: 5rem;
    padding-bottom: 3rem;
}

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

.week-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.week-start-toggle {
    display: inline-flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 3px;
    gap: 2px;
}

.week-start-btn {
    padding: 0.25rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 16px;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.week-start-btn:hover {
    color: var(--text-primary);
}

.week-start-btn.active {
    background: var(--accent);
    color: #0b0f14;
    box-shadow: 0 1px 4px rgba(76, 141, 202, 0.4);
}

/* ── Spread: 4-column grid, 2 rows ── */
.week-spread {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2.5rem;
}

.week-spread .week-day-cell:nth-child(4n) { border-right: none; }
.week-spread .week-day-cell:nth-child(n+5) { border-bottom: none; }

/* ── Day cell ── */
.week-day-cell {
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    min-height: 240px;
    padding: 0;
    border-right: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

.week-day-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem 0.4rem;
    min-height: 2.25rem;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-dark);
}

.week-today-link {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    text-decoration: none;
    border-radius: 6px;
    transition: opacity 0.15s;
}

.week-today-link:hover {
    opacity: 0.75;
}

/* ── Day header labels ── */
.week-day-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.week-day-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.week-day-today {
    color: var(--accent) !important;
}

.week-today-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    margin-left: auto;
    flex-shrink: 0;
}

/* ── Tasks inside a day ── */
.week-day-tasks {
    flex: 1;
    padding: 0.4rem 0.5rem;
    overflow-y: auto;
    min-height: 2rem;
    max-height: 340px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.week-day-tasks::-webkit-scrollbar {
    width: 4px;
}

.week-day-tasks::-webkit-scrollbar-track {
    background: transparent;
}

.week-day-tasks::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.week-day-tasks:hover::-webkit-scrollbar-thumb {
    background: var(--text-muted);
}

.week-day-tasks .task-item,
.week-task-item {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    padding: 0.3rem 0.4rem;
    border-radius: 6px;
    color: var(--text-primary);
    cursor: default;
    transition: background 0.15s;
}

.week-task-item:hover {
    background: var(--accent-glow);
}

.week-task-item[data-task-id] {
    cursor: grab;
}

.week-task-item[data-task-id]:active {
    cursor: grabbing;
}

/* Task title: always wrap inside the spread (overrides tasks.css truncation) */
.week-day-tasks .task-title-group {
    overflow: visible !important;
}
.week-day-tasks .task-title {
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    line-height: 1.35;
}


.week-task-done .week-task-title {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* ── Week task checkbox — circular Material Icons ── */
.week-complete-icon {
    font-family: 'Material Icons';
    font-size: 18px;
    font-weight: normal;
    font-style: normal;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 0.2s;
    line-height: 1;
    user-select: none;
}

.week-complete-icon:hover {
    color: var(--accent);
}

.week-complete-icon.checkbox-icon-done {
    color: var(--green);
}

.week-task-done .week-complete-icon {
    color: var(--green);
}


/* ── Drop zone highlight ── */
.week-drop-zone {
    transition: background-color 0.15s, box-shadow 0.15s;
    min-height: 2rem;
}

.week-drop-zone.week-drag-over,
.week-project-drop-zone.week-drag-over {
    background: var(--accent-glow);
    box-shadow: inset 0 0 0 2px var(--accent);
    border-radius: 4px;
}


.week-task-item .week-day-unschedule-btn .material-icons,
.week-task-item .unschedule-btn .material-icons {
    font-size: 15px;
}

.week-task-item .week-day-archive-btn .material-icons,
.week-task-item .archive-btn .material-icons {
    font-size: 15px;
}

@media (hover: none) {
    .week-task-item .icon-btn {
        opacity: 1;
    }
}

/* ── This Week column ── */
.week-this-week-cell {
    border-left: 2px solid var(--amber) !important;
}

.week-this-week-header {
    background: rgba(212, 131, 86, 0.06) !important;
    align-items: center !important;
    gap: 0.4rem;
}

.week-this-week-icon {
    font-size: 14px !important;
    line-height: 1;
    color: var(--amber);
    flex-shrink: 0;
}

.week-this-week-label {
    line-height: 1;
    color: var(--amber) !important;
}

.week-this-week-drop-zone.week-drag-over {
    background: var(--amber-glow) !important;
    box-shadow: inset 0 0 0 2px var(--amber) !important;
    border-radius: 4px;
}

/* ── Unscheduled strip ── */
.week-unscheduled-item {
    cursor: grab;
}

.week-unscheduled-item:active {
    cursor: grabbing;
}

.week-unscheduled-bullet {
    font-size: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ── Responsive ── */

/* Tablet: 2 columns regardless of chosen layout */
@media (max-width: 900px) {
    .week-spread[data-cols],
    .week-spread {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    /* Reset all per-layout border rules and apply 2-col rules */
    .week-spread .week-day-cell {
        border-right: 1px solid var(--border-color);
        border-bottom: 1px solid var(--border-color);
    }
    .week-spread .week-day-cell:nth-child(2n) { border-right: none; }
    .week-spread .week-day-cell:nth-child(n+7) { border-bottom: none; }
}

/* Mobile: 1 column */
@media (max-width: 540px) {
    .week-spread[data-cols],
    .week-spread {
        grid-template-columns: 1fr;
    }
    .week-day-cell {
        min-height: auto;
        border-right: none !important;
    }
    .week-spread .week-day-cell { border-bottom: 1px solid var(--border-color); }
    .week-spread .week-day-cell:last-child { border-bottom: none; }
}
