/* ============================================================
   Appoint-O — calendar (φορτώνεται μετά το app.css, χρησιμοποιεί τα tokens του)
   ============================================================ */

/* ---------- Γραμμή εργαλείων ---------- */
/* Ο τίτλος είναι κουμπί (ανοίγει τον επιλογέα ημερομηνίας) αλλά μοιάζει με κείμενο. */
.cal-title {
  background: none; border: 0; margin: 0 -4px; padding: 2px 4px;
  text-align: left; color: inherit; cursor: pointer; border-radius: 8px;
  transition: color .15s;
}
.cal-title:hover { color: var(--accent-strong); }
.cal-title:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }

/* Υπενθύμιση συντομεύσεων — μόνο σε υπολογιστή. */
.cal-kbd { gap: 16px; }
.cal-kbd kbd {
  display: inline-block; min-width: 20px; margin-right: 2px; padding: 1px 5px;
  border-radius: 5px; border: 1px solid var(--border-2); background: var(--surface);
  box-shadow: 0 1px 0 var(--border-2);
  font-family: inherit; font-size: 11px; font-weight: 700; line-height: 1.4;
  color: var(--text-2); text-align: center;
}

@media (max-width: 1023px) {
  .cal-kbd { display: none; }
  /* Δύο σειρές: [‹] [τίτλος] [›] και από κάτω [προβολές] [Σήμερα] [μπλοκ] [εκτύπωση]. */
  .cal-toolbar {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) auto 40px 40px;
    grid-template-areas: "prev title title title next" "seg seg today block print";
    gap: 8px; align-items: center; margin-bottom: 12px;
  }
  /* Το «Μπλοκάρισμα» (φτιάχνεται από το calendar.js) μένει μόνο εικονίδιο, όπως η εκτύπωση. */
  #cal-block { grid-area: block; width: 40px; padding: 0; justify-content: center; }
  #cal-block .cal-block-txt { display: none; }
  .cal-nav, .cal-actions { display: contents; }
  #cal-prev { grid-area: prev; }
  #cal-next { grid-area: next; }
  .cal-title, .cal-datejump { grid-area: title; }
  .cal-title {
    height: 40px; min-width: 0; margin: 0; padding: 0 2px;
    font-size: 17px; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* Αόρατο πάνω από τον τίτλο: το πάτημα πέφτει κατευθείαν στο native input ημερομηνίας. */
  .cal-datejump { width: 100%; height: 40px; opacity: 0; z-index: 2; }
  #cal-view-seg { grid-area: seg; display: flex; }
  #cal-view-seg > button { flex: 1; min-width: 0; justify-content: center; padding: 7px 4px; font-size: 12.5px; }
  #cal-today { grid-area: today; padding: 0 10px; font-size: 13px; }
  #cal-print { grid-area: print; }
  #cal-new { display: none; }
  /* Στόχοι αφής ≥40px για τα πιο πολυπατημένα κουμπιά. */
  #cal-view-seg > button, .cal-res-switch > button, .cal-aday-add { min-height: 40px; }
}

/* ---------- Επιλογέας θέσης (κινητό, ημέρα με >1 θέση) ---------- */
/* Ζει μέσα στο .cal-scroll· με sticky μένει στη θέση του όταν οι στήλες («Όλες») κυλούν πλάγια. */
.cal-res-switch {
  display: flex; width: 100%; margin-bottom: 10px;
  position: sticky; left: 0; z-index: 3;
  overflow-x: auto; scrollbar-width: none;
}
.cal-res-switch::-webkit-scrollbar { display: none; }
.cal-res-switch > button { flex: 1 0 auto; min-width: 0; justify-content: center; gap: 6px; padding: 7px 10px; }
.cal-res-switch .cnt {
  min-width: 18px; padding: 0 6px; border-radius: 999px; text-align: center;
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}
.cal-res-switch > .on .cnt { color: var(--accent-strong); background: var(--accent-soft); }

/* ---------- Μπλοκ εβδομάδας (υπολογιστής): όνομα πρώτο, ώρα από κάτω ---------- */
.cal-week .cal-appt {
  flex-direction: column; justify-content: center; gap: 0;
  padding: 2px 4px 2px 7px; line-height: 1.2;
}
.cal-week .cal-appt .n { font-size: 11px; }
.cal-week .cal-appt .t { font-size: 9.5px; display: flex; align-items: center; }
.cal-week .cal-appt.short .t { display: none; }
.cal-week .cal-appt.short { padding-top: 0; padding-bottom: 0; }

/* ---------- Σύρσιμο ραντεβού ---------- */
.cal-appt.draggable { cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.cal-appt.drag-src { opacity: .35; }
.cal-appt.cal-ghost {
  pointer-events: none; z-index: 9; opacity: .96; transform: none;
  border-style: dashed; border-color: var(--ap);
  background: color-mix(in srgb, var(--ap) 30%, var(--surface));
  box-shadow: var(--shadow-pop);
}
body.cal-dragging, body.cal-dragging .cal-appt { cursor: grabbing; }
body.cal-dragging { -webkit-user-select: none; user-select: none; }
[data-drop].drop-over { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }

/* ---------- Ατζέντα εβδομάδας (κινητό) ---------- */
.cal-agenda { display: flex; flex-direction: column; gap: 12px; }
.cal-aday {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden;
}
.cal-aday.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-aday.closed { background: var(--surface-2); background-image: var(--cal-off); }
.cal-aday-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 11px 12px 11px 14px; text-align: left; font-size: 14px;
}
.cal-aday-head:active { background: var(--surface-2); }
.cal-aday-dow { font-weight: 800; }
.cal-aday.today .cal-aday-dow { color: var(--accent-strong); }
.cal-aday-date {
  flex: 1; min-width: 0; color: var(--text-2); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-aday-today {
  font-size: 11px; font-weight: 750; color: var(--accent-strong);
  background: var(--accent-soft); border-radius: 999px; padding: 2px 8px;
}
.cal-aday-head .badge { font-size: 11px; padding: 2px 8px; }
.cal-aday-head .chev { color: var(--muted); }
.cal-arows { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.cal-arow {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 14px 10px 12px; text-align: left;
  border-top: 1px solid var(--border); border-left: 4px solid var(--ap);
}
.cal-arow:first-child { border-top: 0; }
.cal-arow:active { background: var(--surface-2); }
.cal-arow-time {
  flex: none; min-width: 78px;
  font-size: 12px; font-weight: 750; font-variant-numeric: tabular-nums; color: var(--text-2);
}
.cal-arow-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-arow-name {
  display: flex; align-items: center; font-weight: 700; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-arow-name .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cal-arow-sub {
  display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-arow-sub .dot { width: 7px; height: 7px; background: var(--ap); }
.cal-arow-res { color: var(--muted); }
.cal-arow-st.done {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ok-soft); color: var(--ok-strong);
}
.cal-arow.done .cal-arow-name { color: var(--text-2); }
.cal-arow.noshow .cal-arow-name { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--text-2); }
.cal-arow .badge { flex: none; font-size: 11px; padding: 2px 8px; }
.cal-aday-note { padding: 12px 14px; color: var(--muted); font-size: 13px; font-weight: 600; border-top: 1px solid var(--border); }
.cal-aday-add { margin: 8px 14px 12px; }

/* ---------- Μήνας: να χωράει σε στενές οθόνες ---------- */
/* Το 1fr έχει ελάχιστο το περιεχόμενο· με minmax(0,1fr) οι στήλες μικραίνουν όσο χρειάζεται. */
.cal-month { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-mday { min-width: 0; overflow: hidden; }
.cal-mday-top { gap: 2px; min-width: 0; }
.cal-moff { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .cal-mday-num { font-size: 12.5px; }
  .cal-mcnt { font-size: 10px; padding: 0 5px; }
  .cal-mday.today .cal-mday-num { width: 22px; height: 22px; border-radius: 7px; }
}
@media (max-width: 420px) {
  .cal-month { gap: 3px; }
  .cal-mday { padding: 4px; border-radius: 8px; min-height: 56px; }
  .cal-mday-top { flex-direction: column; align-items: flex-start; gap: 1px; }
  .cal-mcnt { font-size: 9.5px; padding: 0 4px; }
}

/* ---------- Στενές στήλες (κινητό «Όλες»): η ώρα σε μία γραμμή ---------- */
.cal-appt.compact .t { flex: none; white-space: nowrap; }

/* ============================================================
   Μπλοκάρισμα ώρας (block.js / block_modal.html, ids bm-*)
   ============================================================ */
/* Κουμπί «Μπλοκάρισμα» στη γραμμή εργαλείων — το κείμενο έχει το δικό του κενό από το εικονίδιο. */
#cal-block .cal-block-txt { margin-left: 2px; }

/* ---------- Σήμα «επαναλαμβανόμενο» δίπλα στην ώρα / στο όνομα ---------- */
.series-mark {
  display: inline-block; margin-left: 4px; flex: none;
  font-size: 11px; font-weight: 700; line-height: 1; color: var(--muted);
}
.cal-arow-name .series-mark { font-size: 12px; }

/* ---------- Υπάρχον μπλοκ πάνω στο πλέγμα: πατιέται ---------- */
.cal-timeoff { gap: 4px; }
.cal-timeoff > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-timeoff .icon { width: 13px; height: 13px; flex: none; }
.cal-timeoff.cal-block { cursor: pointer; transition: box-shadow .15s, background-color .15s; }
.cal-timeoff.cal-block:hover, .cal-timeoff.cal-block:focus-visible {
  outline: none;
  background-color: var(--warn-soft);
  box-shadow: 0 0 0 1px var(--warn), var(--shadow-1);
}
/* Στην εβδομάδα οι λωρίδες είναι στενές: μικρότερα γράμματα, μόνο το κείμενο. */
.cal-week .cal-timeoff { left: 2px; right: 2px; padding: 2px 3px; font-size: 10px; border-radius: 7px; }
.cal-week .cal-timeoff .icon { display: none; }

/* ---------- «Κλειστά — άδεια»: πατιέται όταν φταίει άδεια ---------- */
button.cal-closed-note {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  width: 100%; cursor: pointer; border-radius: var(--r-lg);
  transition: background .15s, color .15s;
}
button.cal-closed-note:hover, button.cal-closed-note:focus-visible { outline: none; background: var(--warn-soft); color: var(--warn-strong); }
.cal-closed-off .icon { color: var(--warn-strong); }
.cal-closed-hint { font-size: 11.5px; font-weight: 600; color: var(--muted); }
button.cal-aday-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; width: 100%; text-align: left; cursor: pointer;
}
button.cal-aday-note .cal-closed-text { flex: 1 1 auto; min-width: 0; }
button.cal-aday-note .cal-closed-hint { margin-left: auto; white-space: nowrap; }   /* μακρύς λόγος → η υπόδειξη πάει από κάτω */
button.cal-aday-note:active { background: var(--surface-2); }
/* Σήμα «Κλειστά — άδεια» στην κεφαλίδα στήλης που έχει ραντεβού παρότι κλειστή:
   ίδιο μενού με τη σημείωση, χωρίς να ψηλώνει η κεφαλίδα (οι ώρες μένουν ευθυγραμμισμένες). */
button.cal-col-off {
  display: inline-flex; align-items: center; gap: 4px; min-width: 0; max-width: 55%;
  margin-left: 2px; padding: 2px 8px; border-radius: 999px; cursor: pointer;
  background: var(--warn-soft); color: var(--warn-strong); border: 1px solid transparent;
  font: inherit; font-size: 11.5px; font-weight: 700; line-height: 1.3;
  transition: border-color .15s, box-shadow .15s;
}
button.cal-col-off > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.cal-col-off .icon { flex: none; }
button.cal-col-off:hover, button.cal-col-off:focus-visible { outline: none; border-color: var(--warn); box-shadow: 0 0 0 2px var(--warn-soft); }

/* ---------- Γραμμή μπλοκ στην ατζέντα (κινητό) ---------- */
.cal-arow-block { border-left-color: var(--warn); background-image: var(--cal-off); }
.cal-arow-block .cal-arow-name { color: var(--warn-strong); }
.cal-arow-block .cal-arow-sub .icon { width: 12px; height: 12px; color: var(--warn-strong); }

/* ---------- Κλειδάκι πάνω στο κενό (μόνο με ποντίκι) ---------- */
.cal-gap-lock {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  display: none; place-items: center; z-index: 1;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border); box-shadow: var(--shadow-1);
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.cal-gap .cal-gap-lock .icon { width: 13px; height: 13px; }
.cal-gap:hover .cal-gap-lock, .cal-gap-lock:focus-visible { display: grid; }
.cal-gap-lock:hover, .cal-gap-lock:focus-visible {
  outline: none; color: var(--warn-strong); border-color: var(--warn); background: var(--warn-soft);
}
.cal-gap.tiny .cal-gap-lock { width: 20px; height: 20px; right: 3px; }
.cal-gap.tiny .cal-gap-lock .icon { width: 11px; height: 11px; }
@media (hover: none) { .cal-gap:hover .cal-gap-lock { display: none; } }

/* ---------- Μενού πάνω σε μπλοκ (reuse .menu) ---------- */
.cal-block-menu { position: fixed; min-width: 230px; max-width: min(340px, calc(100vw - 16px)); }
.cal-block-menu-head {
  display: flex; flex-direction: column; gap: 2px;
  padding: 6px 11px 9px; margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.cal-block-menu-head strong { font-size: 13.5px; }
.cal-block-menu-head span { font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.cal-block-menu-head .cal-block-menu-range { color: var(--warn-strong); font-weight: 600; margin-top: 2px; }
.cal-block-menu button .icon { width: 16px; height: 16px; flex: none; }

/* ---------- Το modal ---------- */
.modal-card.bm-card { padding-bottom: 0; }
.bm-grip { display: none; }
.bm-head { gap: 8px; }
.bm-head h3 { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bm-title-ico {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
  background: var(--warn-soft); color: var(--warn-strong);
}
.bm-when { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 0 12px; }
.bm-hint { margin: 0 2px 10px; }
.bm-conflict { margin-top: -2px; }
.bm-reason-field { gap: 8px; }
.bm-reason-chips { margin: 0; }
.bm-optional { font-weight: 400; }
/* Footer πάντα ορατό — όπως στο modal του ραντεβού. */
.bm-actions {
  position: sticky; bottom: 0; z-index: 3;
  margin: 8px -22px 0;
  padding: 12px 22px 18px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
@media (max-width: 640px) {
  .bm-grip { display: block; width: 40px; height: 4px; margin: -8px auto 12px; border-radius: 2px; background: var(--border-2); }
  .bm-when { grid-template-columns: 1fr 1fr; }
  .bm-when .bm-date-field { grid-column: 1 / -1; }
  .bm-actions { margin: 8px -18px 0; padding: 10px 18px calc(12px + env(safe-area-inset-bottom)); }
  .bm-actions #bm-save { flex: 1; }
  #bm-resource-seg { display: flex; }
  #bm-resource-seg > button { flex: 1; min-width: 0; justify-content: center; min-height: 40px; }
  /* Στόχοι αφής ≥36px για τα chips */
  #bm-dur-chips button, .bm-reason-chips button { padding: 8px 14px; }
}

/* ---------- «Καθυστέρηση» στην κεφαλίδα της θέσης ---------- */
.cal-col-head .cal-col-delay { margin-left: auto; width: 28px; height: 28px; color: var(--text-2); }
.cal-col-head .cal-col-delay + .cnt { margin-left: 4px; }
.cal-delay-menu { min-width: 230px; }
.cal-delay-head { padding: 6px 11px 4px; font-size: 12.5px; font-weight: 650; color: var(--text-2); }
