/* ════════════════════════════════════════════════════════════════
   POPUP — Notizen + Todos im Klick-Popup auf Balken
   Themed-aware für Glass / White / Dark
   ════════════════════════════════════════════════════════════════ */

.gantt-popup-tabs-wrap {
    margin-top: 10px;
}

.gantt-popup-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.18);
}

.gantt-popup-tab {
    padding: 7px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.2px;
}
.gantt-popup-tab:hover {
    color: rgba(255,255,255,0.95);
}
.gantt-popup-tab.active {
    color: #ffffff;
    border-bottom-color: var(--accent-blue, #007AFF);
}
.gantt-popup-tab-count {
    opacity: 0.75;
    font-weight: 500;
    margin-left: 2px;
}

.gantt-popup-tab-panel[hidden] { display: none; }

.gantt-popup-section-header {
    font-size: 11px;
    font-weight: 700;
    color: rgba(255,255,255,0.75);
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}
.gantt-popup-section-count {
    opacity: 0.7;
    font-weight: 500;
}

/* Notizen-Inhalt im Popup */
.gantt-popup-notes-text {
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255,255,255,0.95);
    white-space: pre-wrap;
    word-break: break-word;
    padding: 9px 11px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.10);
    border-radius: 10px;
}

/* Todo-Liste im Popup */
.gantt-popup-todos {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
    /* relative: dient als Container für absolut positioniertes li beim Drag */
    position: relative;
}
.gantt-popup-todo {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 5px 0;
    font-size: 13px;
    line-height: 1.45;
    color: rgba(255,255,255,0.95);
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

/* ── Drag-and-Drop: Reorder der Unteraufgaben per Long-Press ──── */
/* Titel ist Drag-Handle: Maus = grab-Cursor, Touch = sichtbarer Hinweis */
.gantt-popup-todo .gantt-popup-todo-text {
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
.gantt-popup-todo.is-dragging .gantt-popup-todo-text { cursor: grabbing; }

/* Gezogenes Item: aus dem Flow gelöst, leicht hervorgehoben */
.gantt-popup-todo.is-dragging {
    background: rgba(255,255,255,0.08);
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    border-radius: 8px;
    padding: 5px 8px;
    transform: scale(1.02);
    z-index: 50;
}

/* Platzhalter: leere Stelle die das Item gerade „belegt" */
.gantt-popup-todo-placeholder {
    list-style: none;
    margin: 0;
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px dashed rgba(255,255,255,0.18);
    box-sizing: border-box;
}

/* Während Drag: globaler grabbing-Cursor, Text-Selektion aus */
body.gantt-popup-todo-dragging {
    cursor: grabbing !important;
    user-select: none !important;
    -webkit-user-select: none !important;
}

/* White-Mode angepasst */
[data-theme="white"] .gantt-popup-todo.is-dragging {
    background: rgba(26,26,46,0.06);
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}
[data-theme="white"] .gantt-popup-todo-placeholder {
    background: rgba(26,26,46,0.04);
    border-color: rgba(26,26,46,0.18);
}
.gantt-popup-todo.is-done {
    opacity: 0.5;
    text-decoration: line-through;
}
.gantt-popup-todo-check {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    border-radius: 5px;
    border: 1.5px solid rgba(255,255,255,0.45);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    margin-top: 1px;
    font-weight: 700;
}
.gantt-popup-todo.is-done .gantt-popup-todo-check {
    background: var(--accent-green, #34C759);
    border-color: var(--accent-green, #34C759);
}
.gantt-popup-todo-text {
    flex: 1;
    word-break: break-word;
}

/* Click-Label um die echte Checkbox — Touch-Target ≥ 24px */
.gantt-popup-todo-checklabel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    width: 22px; height: 22px;
    position: relative;
    margin-top: -1px;
}
.gantt-popup-todo-checklabel input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 100%; height: 100%;
    cursor: pointer;
    margin: 0;
}
/* Visuelle Box wird vom .gantt-popup-todo-check getragen */
.gantt-popup-todo-checklabel input:checked ~ .gantt-popup-todo-check {
    background: #34C759;
    border-color: #34C759;
}
.gantt-popup-todo-checklabel input:checked ~ .gantt-popup-todo-check::after {
    content: '';
    width: 9px; height: 9px;
    background: no-repeat center/contain url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='white' d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
}

/* Löschen-Button rechts an jedem Todo */
.gantt-popup-todo-del {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    margin-top: -2px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.gantt-popup-todo-del:hover {
    color: #ff6b6b;
    background: rgba(255,107,107,0.12);
}

/* ── Notizen: editierbares Textarea ───────────────────────── */
.gantt-popup-notes-input {
    width: 100%;
    min-height: 70px;
    padding: 9px 11px;
    font-size: 13px;
    line-height: 1.45;
    font-family: inherit;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 10px;
    color: rgba(255,255,255,0.95);
    resize: vertical;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
}
.gantt-popup-notes-input:focus {
    border-color: rgba(196,181,253,0.6);
    background: rgba(255,255,255,0.14);
}
.gantt-popup-notes-input::placeholder {
    color: rgba(255,255,255,0.4);
}

/* ── Todo hinzufügen Input + Button ────────────────────────── */
.gantt-popup-todo-add {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.10);
}
.gantt-popup-todo-add input {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    font-size: 12.5px;
    font-family: inherit;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 8px;
    color: rgba(255,255,255,0.95);
    outline: none;
    transition: border-color 0.15s, background 0.15s;
}
.gantt-popup-todo-add input:focus {
    border-color: rgba(196,181,253,0.6);
    background: rgba(255,255,255,0.14);
}
.gantt-popup-todo-add input::placeholder { color: rgba(255,255,255,0.45); }
.gantt-popup-todo-add button {
    flex-shrink: 0;
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #6b5cff, #5346d6);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: opacity 0.15s, transform 0.12s;
}
.gantt-popup-todo-add button:hover { opacity: 0.92; transform: translateY(-1px); }

/* ── WHITE MODE — dunkler Text auf hellem Popup ──────────────── */
[data-theme="white"] .gantt-popup-tabs {
    border-bottom-color: rgba(0,0,0,0.12);
}
[data-theme="white"] .gantt-popup-tab {
    color: rgba(26,26,46,0.55);
}
[data-theme="white"] .gantt-popup-tab:hover {
    color: rgba(26,26,46,0.9);
}
[data-theme="white"] .gantt-popup-tab.active {
    color: #1A1A2E;
}
[data-theme="white"] .gantt-popup-section-header {
    color: rgba(26,26,46,0.65);
}
[data-theme="white"] .gantt-popup-notes-text {
    color: rgba(26,26,46,0.92);
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.08);
}
[data-theme="white"] .gantt-popup-todo {
    color: rgba(26,26,46,0.92);
}
[data-theme="white"] .gantt-popup-todo-check {
    border-color: rgba(26,26,46,0.35);
}

/* ── DARK MODE — kleine Tweaks ───────────────────────────────── */
[data-theme="dark"] .gantt-popup-tabs {
    border-bottom-color: rgba(255,255,255,0.08);
}
[data-theme="dark"] .gantt-popup-tab {
    color: rgba(232,234,240,0.55);
}
[data-theme="dark"] .gantt-popup-tab.active {
    color: #ffffff;
}
[data-theme="dark"] .gantt-popup-notes-text {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.08);
    color: rgba(232,234,240,0.95);
}
[data-theme="dark"] .gantt-popup-todo {
    color: rgba(232,234,240,0.95);
}

/* White-Mode: editierbare Notizen + Todo-Add Input */
[data-theme="white"] .gantt-popup-notes-input {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.10);
    color: rgba(26,26,46,0.92);
}
[data-theme="white"] .gantt-popup-notes-input:focus {
    background: #fff;
    border-color: rgba(107,92,255,0.4);
}
[data-theme="white"] .gantt-popup-notes-input::placeholder {
    color: rgba(26,26,46,0.4);
}
[data-theme="white"] .gantt-popup-todo-add {
    border-top-color: rgba(0,0,0,0.08);
}
[data-theme="white"] .gantt-popup-todo-add input {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.10);
    color: rgba(26,26,46,0.92);
}
[data-theme="white"] .gantt-popup-todo-add input::placeholder {
    color: rgba(26,26,46,0.4);
}
[data-theme="white"] .gantt-popup-todo-del {
    color: rgba(26,26,46,0.4);
}
[data-theme="white"] .gantt-popup-todo-del:hover {
    color: #FF3B30;
    background: rgba(255,59,48,0.08);
}

/* ════════════════════════════════════════════════════════════════
   MODAL-HÖHE — Fix für viele Todos (Editor + Edit-Modal)
   ────────────────────────────────────────────────────────────────
   Ziel: alles passt ohne sichtbaren Scrollbalken rein. Wenn der
   Inhalt doch mal überläuft (sehr viele Todos), wird gescrollt —
   aber ohne sichtbare Scrollleiste und mit Atemraum unten, damit
   die letzte Reihe (z.B. Color-Swatch-Highlight) nicht abgeschnitten
   wirkt.
   ════════════════════════════════════════════════════════════════ */

/* Editor-Modal (neue Aufgabe) */
.editor-modal-box {
    max-height: 96vh;
    max-height: 96dvh;
    display: flex;
    flex-direction: column;
}
.editor-card {
    max-height: 96vh;
    max-height: 96dvh;
    display: flex !important;
    flex-direction: column;
    overflow: hidden;
}
.editor-fields {
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    /* Atemraum: rechts knapp, unten extra damit selected color-swatch-Glow
       (0 0 0 4px) nicht am unteren Container-Rand abgeschnitten wird. */
    padding: 4px 4px 12px;
    /* Scrollbar komplett verstecken — Firefox + Webkit */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.editor-fields::-webkit-scrollbar { width: 0; height: 0; display: none; }
.editor-save-btn {
    flex-shrink: 0;
}

/* Color-Swatch Container: Innen-Padding sorgt dafür dass die Ring-
   Highlight (selected) nicht clipped wird */
.color-swatches { padding: 4px 0 2px; }

/* Edit-Modal (Aufgabe bearbeiten) — gleiches Pattern */
.gantt-modal {
    max-height: 96vh;
    max-height: 96dvh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 0 !important;
    /* Scrollbar verstecken auf allen Browsern */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.gantt-modal::-webkit-scrollbar { width: 0; height: 0; display: none; }
.gantt-modal > h3 {
    position: sticky;
    top: 0;
    background: var(--theme-modal-bg, rgba(255,255,255,0.97));
    z-index: 2;
    margin: 0 -25px 20px !important;
    padding: 0 25px 12px !important;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}
.gantt-modal .modal-footer {
    position: sticky;
    bottom: 0;
    background: var(--theme-modal-bg, rgba(255,255,255,0.97));
    margin: 16px -25px 0 !important;
    padding: 12px 25px !important;
    border-top: 1px solid rgba(0,0,0,0.08);
    z-index: 2;
}
[data-theme="dark"] .gantt-modal > h3,
[data-theme="dark"] .gantt-modal .modal-footer {
    border-color: rgba(255,255,255,0.08);
}

/* Editor kompakter: weniger Padding zwischen Feldern → alles passt rein */
.editor-card { padding: 22px 24px 18px !important; }
.editor-header { margin-bottom: 18px !important; }
.editor-fields { gap: 12px !important; margin-bottom: 14px !important; }
.editor-field-group { gap: 5px !important; }

/* Tablet/Phone: noch kompakter + volle Höhe nutzen */
@media (max-width: 768px) {
    .editor-modal-box,
    .editor-card,
    .gantt-modal {
        max-height: 94vh;
        max-height: 94dvh;
    }
    .editor-card { padding: 18px 18px 14px !important; }
    .editor-fields { gap: 10px !important; }
    .color-swatch { width: 28px; height: 28px; }
}
@media (max-height: 700px) {
    .editor-card { padding: 16px 18px 12px !important; }
    .editor-fields { gap: 8px !important; margin-bottom: 10px !important; }
    .editor-header { margin-bottom: 12px !important; }
}

/* ════════════════════════════════════════════════════════════════
   MOBILE DETAIL-SHEET — Notizen + Todos
   ────────────────────────────────────────────────────────────────
   Detail-Sheet hat IMMER weißen Hintergrund (außer Dark-Mode),
   deshalb: Default = dunkler Text. Im Dark-Mode wird umgekehrt.
   ════════════════════════════════════════════════════════════════ */

.gmv-detail-tabs-wrap {
    margin: 4px 20px 0;
}
.gmv-detail-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.10);
}
.gmv-detail-tab {
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: rgba(26,26,46,0.55);
    cursor: pointer;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
    letter-spacing: 0.2px;
}
.gmv-detail-tab.active {
    color: #1A1A2E;
    border-bottom-color: var(--accent-blue, #007AFF);
}
.gmv-detail-tab-count {
    opacity: 0.65;
    font-weight: 500;
    margin-left: 2px;
}
.gmv-detail-tab-panel[hidden] { display: none; }

.gmv-detail-section-header {
    font-size: 11px;
    font-weight: 700;
    color: rgba(26,26,46,0.6);
    margin: 8px 0 6px;
    letter-spacing: 0.5px;
}

.gmv-detail-todos {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.gmv-detail-todo {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.4;
    color: rgba(26,26,46,0.92);
}
.gmv-detail-todo.is-done {
    opacity: 0.5;
    text-decoration: line-through;
}
.gmv-detail-todo-check {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid rgba(26,26,46,0.35);
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    color: white;
    margin-top: 1px;
    font-weight: 700;
}
.gmv-detail-todo.is-done .gmv-detail-todo-check {
    background: var(--accent-green, #34C759);
    border-color: var(--accent-green, #34C759);
}
.gmv-detail-todo-text {
    flex: 1;
}

/* DARK MODE — Detail-Sheet ist dunkel, also helle Tabs */
[data-theme="dark"] .gmv-detail-tabs {
    border-bottom-color: rgba(255,255,255,0.10);
}
[data-theme="dark"] .gmv-detail-tab {
    color: rgba(232,234,240,0.55);
}
[data-theme="dark"] .gmv-detail-tab.active {
    color: #ffffff;
}
[data-theme="dark"] .gmv-detail-section-header {
    color: rgba(232,234,240,0.7);
}
[data-theme="dark"] .gmv-detail-todo {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.10);
    color: rgba(232,234,240,0.95);
}
[data-theme="dark"] .gmv-detail-todo-check {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.40);
}

/* ════════════════════════════════════════════════════════════════
   MOBILE DETAIL-SHEET — Scrollbar bei vielen Todos
   ────────────────────────────────────────────────────────────────
   NUR mobile Detail-Sheet (.gmv-detail-sheet).
   Strategie: Sheet selbst scrollt, Action-Buttons (Bearbeiten,
   Erledigt, Duplizieren, Löschen) sind per position:sticky am
   Boden und bleiben so immer sichtbar.

   !important nötig weil das Original gantt_mobile_view.css
   `overflow: hidden` setzt mit gleicher Spezifität und je nach
   Ladeordnung gewinnt.
   ════════════════════════════════════════════════════════════════ */

.gmv-detail-sheet {
    /* Sheet sitzt unten (bottom: 90px + safe-area), oben min. 12px Abstand */
    max-height: calc(100vh - 90px - env(safe-area-inset-bottom, 0px) - 24px) !important;
    /* WICHTIG: overflow muss auto sein — Original hat hidden! */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain;
    /* Flex-Layout aufheben falls von alten Patches noch gesetzt */
    display: block;
}

/* Action-Buttons kleben unten — bleiben beim Scrollen immer sichtbar */
.gmv-detail-sheet > .gmv-detail-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    /* Hintergrund opak, sonst scheint Inhalt durch */
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
[data-theme="dark"] .gmv-detail-sheet > .gmv-detail-actions {
    background: rgba(28,35,51,0.98);
}