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

/* Το κάτω padding της κάρτας το αναλαμβάνει το sticky footer, ώστε το
   «Αποθήκευση» να κάθεται στην ίδια θέση είτε έχεις κάνει scroll είτε όχι. */
.modal-card.am-card { padding-bottom: 0; }

.am-grip { display: none; }

.am-head { gap: 8px; }
.am-head h3 { min-width: 0; }
.am-card .quick-client { margin-top: 0; }
.am-card .quick-client .field:last-child { margin-bottom: 0; }

/* ---------- Πότε: ημερομηνία + διάρκεια + ώρα σε ένα κουτί ---------- */
.am-section {
  padding: 12px 12px 2px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.am-section-title {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 10px;
  font-size: 13.5px; font-weight: 700; color: var(--text-2);
}
.am-section-title .icon { color: var(--accent); }
/* Τα chips μέσα στο κουτί πρέπει να ξεχωρίζουν από το φόντο του */
.am-section .dur-chips button { background: var(--surface-3); }
/* Μέσα στο κουτί οι αποστάσεις είναι ήδη «δεμένες» — χωρίς διπλά κενά */
.am-section .slots-field { margin-bottom: 0; }
.am-section .am-hint { margin: 8px 2px 10px; }
.am-section #am-endinfo { margin-top: 0; }

.am-time-tools {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-left: auto;
}
.am-time-tools .btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

/* ---------- Κατάσταση: chips με το χρώμα του badge ---------- */
.status-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px; font-weight: 650;
  transition: border-color .12s, background .12s, color .12s, transform .12s;
}
.status-chip .icon { width: 15px; height: 15px; }
.status-chip:hover { border-color: var(--border-2); background: var(--surface-2); color: var(--text); }
.status-chip:active { transform: scale(.96); }
.status-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.status-chip.on[data-s="scheduled"] {
  background: var(--accent-soft); color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.status-chip.on[data-s="completed"] {
  background: var(--ok-soft); color: var(--ok-strong);
  border-color: color-mix(in srgb, var(--ok) 50%, transparent);
}
.status-chip.on[data-s="pending"],
.status-chip.on[data-s="no_show"] {
  background: var(--warn-soft); color: var(--warn-strong);
  border-color: color-mix(in srgb, var(--warn) 55%, transparent);
}
.status-chip.on[data-s="cancelled"] {
  background: var(--surface-3); color: var(--text); border-color: var(--border-2);
  text-decoration: line-through;
}

/* ---------- Τιμή: μια γραμμή, όχι ολόκληρο πεδίο ---------- */
.am-price-row { grid-template-columns: auto 1fr; align-items: center; gap: 12px; }
.am-price-row > label { margin: 0; }
.am-price-row > input { max-width: 150px; }

/* ---------- Ξανά σε: +1/+2/+3/+4 εβδ ή άλλη ημέρα ---------- */
.am-rebook { gap: 8px; }
.am-rebook-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.am-rebook-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px; font-weight: 650;
  font-variant-numeric: tabular-nums;
  transition: border-color .12s, background .12s, color .12s, transform .12s;
}
.am-rebook-chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.am-rebook-chip:active { transform: scale(.96); }
.am-rebook-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
/* Το date input κάθεται αόρατο πάνω από το chip, ώστε το πάτημα να ανοίγει
   κατευθείαν το ημερολόγιο του browser — χωρίς δεύτερο βήμα. */
.am-rebook-other { position: relative; display: inline-flex; }
.am-rebook-other > input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; border: 0; padding: 0; margin: 0;
}
.am-rebook-other:hover > .am-rebook-chip { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.am-rebook-other:focus-within > .am-rebook-chip { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* ---------- Διπλός πελάτης (ίδιο τηλέφωνο) ---------- */
.am-dup {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px;
  margin: -4px 0 4px;
  padding: 9px 12px;
  border-radius: 11px;
  background: var(--warn-soft); color: var(--warn-strong);
  font-size: 13px; line-height: 1.4;
}
.am-dup > .icon { flex: none; }
.am-dup-txt { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.am-dup-txt strong { color: inherit; }
.am-dup-or { font-size: 12.5px; opacity: .85; }
.am-dup .btn-sm { height: 30px; }

/* ---------- Επανάληψη (νέο ραντεβού): «κάθε 2 εβδ.» × «πόσες φορές» ---------- */
.am-repeat { gap: 8px; }
.am-repeat .field-head { align-items: baseline; }
/* Ζωντανή προεπισκόπηση «6 ραντεβού, το τελευταίο Τρί 20/10» — για να ξέρει
   μέχρι πότε φτάνει η σειρά ΠΡΙΝ πατήσει Αποθήκευση. */
.am-repeat-hint { font-size: 12.5px; font-weight: 600; color: var(--accent-strong); text-align: right; }
.am-repeat-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.am-repeat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.am-repeat-chip {
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px; font-weight: 650;
  transition: border-color .12s, background .12s, color .12s, transform .12s;
}
.am-repeat-chip:hover { border-color: var(--border-2); background: var(--surface-2); }
.am-repeat-chip:active { transform: scale(.96); }
.am-repeat-chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-ring); }
.am-repeat-chip.on {
  background: var(--accent-soft); color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.am-repeat-count {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  font-size: 13px; font-weight: 650; color: var(--text-2);
}
.am-repeat-count .select { width: auto; min-width: 74px; height: 34px; padding: 0 30px 0 10px; font-size: 14px; }

/* ---------- Σειρά (επεξεργασία): σήμα «3 από 8» + ακύρωση των επόμενων ---------- */
.am-series-badge { margin-left: 8px; margin-right: auto; font-variant-numeric: tabular-nums; }
.am-series {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  margin: -4px 0 14px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  font-size: 13px; color: var(--text-2);
}
.am-series-txt { flex: 1 1 180px; min-width: 0; font-weight: 600; }
.am-series .btn-sm { height: 30px; white-space: nowrap; }

/* ---------- Απουσίες: κόκκινο σήμα στα αποτελέσματα, προειδοποίηση κάτω από τον πελάτη ---------- */
.noshow-pill {
  display: inline-flex; align-items: center;
  margin-left: 6px; padding: 1px 7px;
  border-radius: 999px;
  background: var(--danger-soft); color: var(--danger-strong);
  font-size: 11.5px; font-weight: 700; line-height: 1.5;
  white-space: nowrap; vertical-align: middle;
}
.am-noshow-warn {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--danger-soft); color: var(--danger-strong);
  font-size: 12.5px; font-weight: 600; line-height: 1.4;
}
.am-noshow-warn > .icon { flex: none; margin-top: 1px; }

/* ---------- Footer: πάντα ορατό ---------- */
.am-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);
}

/* ---------- Κινητό: sheet με λαβή και safe-area ---------- */
@media (max-width: 640px) {
  .am-grip {
    display: block;
    width: 40px; height: 4px;
    margin: -8px auto 12px;
    border-radius: 2px;
    background: var(--border-2);
  }
  .am-head { flex-wrap: wrap; }
  /* Το σήμα «online» πέφτει σε δική του γραμμή αντί να στριμώχνει τον τίτλο */
  .am-head .online-badge { order: 3; flex-basis: 100%; width: fit-content; margin: 2px 0 0; }
  .am-head .am-series-badge { order: 4; margin: 2px 0 0; }
  .am-head #am-close { margin-left: auto; }
  .am-actions {
    margin: 8px -18px 0;
    padding: 10px 18px calc(12px + env(safe-area-inset-bottom));
  }
  .am-actions .btn { padding-left: 12px; padding-right: 12px; }
  .am-actions #am-save { flex: 1; }
  /* Τρία κουμπιά σε 375px: η «Διαγραφή» μένει μόνο εικονίδιο (έχει aria-label) */
  .am-actions #am-delete { width: 40px; padding: 0; }
  .am-actions .am-del-txt { display: none; }
  .am-section { padding: 10px 10px 2px; }
  /* Στο κινητό η κάρτα κάνει ήδη scroll — δεύτερο, εσωτερικό scroll στις υπηρεσίες μπερδεύει */
  .am-card .type-chips { max-height: none; overflow: visible; }
  /* «Επόμενο διαθέσιμο» δίπλα στην ετικέτα, ο διακόπτης από κάτω σε δική του γραμμή */
  .am-time-tools { display: contents; }
  .am-time-tools .btn-sm { margin-left: auto; }
  .am-time-tools .seg { flex-basis: 100%; }
  .am-dup .btn-sm { order: 5; height: 38px; }
  .am-dup-or { order: 6; }
  /* Στόχοι αφής ≥40px για τα chips κατάστασης, «Ξανά» και «Επανάληψη» */
  .status-chip, .am-rebook-chip, .am-repeat-chip { padding: 10px 14px; }
  .am-repeat-count .select { height: 40px; }
  .am-repeat-hint { flex-basis: 100%; text-align: left; }
  .am-series .btn-sm { height: 38px; flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .status-chip, .am-rebook-chip, .am-repeat-chip { transition: none; }
}

/* ---------- Ενημέρωση πελάτη: email + SMS σε μία ομάδα ---------- */
/* Οι δύο διακόπτες κάθονται μαζί κάτω από έναν τίτλο, ώστε να φαίνεται
   ότι είναι το ίδιο πράγμα σε δύο κανάλια — όχι δύο άσχετες ρυθμίσεις. */
.am-notify {
  margin-top: 8px;
  padding: 10px 12px 4px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
}
.am-notify-title {
  display: flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 700; color: var(--text-2);
}
.am-notify-title .icon { color: var(--accent); }
.am-notify .am-notify-row { margin-top: 0; padding: 10px 0 6px; border-top: 0; }
.am-notify .am-notify-row + .am-notify-row { border-top: 1px solid var(--border); }
.am-notify .am-email-ico { width: 30px; height: 30px; border-radius: 9px; }
.am-notify .am-sms-ico { background: var(--ok); }
/* Κλειδωμένος διακόπτης = δεν γίνεται τώρα· η εξήγηση είναι στο .sub */
.am-notify .am-notify-row:has(input:disabled) .nm { color: var(--text-2); }
.am-notify .am-notify-row:has(input:disabled) .am-email-ico { opacity: .45; }
