/* MVP: styling gebeurt via Tailwind CDN in templates/base.html.twig.
   Dit bestand is de plek voor eigen CSS zodra je overstapt op een
   lokale Tailwind-build (zie PLAN.md). */

/* ---- Sleepbare, inline bewerkbare takenlijst (task_list_controller) ---- */
.task-grid {
    display: grid;
    /* --task-cols en --task-min worden door task_list_controller gezet (versleepbare kolombreedtes) */
    grid-template-columns: var(--task-cols, 1.25rem minmax(18rem, 1fr) 7.5rem 8rem 8.5rem 10rem 8.25rem 8.25rem 6.5rem 1.75rem);
    align-items: center;
    column-gap: 0.25rem;
    min-width: var(--task-min, 1080px);
}
/* Lijst breder/smaller slepen (desktop): gecentreerd, mag breder dan de pagina-container */
@media (min-width: 768px) {
    .task-list-root {
        position: relative;
        width: var(--list-width, auto);
        max-width: calc(100vw - 2rem);
        margin-inline: var(--list-margin, 0);
    }
}
.list-resize { position: absolute; top: 0; bottom: 0; right: -10px; width: 8px; cursor: ew-resize; border-radius: 4px; z-index: 20; touch-action: none; }
.list-resize:hover, .list-resize.is-active { background: #c7d2fe; }
.col-head { position: relative; }
.col-resize { position: absolute; top: -6px; bottom: -6px; right: -4px; width: 7px; cursor: col-resize; z-index: 5; touch-action: none; }
.col-resize:hover, .col-resize.is-active { background: #a5b4fc; }
body.is-resizing { cursor: ew-resize; user-select: none; }
.task-cell {
    width: 100%;
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 0.375rem;
    background: transparent;
    padding: 0.25rem 0.4rem;
    font-size: 0.8125rem;
}
.task-cell:hover { border-color: #e2e8f0; }
.task-cell:focus { outline: none; border-color: #6366f1; background: #fff; }
select.task-cell[data-colored] { color: #fff; font-weight: 500; text-align: center; text-align-last: center; }
select.task-cell[data-colored] option { color: #0f172a; background: #fff; }
.task-title-cell { padding-left: calc(var(--depth, 0) * 1.5rem); }
.task-row.is-saved { animation: task-saved 0.9s ease-out; }
.task-row.is-error { background: #fef2f2; }
@keyframes task-saved { from { background: #dcfce7; } to { background: transparent; } }
.task-ghost { opacity: 0.35; background: #eef2ff; }
.task-children { min-height: 0; }
/* Tijdens slepen: lege sublijsten tonen als drop-zone, zodat je een taak onder een andere kunt hangen */
.is-dragging .task-children:empty {
    min-height: 0.5rem;
    margin-left: calc((var(--depth, 0) + 1) * 1.5rem + 1.75rem);
    border-radius: 0.25rem;
    outline: 1px dashed #c7d2fe;
}
.task-node.is-collapsed > .task-children { display: none; }
/* Zoeken: gevonden subtaken ook tonen als hun ouder is ingeklapt */
.is-searching .task-node.is-collapsed > .task-children { display: block; }
.search-hidden { display: none !important; }
.search-match > .task-row { background-color: #fefce8; }
/* Wel/niet in de tijdlijn (= heeft start- of einddatum) */
.planned-badge { flex-shrink: 0; border-radius: 9999px; padding: 0.05rem 0.45rem; font-size: 10px; font-weight: 500; white-space: nowrap; background: #dbeafe; color: #1d4ed8; }
.is-unplanned .planned-badge { background: transparent; color: #94a3b8; outline: 1px dashed #cbd5e1; outline-offset: -1px; }
.is-unplanned .task-cell[type="date"] { border: 1px dashed #cbd5e1; color: #94a3b8; }
.drag-handle { cursor: grab; user-select: none; }
.drag-handle:active { cursor: grabbing; }

/* ---- Tijdlijn (gantt_controller) ---- */
/* Balkkleur komt per taak uit de controller (groep/fase/status); voortgang = donkerdere overlay. */
.gantt .bar-progress { fill: rgba(0, 0, 0, 0.28) !important; }
/* Dag/week waarop iets gepland staat: blauw blokje met de datum erin, geen bolletje/pijltje. */
.gantt-container .lower-text.has-tasks.has-tasks { background: #2563eb; color: #fff; border-radius: 5px; font-weight: 600; }
.gantt-container .lower-text { cursor: pointer; }
.gantt-container .lower-text.is-selected { outline: 2px solid #1e3a8a; outline-offset: 1px; }
.gantt-container .current-ball-highlight { display: none; }
.gantt .day-part { fill: #1e3a8a; pointer-events: none; }
.gantt .bar-label:not(.big) { fill: #fff; font-weight: 500; }
/* De datumheader is sticky binnen de gantt-container; die moet dan zelf scrollen in plaats van de pagina. */
.gantt-container { max-height: calc(100vh - 6rem); max-height: calc(100dvh - 6rem); }

/* ---- Tijdlijn als kalender (calendar_controller), zoals de iPhone-agenda ---- */
.cal { max-width: 40rem; margin-inline: auto; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; }
.cal-title { font-size: 1.75rem; font-weight: 700; line-height: 1.1; text-transform: capitalize; }
.cal-title span { color: #4f46e5; }
.cal-nav { display: flex; align-items: center; gap: 0.25rem; }
.cal-nav button { min-width: 2.25rem; height: 2.25rem; border-radius: 9999px; font-size: 1.4rem; line-height: 1; color: #4f46e5; }
.cal-nav button:hover { background: #eef2ff; }
.cal-nav .cal-today-btn { padding-inline: 0.75rem; font-size: 0.875rem; font-weight: 500; }
.cal-grid { touch-action: pan-y; }
.cal-grid, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-week { grid-column: 1 / -1; border-radius: 0.75rem; }
.cal-week.is-selected-week { background: #f1f5f9; }
.cal-weekday { padding-bottom: 0.4rem; text-align: center; font-size: 11px; font-weight: 500; text-transform: uppercase; color: #64748b; }
.cal-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 0.3rem 0 0.4rem; }
.cal-num { display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 9999px; font-size: 1.15rem; }
.cal-day:hover .cal-num { background: #e2e8f0; }
.cal-day.is-other-month .cal-num { color: #cbd5e1; }
.cal-day.is-today .cal-num { color: #4f46e5; font-weight: 600; }
.cal-day.is-selected .cal-num { background: #0f172a; color: #fff; font-weight: 600; }
.cal-day.is-today.is-selected .cal-num { background: #4f46e5; }
.cal-dots { display: flex; gap: 2px; height: 6px; }
.cal-dots i { width: 6px; height: 6px; border-radius: 9999px; }
.cal-handle { display: block; width: 100%; padding: 0.6rem 0; }
.cal-handle span { display: block; width: 2.5rem; height: 5px; margin-inline: auto; border-radius: 9999px; background: #cbd5e1; }
.cal-handle:hover span { background: #94a3b8; }
.cal-agenda-day { border-top: 1px solid #e2e8f0; padding: 0.75rem 0 0.25rem; }
.cal-agenda-day h3 { margin-bottom: 0.5rem; font-size: 0.95rem; color: #64748b; }
.cal-agenda-day h3 strong { color: #0f172a; text-transform: uppercase; }
.cal-agenda-day h3.is-today, .cal-agenda-day h3.is-today strong { color: #4f46e5; }
.cal-item { display: flex; gap: 0.75rem; border-radius: 0.5rem; padding: 0.4rem 0.25rem; }
.cal-item:hover { background: #f8fafc; }
.cal-item > i { flex-shrink: 0; width: 0.85rem; height: 0.85rem; margin-top: 0.2rem; border-radius: 9999px; }
.cal-item > span { display: flex; flex-direction: column; }
.cal-when { font-size: 0.8rem; color: #64748b; }
.cal-item-title { font-size: 1rem; color: #0f172a; }
.cal-meta { font-size: 0.8rem; color: #94a3b8; }
.cal-item.is-done .cal-item-title { color: #94a3b8; text-decoration: line-through; }
.cal-item.is-done > i { opacity: 0.4; }
.cal-empty { padding: 0.25rem 0 0.75rem; font-size: 0.875rem; color: #94a3b8; }

/* ---- Mobiel ---- */
/* Standaard (desktop): de veldwrappers en mobiele knoppen zijn onzichtbaar. */
.task-field { display: contents; }
.task-more, .touch-only, .task-remove-label { display: none; }
.task-add-root { min-width: var(--task-min, 1080px); }
.drag-handle { touch-action: none; }

/* Touch: acties die anders pas bij hover verschijnen altijd tonen */
@media (hover: none) {
    .task-row [class*="opacity-0"] { opacity: 1; }
    .touch-only { display: block; }
}

@media (max-width: 767px) {
    /* iOS zoomt in op velden kleiner dan 16px */
    input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea { font-size: 16px; }
    .gantt-container .side-header select { width: auto; }
    .task-row [class*="opacity-0"] { opacity: 1; }

    /* Groepen: geen omkaderde tabel maar een kop (in groepskleur) met kaarten eronder, zoals in de Monday-app */
    [data-group-section] { background: transparent; border: 0 !important; }
    [data-group-section] > details > summary { padding-left: 0.25rem; padding-right: 6rem; }
    [data-group-section] > details > div { overflow: visible; }
    .task-grid-head { display: none; }
    .task-add-root { min-width: 0; padding: 0.5rem 0 0; }
    .task-add-root input {
        max-width: none; padding: 0.75rem; text-align: center;
        border: 1px dashed #cbd5e1; border-radius: 0.75rem; background: transparent;
    }
    [data-group-section] ul[data-list][data-parent-id=""] { padding-left: 0; padding-right: 0; }

    /* Nieuw-taak-invoerveld (task_list_controller.openNewInput) */
    li[data-new-input] { grid-template-columns: 0 minmax(0, 1fr); min-width: 0; margin-top: 0.5rem; }
    li[data-new-input] .task-title-cell { padding-left: 0; }

    /* Een taak = een kaart: titel bovenaan, daaronder status/fase als pills.
       De ⋯-knop klapt de overige velden open. Subtaken staan ingesprongen eronder. */
    .task-grid.task-row {
        display: flex; flex-wrap: wrap; align-items: center;
        column-gap: 0.5rem; row-gap: 0; min-width: 0;
    }
    .task-node > .task-row {
        margin-top: 0.5rem; padding: 0.625rem 0.75rem 0.75rem 0.5rem;
        background: #fff; border: 1px solid #e2e8f0; border-left: 4px solid var(--group-color, #c4c4c4);
        border-radius: 0.75rem; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    }
    .task-node > .task-children { margin-left: 1rem; padding: 0; }
    .is-dragging .task-children:empty { margin-left: 1rem; }
    .task-row::before { content: ""; order: 1; flex: 0 0 100%; }   /* regeleinde na de titelrij */

    .task-row > :nth-child(1) { order: 0; flex: 0 0 1.5rem; padding: 0.5rem 0; text-align: center; }
    .task-row > :nth-child(2) { order: 0; flex: 1 1 0; min-width: 0; }
    .task-row > .task-more { order: 0; flex: 0 0 2.5rem; display: block; }
    .task-row.is-open > .task-more { background: #eef2ff; color: #4f46e5; }

    .task-cell { min-height: 2.25rem; }
    .task-title-cell { padding-left: 0; }
    .task-title-cell .task-cell { border-color: transparent; font-weight: 600; padding-left: 0.25rem; }
    .task-title-cell > button, .task-title-cell > a { display: inline-flex; align-items: center; justify-content: center; min-height: 2.25rem; min-width: 1.75rem; }
    .task-title-cell > [data-toggle] { min-width: 1.5rem; }
    .task-title-cell > [data-toggle].invisible { display: none; }
    .task-sub-label { display: none; }
    /* "+ sub" en ↗ pas na openklappen: houdt de kaart rustig */
    .task-row:not(.is-open) .task-title-cell > [data-action="task-list#addSub"],
    .task-row:not(.is-open) .task-title-cell > a[title^="Details"] { display: none; }

    /* Velden als pills onder de titel; lege pills en de rest pas na openklappen */
    .task-row > .task-field { display: block; order: 2; flex: 0 0 auto; max-width: 100%; min-width: 0; margin-top: 0.5rem; }
    .task-row > .task-field[data-empty]:not(.task-more) { display: none; }
    .task-row:not(.is-open) > :nth-child(n + 6):not(.task-more) { display: none; }
    .task-row > .task-field select.task-cell {
        width: auto; max-width: 100%; min-height: 0; padding: 0.3rem 0.75rem;
        border-radius: 0.375rem; border-color: transparent;
        -webkit-appearance: none; appearance: none;
    }
    .task-row > .task-field::before { display: none; }

    .task-row.is-open > .task-field, .task-row.is-open > .task-field[data-empty] { flex: 1 1 calc(50% - 0.25rem); display: block; }
    .task-row.is-open > .task-field select.task-cell { width: 100%; padding: 0.4rem 0.75rem; }
    .task-row.is-open > .task-field::before {
        content: attr(data-label); display: block; margin-bottom: 0.125rem;
        font-size: 10px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: #94a3b8;
    }
    .task-row.is-open .task-cell:not(select) { border-color: #e2e8f0; }
    .task-row.is-open .task-cell[type="date"] { padding-left: 0.35rem; padding-right: 0.15rem; }
    .task-row .task-popover { left: auto; right: 0; }

    .task-row > :nth-child(10) { order: 3; flex: 1 1 100%; margin-top: 0.25rem; padding: 0.5rem 0 0; text-align: right; color: #ef4444; }
    .task-remove-label { display: inline; }
}
