/* ==========================================================================
   UX 2.81: ΣΕΛΙΔΑ ΙΔΡΥΜΑΤΟΣ (#/institution)
   Χτισμένη πάνω στο σύστημα u- του app.css και στα tokens του :root. Εδώ
   μόνο ό,τι είναι δικό της: η μπάρα χρήσης, τα τρία νούμερα, ο διακόπτης,
   οι γραμμές μελών με επιλογή, το παράθυρο προσθήκης.
   ========================================================================== */

.inst { width: 100%; padding-bottom: 32px; }

/* Κεφαλίδα: το κτίριο και το όνομα του ιδρύματος, μία γραμμή από κάτω. */
.inst-head { display: flex; align-items: center; gap: 14px; }
.inst-head-text { min-width: 0; }
.inst-head h1 { overflow-wrap: anywhere; }

/* ---- Χρήση: ένα μεγάλο ποσοστό και μία μπάρα, τίποτα άλλο ---------------- */
.inst-hero {
  position: relative; overflow: hidden; padding: 22px 24px 18px; margin: 0 0 14px;
  background:
    radial-gradient(120% 160% at 100% 0%, var(--blue-tint) 0%, rgba(237, 243, 250, 0) 58%),
    var(--card);
}
/* Μια λεπτή γραμμή του σήματος στην κορυφή: η μόνη «διακόσμηση» της σελίδας. */
.inst-hero::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--brand-grad); }
.inst-hero-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.inst-hero-label { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }
.inst-hero-pct {
  display: flex; align-items: baseline; margin-top: 6px;
  font-family: var(--font-display); font-weight: 600; line-height: 1; letter-spacing: -0.02em; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.inst-hero-pct span { font-size: clamp(46px, 5.6vw, 62px); }
.inst-hero-pct small { font-size: 26px; color: var(--ink-soft); margin-left: 1px; }
.inst-hero-left { font-size: 14px; color: var(--ink-soft); padding-bottom: 8px; white-space: nowrap; }
.inst-hero-left b { color: var(--ink); font-weight: 650; }

.inst-bar {
  position: relative; height: 10px; margin: 16px 0 14px; border-radius: 999px;
  background: var(--paper-deep); overflow: hidden;
}
/* Η απόχρωση απλώνεται σε ΟΛΟ το μήκος και αποκαλύπτεται όσο γεμίζει: στο
   τέλος η μπάρα «ζεσταίνει» προς το χρυσό, χωρίς κόκκινο συναγερμό. */
.inst-bar span {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--blue) 0%, #4E8FD6 55%, var(--gold) 100%);
  clip-path: inset(0 calc(100% - var(--fill, 0%)) 0 0 round 999px);
  transition: clip-path 0.9s var(--ease);
}

.inst-hero-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--ink-soft); }
.inst-status { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--ink); }
.inst-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); }
.inst-dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.inst-sep { color: var(--ink-faint); }
.inst-hero-note {
  margin-top: 14px; padding: 10px 14px; border-radius: 12px;
  background: var(--gold-tint); color: var(--ink); font-size: 13.5px; line-height: 1.45;
}
.inst-hero.is-paused .inst-hero-note { background: var(--paper-deep); }

/* ---- Τρία ήρεμα νούμερα --------------------------------------------------- */
.u-tiles.inst-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.u-tile.inst-stat { cursor: default; padding: 16px 18px; }
.u-tile.inst-stat:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--line); }
.inst-stat .u-main { display: flex; flex-direction: column; }
.inst-num {
  font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.05;
  letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
}
.u-tile.inst-stat .u-meta { font-size: 13px; color: var(--ink-soft); margin-top: 3px; }

/* ---- Πολιτικές: τίτλος, μία πρόταση, διακόπτης ---------------------------- */
.u-row.inst-policy { min-height: 76px; padding: 14px 12px 14px 16px; }
.inst-policy .u-title { white-space: normal; }
.inst-policy .u-meta {
  white-space: normal; overflow: visible; text-overflow: clip;
  font-size: 13.5px; line-height: 1.45; color: var(--ink-soft); max-width: 64ch; margin-top: 2px;
}

/* Διακόπτης: 46x26 στο μάτι, 52x44 στο δάχτυλο. */
.inst-switch {
  flex: none; position: relative; width: 52px; height: 44px; padding: 0;
  border: none; background: transparent; border-radius: 999px; cursor: pointer;
}
.inst-switch::before {
  content: ''; position: absolute; left: 3px; right: 3px; top: 9px; height: 26px;
  border-radius: 999px; background: var(--line); transition: background 0.2s;
}
.inst-switch .inst-knob {
  position: absolute; top: 12px; left: 6px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(34, 48, 62, 0.25); transition: transform 0.22s var(--ease);
}
.inst-switch.on::before { background: var(--blue); }
.inst-switch.on .inst-knob { transform: translateX(20px); }
.inst-switch:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* ---- Μέλη ----------------------------------------------------------------- */
.u-section-title.inst-members-title { align-items: center; }
.inst-members-title h2 { font: inherit; margin: 0; }
.inst-members-title .btn { min-height: 40px; font-family: var(--font-ui); }

.inst-toolbar { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.inst-check-all {
  flex: none; width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--card); cursor: pointer;
}
.inst-check-all input, .inst-cb { width: 18px; height: 18px; accent-color: var(--blue); cursor: pointer; margin: 0; }
.input.inst-search { flex: 1; min-width: 0; min-height: 44px; }

.inst-selbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap;
  margin: 0 0 10px; padding: 7px 8px 7px 16px; border-radius: 14px;
  background: var(--blue-tint); color: var(--blue-deep); font-weight: 650; font-size: 14px;
  animation: fadeIn 0.15s ease;
}
.inst-selbar-actions { display: flex; gap: 8px; }
.inst-selbar .btn { min-height: 40px; }

.u-row.inst-member { cursor: pointer; }
.u-row.inst-member.is-sel, .u-row.inst-member.is-sel:hover { background: var(--blue-tint); }
.inst-cb { flex: none; margin: 0 2px; }
.inst-avatar {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.02em;
  background: var(--blue-tint); color: var(--blue-deep);
}
.inst-avatar.teacher { background: var(--terra-tint); color: var(--terra); }
.inst-avatar.pending { background: transparent; color: var(--ink-faint); border: 1.5px dashed var(--line); }
.inst-member.is-pending .u-title { color: var(--ink-soft); font-weight: 550; }
.inst-pill {
  flex: none; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 650;
  background: var(--gold-tint); color: #A77712;
}
.inst-m-phone { display: none; }
.inst-nomatch { padding: 18px 16px; color: var(--ink-soft); font-size: 14px; }
.inst-more { display: flex; justify-content: center; margin-top: 12px; }
.inst-more .btn { min-height: 40px; }
.u-card.inst-empty { padding: 36px 20px; }
.u-empty.inst-empty-page { margin-top: 8vh; }

/* ---- Παράθυρο προσθήκης -------------------------------------------------- */
.modal.inst-modal { max-width: 540px; }
.inst-modal textarea.input { min-height: 140px; font-size: 14.5px; line-height: 1.5; }
.inst-modal-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 22px; }
.inst-modal-row .btn { min-height: 40px; }
.inst-found { font-size: 13px; font-weight: 600; color: var(--green); }
.inst-found.err { color: var(--red); }

/* ---- Φόρτωση: το σχήμα της σελίδας -------------------------------------- */
.inst-skel {
  border-radius: var(--radius-lg);
  background: linear-gradient(90deg, var(--paper-deep) 0%, var(--line-soft) 50%, var(--paper-deep) 100%);
  background-size: 200% 100%; animation: instShimmer 1.3s ease-in-out infinite;
}
.inst-skel-head { height: 48px; width: min(440px, 72%); border-radius: 14px; margin-bottom: 22px; }
.inst-skel-hero { height: 168px; margin-bottom: 14px; }
.inst-skel-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 30px; }
.inst-skel-row .inst-skel { height: 78px; }
.inst-skel-list { height: 220px; }
@keyframes instShimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---- Κινητό --------------------------------------------------------------- */
@media (max-width: 640px) {
  .inst-head { gap: 12px; }
  .inst-hero { padding: 18px 16px 16px; }
  .inst-hero-pct span { font-size: 46px; }
  .inst-hero-pct small { font-size: 22px; }
  .inst-hero-left { font-size: 13.5px; }

  .u-tiles.inst-stats { gap: 8px; }
  .u-tile.inst-stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 12px; }
  .inst-stat .u-ico { width: 32px; height: 32px; border-radius: 10px; }
  .inst-stat .u-ico svg { width: 17px; height: 17px; }
  .inst-num { font-size: 24px; }
  .u-tile.inst-stat .u-meta { font-size: 12px; line-height: 1.3; }

  .u-row.inst-policy { padding: 12px 8px 12px 14px; gap: 12px; }
  .inst-policy .u-ico { width: 36px; height: 36px; border-radius: 11px; }
  .inst-policy .u-meta { font-size: 13px; }

  .u-row.inst-member { padding: 10px 12px; gap: 10px; }
  .inst-member .u-time { display: none; }
  .inst-m-desk { display: none; }
  .inst-m-phone { display: block; }
  .inst-avatar { width: 32px; height: 32px; font-size: 12px; }

  .inst-skel-row { gap: 8px; }
  .modal.inst-modal { padding: 22px 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .inst-bar span, .inst-switch .inst-knob, .inst-switch::before { transition: none; }
  .inst-skel { animation: none; }
}
