/* =========================================================
   גאנט התוכניות
   כל המיקומים על הציר נגזרים ממשתנה אחד: --day-w.
   שינוי זום = שינוי המשתנה, בלי בנייה מחדש של ה-DOM.
   ========================================================= */

.gt {
  --label-w: 208px;
  --row-h: 30px;
  --cohort-h: 42px;
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  overflow: hidden;
}

/* גובה קצוב וגלילה בשני הצירים בתוך המסגרת.
   בלי זה position:sticky של הכותרת ושל עמודת התוויות לא נתפס בכלל —
   כשציר אחד הוא visible והשני auto, הדפדפן הופך את שניהם ל-auto
   ואין קונטיינר גלילה שביחס אליו ההידבקות עובדת. */
.gt-scroll { overflow: auto; max-height: calc(100vh - 210px); min-height: 320px; }
.gt-inner { position: relative; min-width: 100%; }

/* ---------- סרגל הכלים ---------- */

.crm-bar.gt-bar { flex-wrap: wrap; row-gap: 8px; }
.gt-nav { display: flex; gap: 3px; }
.gt-layers { display: flex; gap: 11px; align-items: center; padding-inline: 6px; }
.gt-layer {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.gt-stats { font-size: 11.5px; }

/* ---------- כותרת הציר ---------- */

.gt-head {
  display: grid; grid-template-columns: var(--label-w) 1fr;
  position: sticky; top: 0; z-index: 30;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.gt-head-label {
  position: sticky; inset-inline-start: 0; z-index: 2;
  background: var(--surface); border-inline-end: 1px solid var(--border);
  padding: 8px 12px; font-size: 12px; color: var(--ink-2);
  display: flex; align-items: center;
}
.gt-head-scale { position: relative; height: 38px; }

.gt-tick {
  position: absolute; top: 0; bottom: 0;
  border-inline-start: 1px solid var(--border-soft);
  padding-inline-start: 4px; padding-top: 5px;
  font-size: 10px; color: var(--ink-4); white-space: nowrap; overflow: hidden;
}
.gt-tick b { display: block; font-size: 10.5px; font-weight: 600; color: var(--ink-3); }
.gt-tick span { font-size: 9px; }
.gt-tick.major { border-inline-start-color: var(--border); }
.gt-tick.major b { color: var(--ink-2); }
.gt-tick.shabbat { background: var(--n-50); }

/* ---------- גוף ---------- */

.gt-body { position: relative; }

/* ---------- רצועות מועדים ---------- */

.gt-bands {
  position: absolute; top: 0; bottom: 0;
  inset-inline-start: var(--label-w); inset-inline-end: 0;
  pointer-events: none; z-index: 0;
}
.gt-band {
  position: absolute; top: 0; bottom: 0;
  background: var(--n-100); pointer-events: auto;
}
/* מועד חוסם צובע חזק יותר — הוא זה שמזיז את הלוז */
.gt-band.blocking { background: var(--danger-soft); }

/* ---------- קו היום ---------- */

.gt-now {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--danger); z-index: 20; pointer-events: none;
}
.gt-now span {
  position: absolute; top: 2px; inset-inline-start: 4px;
  font-size: 9.5px; font-weight: 700; color: var(--danger);
  background: var(--surface); padding: 0 4px; border-radius: 3px; white-space: nowrap;
}

/* ---------- שורות ---------- */

.gt-row {
  display: grid; grid-template-columns: var(--label-w) 1fr;
  border-bottom: 1px solid var(--border-soft);
  position: relative; z-index: 1;
}
.gt-row:hover .gt-label { background: var(--n-50); }

.gt-label {
  position: sticky; inset-inline-start: 0; z-index: 10;
  background: var(--surface); border-inline-end: 1px solid var(--border);
  display: flex; align-items: center; gap: 7px;
  padding: 5px 12px; min-width: 0;
}
.gt-label .grow { flex: 1; min-width: 0; }
.gt-label-name {
  font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gt-label-sub { font-size: 10.5px; color: var(--ink-4); white-space: nowrap; }
.gt-label-lane { font-size: 11.5px; color: var(--ink-2); }
.gt-count {
  font-size: 10px; color: var(--ink-4); font-variant-numeric: tabular-nums;
  background: var(--n-100); border-radius: 9px; padding: 0 6px;
}
.gt-chip {
  font-size: 9.5px; background: var(--n-100); color: var(--ink-3);
  border-radius: 3px; padding: 0 4px; margin-inline-end: 3px;
}

.gt-track { position: relative; height: var(--row-h); }
.gt-row-cohort { min-height: var(--cohort-h); }
.gt-row-cohort .gt-track { height: var(--cohort-h); }
.gt-row-cohort .gt-label { cursor: pointer; }
.gt-row-cohort.past .gt-label-name { color: var(--ink-3); }
.gt-caret { color: var(--ink-4); font-size: 9px; width: 10px; flex: none; }

.gt-row-lane { background: var(--n-25); }
.gt-row-lane .gt-label { background: var(--n-25); padding-inline-start: 26px; }
.gt-row-lane:hover .gt-label { background: var(--n-50); }

/* ---------- פס המחזור ---------- */

.gt-cohort-bar {
  position: absolute; top: 9px; height: 24px;
  background: var(--t-100); border: 1px solid var(--t-300);
  border-radius: var(--r-sm); cursor: grab; overflow: hidden;
  display: flex; align-items: center; min-width: 8px;
  transform: translateX(var(--dx, 0px));
}
.gt-cohort-bar:active { cursor: grabbing; }
.gt-cohort-bar.active { border-color: var(--primary); }
.gt-cohort-bar.past { opacity: .55; }
.gt-cohort-fill {
  position: absolute; inset-inline-start: 0; top: 0; bottom: 0;
  background: var(--t-200);
}
.gt-cohort-text {
  position: relative; font-size: 10.5px; font-weight: 600; color: var(--t-900);
  padding-inline: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* סימנים דחוסים כשהמחזור סגור */
.gt-mini {
  position: absolute; top: 36px; width: 4px; height: 4px; border-radius: 50%;
  transform: translateX(50%); background: var(--primary);
}
.gt-mini.practice { background: var(--t-400); }
.gt-mini.mentor_practice { background: var(--accent); }
.gt-mini.past { opacity: .4; }

/* ---------- סימני מפגש ---------- */

/* --dx הוא היסט הגרירה. הוא חלק מה-transform ולא דורס אותו —
   אחרת הסימן היה מאבד את המרכוז שלו ברגע שמתחילים לגרור. */
.gt-mark {
  position: absolute; top: 50%; cursor: grab;
  transform: translate(calc(50% + var(--dx, 0px)), -50%);
}
.gt-mark:active { cursor: grabbing; }
/* שיעור לייב — מעוין. צורה ולא רק גוון, כדי שיהיה קריא גם בלי צבע. */
.gt-mark.diamond {
  width: 11px; height: 11px; background: var(--c);
  transform: translate(calc(50% + var(--dx, 0px)), -50%) rotate(45deg); border-radius: 2px;
}
.gt-mark.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.gt-mark.band {
  top: 50%; height: 8px; border-radius: 3px;
  background: repeating-linear-gradient(45deg, var(--n-150), var(--n-150) 3px, var(--n-100) 3px, var(--n-100) 6px);
  transform: translate(var(--dx, 0px), -50%); cursor: default;
}
.gt-mark.past { opacity: .45; }
.gt-mark.today { box-shadow: 0 0 0 3px var(--danger-soft), 0 0 0 4px var(--danger); }
.gt-mark:hover { filter: brightness(1.15); z-index: 15; }

/* מפגש שהוזז — קו מקווקו חזרה לתאריך המקורי */
.gt-mark.shifted::after {
  content: '⤴'; position: absolute; top: -13px; inset-inline-start: 50%;
  transform: translateX(50%); font-size: 10px; color: var(--warn); line-height: 1;
}
.gt-mark.diamond.shifted::after { transform: translateX(50%) rotate(-45deg); }
.gt-shift-line {
  position: absolute; top: 50%; inset-inline-start: 50%;
  border-top: 1px dashed var(--warn); height: 0; pointer-events: none;
}
.gt-mark.diamond .gt-shift-line { transform: rotate(-45deg); transform-origin: right center; }

/* ---------- הודעות ---------- */

.gt-msg {
  position: absolute; top: 50%; width: 3px; height: 13px; border-radius: 2px;
  transform: translate(50%, -50%); cursor: pointer;
}
.gt-msg.sent { background: var(--ok); }
.gt-msg.due { background: var(--warn); }
.gt-msg.future { background: var(--n-200); }
.gt-msg.skipped { background: var(--n-200); opacity: .4; }
.gt-msg:hover { width: 5px; }

/* ---------- שיבוץ בוגרים ---------- */

.gt-talent {
  position: absolute; top: 50%; width: 9px; height: 9px; border-radius: 50%;
  transform: translate(50%, -50%); cursor: pointer;
  background: var(--warn-soft); border: 1.5px solid var(--warn);
}
.gt-talent.booked, .gt-talent.done { background: var(--warn); }
.gt-talent.done { opacity: .5; }
.gt-talent.cancelled { border-color: var(--n-200); background: transparent; }

/* ---------- תלויות ---------- */

.gt-links {
  position: absolute; top: 0; bottom: 0;
  inset-inline-start: var(--label-w); inset-inline-end: 0;
  pointer-events: none; z-index: 5;
}
.gt-link {
  position: absolute; top: var(--cohort-h); height: 14px;
  border-top: 2px dashed var(--ok); border-inline-end: 2px dashed var(--ok);
  border-start-end-radius: 6px; pointer-events: auto;
}
.gt-link.conflict { border-color: var(--danger); }
.gt-link::after {
  content: '▾'; position: absolute; bottom: -9px; inset-inline-end: -5px;
  color: var(--ok); font-size: 10px;
}
.gt-link.conflict::after { color: var(--danger); }

/* ---------- גרירה ---------- */

body.gt-drag-active { cursor: grabbing; user-select: none; }
body.gt-drag-active * { cursor: grabbing !important; }
.gt-dragging { z-index: 40 !important; opacity: .85; }

.gt-ghost {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--primary); z-index: 35; pointer-events: none;
}
.gt-ghost span {
  position: absolute; top: 4px; inset-inline-start: 5px;
  background: var(--primary); color: var(--on-primary);
  font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 4px; white-space: nowrap;
}

/* ---------- דיאלוג האישור ---------- */

.gt-conf-head { text-align: center; padding-bottom: 12px; border-bottom: 1px solid var(--border-soft); margin-bottom: 12px; }
.gt-conf-name { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.gt-conf-dates { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 13px; }
.gt-conf-dates .from { color: var(--ink-4); text-decoration: line-through; }
.gt-conf-dates .to { color: var(--primary); font-weight: 600; }
.gt-conf-dates .arrow { color: var(--ink-4); }
.gt-conf-body { display: flex; flex-direction: column; gap: 2px; }
.gt-conf-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12.5px; padding: 4px 0; border-bottom: 1px solid var(--border-soft);
}
.gt-conf-row span { color: var(--ink-3); }
.gt-conf-row b { font-variant-numeric: tabular-nums; }

/* ---------- הדפסה ---------- */

@media print {
  .sidebar, .topbar, .crm-bar, #gt-bar { display: none !important; }
  .gt { border: none; }
  .gt-scroll { overflow: visible; }
  .gt-label { position: static; }
}
