/* =========================================================
   מפת התוכנית — זרימת ההודעות לאורך הקורס
   נשען על הטוקנים שמוגדרים ב-app.css
   ========================================================= */

/* ---------- כותרת המצב ---------- */

.plan-status {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 18px; margin-bottom: 14px;
}
.plan-status-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.plan-status-week { font-size: 15px; font-weight: 600; white-space: nowrap; }
.plan-status-pct { font-size: 13px; font-weight: 600; color: var(--primary); min-width: 38px; text-align: end; }
.plan-progress { flex: 1; height: 8px; background: var(--n-100); border-radius: 99px; overflow: hidden; }
.plan-progress-fill { height: 100%; background: var(--primary); border-radius: 99px; transition: width .3s; }

.plan-status-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 4px 22px;
}
.plan-status-row {
  display: flex; align-items: baseline; gap: 8px; font-size: 12.5px;
  padding: 3px 0; border-top: 1px solid var(--line);
}
.plan-status-row span { color: var(--ink-4); min-width: 96px; }
.plan-status-row b { color: var(--ink); font-weight: 600; }

.plan-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-inline-end: 4px; }
.plan-dot.sent { background: var(--ok); }
.plan-dot.due { background: var(--warn); }
.plan-dot.future { background: var(--n-200); }

/* ---------- ציר ההודעות ---------- */

.plan-gantt { padding: 6px 0; }
.plan-gantt-track {
  position: relative; height: 28px; background: var(--n-100);
  border-radius: var(--r-sm); overflow: hidden;
}
/* החלק שכבר עבר — רקע ירוק בהיר מאוד, כדי שההתקדמות תיקרא במבט */
.plan-gantt-past { position: absolute; inset-inline-start: auto; inset-inline-end: 0; top: 0; bottom: 0; background: var(--ok-soft); }

.plan-tick {
  position: absolute; top: 5px; width: 3px; height: 18px; border-radius: 2px;
  transform: translateX(50%); cursor: help;
}
.plan-tick.sent { background: var(--ok); }
.plan-tick.due { background: var(--warn); }
.plan-tick.future { background: var(--n-200); }
.plan-tick.skipped { background: var(--n-200); opacity: .45; }

.plan-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 2; }
.plan-now span {
  position: absolute; top: -2px; inset-inline-start: 5px; font-size: 9.5px; font-weight: 600;
  color: var(--danger); white-space: nowrap;
}
.plan-gantt-scale { display: flex; margin-top: 5px; font-size: 10.5px; color: var(--ink-4); }

/* ---------- שבועות ---------- */

.plan-flow { display: flex; flex-direction: column; gap: 10px; }

.plan-week { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.plan-week.current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }

.plan-week-head {
  display: flex; align-items: center; gap: 9px; padding: 10px 14px;
  cursor: pointer; user-select: none; font-size: 13px; background: var(--n-50, transparent);
  border-bottom: 1px solid var(--line);
}
.plan-week-head:hover { background: var(--n-100); }
.plan-week-caret { color: var(--ink-4); font-size: 10px; transition: transform .15s; }
.plan-week.closed .plan-week-caret { transform: rotate(-90deg); }
.plan-week.closed .plan-week-body { display: none; }
.plan-week.closed .plan-week-head { border-bottom: none; }
.plan-week.past .plan-week-head b { color: var(--ink-3); }

.plan-week-body { padding: 4px 0; }

/* ---------- בלוק מפגש ---------- */

.plan-block { padding: 10px 14px 4px; }
.plan-block + .plan-block { border-top: 1px solid var(--line); }
.plan-block.frame { background: var(--n-50, rgba(0, 0, 0, .015)); }

.plan-block-head { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 8px; }
.plan-block-dot {
  width: 9px; height: 9px; border-radius: 2px; background: var(--bc); flex: none; margin-top: 4px;
}
.plan-block.past .plan-block-dot { opacity: .45; }
.plan-block-title { font-size: 13.5px; font-weight: 600; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.plan-block-sub { font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.plan-block-when { font-size: 11.5px; color: var(--ink-4); margin-top: 1px; }
.plan-block-links { display: flex; gap: 5px; flex-wrap: wrap; }
.plan-block-links a { text-decoration: none; }

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

/* קו הזרימה שמחבר את ההודעות למפגש שמעליהן */
.plan-msgs {
  margin-inline-start: 4px; padding-inline-start: 14px;
  border-inline-start: 2px solid var(--line);
  display: flex; flex-direction: column; gap: 3px; padding-bottom: 8px;
}

.plan-msg {
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 6px 10px; cursor: pointer; transition: .12s; background: var(--n-100);
}
.plan-msg:hover { border-color: var(--border); }

/* שלושת המצבים — ירוק בהיר לנשלח, אפור בהיר לעתידי, ענבר לממתין */
.plan-msg.sent { background: var(--ok-soft); }
.plan-msg.due { background: var(--warn-soft); border-color: var(--warn); }
.plan-msg.future { background: var(--n-100); }
.plan-msg.skipped { background: transparent; opacity: .5; }
.plan-msg.template { background: var(--n-100); }
.plan-msg.empty { background: repeating-linear-gradient(-45deg, var(--n-100), var(--n-100) 6px, transparent 6px, transparent 12px); }

.plan-msg-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12px; }
.plan-msg-time {
  font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2);
  min-width: 92px; font-size: 11.5px;
}
.plan-msg-name { font-weight: 600; }
.plan-msg-target { font-size: 10.5px; color: var(--ink-4); }
.plan-msg-preview { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; padding-inline-start: 99px; }
.plan-msg-preview i { color: var(--ink-4); }
.plan-msg-none { font-size: 11.5px; color: var(--ink-4); padding: 4px 0; }

.plan-state { font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.plan-state.sent { color: var(--ok); }
.plan-state.due { color: var(--warn); }
.plan-state.future { color: var(--ink-4); }
.plan-state.skipped { color: var(--ink-4); }
.plan-state.empty { color: var(--warn); }

.plan-add {
  align-self: flex-start; border: 1px dashed var(--border); background: none;
  color: var(--ink-4); font-size: 11.5px; padding: 4px 11px; border-radius: var(--r-sm);
  cursor: pointer; margin-top: 3px;
}
.plan-add:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- העורך במקום ---------- */

.plan-msg.editing { cursor: default; background: var(--surface); border-color: var(--primary); box-shadow: var(--shadow-sm); }
.plan-msg.editing .plan-msg-preview { display: none; }

.plan-editor { margin-top: 9px; }
.plan-textarea {
  width: 100%; font-family: inherit; font-size: 13px; line-height: 1.65;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); resize: vertical; min-height: 120px;
}
.plan-textarea:focus { outline: none; border-color: var(--primary); }

.plan-fields { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 7px; }
.plan-chip {
  border: 1px solid var(--border); background: var(--n-100); color: var(--ink-3);
  font-size: 10.5px; padding: 2px 8px; border-radius: 99px; cursor: pointer; font-family: inherit;
}
.plan-chip:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }

.plan-editor-foot { display: flex; align-items: center; gap: 9px; margin-top: 9px; flex-wrap: wrap; }
.plan-override { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.plan-saved { font-size: 11px; color: var(--ok); font-weight: 600; min-width: 52px; }

/* ---------- שילוב בגאנט של מסך המחזור ---------- */

.gantt-msg-row { margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.gantt-msg-row .gantt-track { height: 22px; }
.gantt-past {
  position: absolute; inset-inline-end: 0; top: 0; bottom: 0;
  background: var(--ok-soft); border-radius: var(--r-sm);
}
.gantt-row.past .gantt-bar { opacity: .55; }

/* רצועת מצב ההודעות של מפגש, ליד התווית בגאנט */
.gantt-strip { display: inline-flex; gap: 2px; margin-inline-start: 6px; vertical-align: middle; }
.plan-mini { width: 5px; height: 5px; border-radius: 50%; display: inline-block; cursor: help; }
.plan-mini.sent { background: var(--ok); }
.plan-mini.due { background: var(--warn); }
.plan-mini.future { background: var(--n-200); }
.plan-mini.skipped { background: var(--n-200); opacity: .4; }

@media (max-width: 860px) {
  .plan-msg-time { min-width: 0; }
  .plan-msg-preview { padding-inline-start: 0; }
  .plan-status-head { flex-wrap: wrap; }
}

/* תצוגת המנטור — קריאה בלבד, בלי רמז שאפשר ללחוץ ולערוך */
.plan-readonly .plan-msg { cursor: default; }
.plan-readonly .plan-msg:hover { border-color: transparent; }
.plan-readonly .plan-add { display: none; }

/* ---------- עורך מקטעי הסיכום ---------- */

.sum-section {
  display: flex; align-items: center; gap: 6px; padding: 5px 0;
  border-bottom: 1px solid var(--line);
}
.sum-section:last-of-type { border-bottom: none; }
.sum-section-n {
  width: 20px; height: 20px; border-radius: 50%; background: var(--n-100);
  color: var(--ink-3); font-size: 10.5px; display: grid; place-items: center; flex: none;
}
.sum-section input { flex: 1; min-width: 0; padding: 5px 9px; font-size: 12.5px; }
.sum-section input[data-f="title"] { max-width: 190px; font-weight: 600; }

/* שבוע הפסקה — חג או שבוע בלי מפגשים.
   מוצג עמום ובלי גוף: הוא נמצא בציר כדי שהרצף יישמר ולא כדי
   שיתחרה על תשומת הלב. */
.plan-week-break { background: transparent; border-style: dashed; }
.plan-week-break .plan-week-head { cursor: default; }
.plan-week-break .plan-week-head:hover { background: transparent; }
.plan-week-break b { font-weight: 500; color: var(--ink-3); }
