/* ============================================================
   ithageneia.gr — Video Hub (κεντρικό CSS)
   Σερβίρεται αυτόματα από το plugin local_ithassets (v1.5+) —
   ΔΕΝ χρειάζεται πια Raw SCSS ή Additional HTML.
   Namespace: .ithv-*  (δεν αγγίζει τίποτε άλλο στο Moodle)
   ============================================================ */

.ithv-hub {
  --ithv-blue: #1b4f8c;
  --ithv-blue-d: #17324f;
  --ithv-blue-l: #2e6fb7;
  --ithv-bg: #eef4fb;
  --ithv-line: #d7e2ef;
  --ithv-ink: #2c3e50;
  --ithv-mut: #7a90a5;
  --ithv-ok: #1f9d57;
  --ithv-radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ithv-ink);
  max-width: 1080px;
  margin: 0 auto;
  line-height: 1.5;
  box-sizing: border-box;
}
.ithv-hub *, .ithv-hub *::before, .ithv-hub *::after { box-sizing: border-box; }
.ithv-hub img { max-width: 100%; height: auto; display: block; }

/* ---------- Player ---------- */
.ithv-stage {
  background: var(--ithv-blue-d);
  border-radius: var(--ithv-radius);
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 6px 22px rgba(23, 50, 79, .18);
}
.ithv-frame {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #0d1c2c;
}
.ithv-frame > iframe,
.ithv-frame > .ithv-facade,
.ithv-frame > .ithv-welcome {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
}

/* thumbnail facade (δεν φορτώνει YouTube πριν το κλικ) */
.ithv-facade { cursor: pointer; background-size: cover; background-position: center; }
.ithv-facade::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(13,28,44,.15), rgba(13,28,44,.65));
}
.ithv-play {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 74px; height: 74px; border-radius: 50%;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
  z-index: 2; transition: transform .15s ease;
}
.ithv-play::before {
  content: ""; position: absolute; left: 29px; top: 24px;
  border-style: solid; border-width: 13px 0 13px 21px;
  border-color: transparent transparent transparent var(--ithv-blue);
}
.ithv-facade:hover .ithv-play { transform: translate(-50%, -50%) scale(1.08); }

/* welcome / άδεια κατάσταση */
.ithv-welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: #fff; padding: 18px;
  background: linear-gradient(140deg, var(--ithv-blue) 0%, var(--ithv-blue-d) 100%);
}
.ithv-welcome .ithv-wt { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.ithv-welcome .ithv-ws { font-size: 14px; opacity: .85; max-width: 460px; }

/* μπάρα κάτω από τον player */
.ithv-nowbar { padding: 12px 16px 14px; color: #fff; }
.ithv-nowlbl { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; }
.ithv-nowtit { font-size: 17px; font-weight: 700; margin: 2px 0 8px; }
.ithv-nowsub { font-size: 13px; opacity: .8; margin-bottom: 12px; }
.ithv-ctl { display: flex; flex-wrap: wrap; gap: 8px; }
.ithv-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 15px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer;
  user-select: none; transition: background .15s ease;
}
.ithv-btn:hover { background: rgba(255, 255, 255, .26); }
.ithv-btn[data-off="1"] { opacity: .3; pointer-events: none; }
.ithv-btn.ithv-done-btn[data-on="1"] { background: var(--ithv-ok); }

/* ---------- Πρόοδος + αναζήτηση ---------- */
.ithv-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  margin-bottom: 14px;
}
.ithv-prog { flex: 1 1 220px; min-width: 200px; }
.ithv-progtxt { font-size: 13px; color: var(--ithv-mut); margin-bottom: 5px; }
.ithv-progtxt b { color: var(--ithv-blue); }
.ithv-progbar { height: 8px; border-radius: 999px; background: var(--ithv-line); overflow: hidden; }
.ithv-progfill { height: 100%; width: 0; background: var(--ithv-ok); transition: width .3s ease; }
.ithv-search {
  flex: 0 1 260px; min-width: 180px;
  padding: 10px 14px; font-size: 15px; font-family: inherit;
  border: 1px solid var(--ithv-line); border-radius: 999px;
  background: #fff; color: var(--ithv-ink); outline: none;
}
.ithv-search:focus { border-color: var(--ithv-blue-l); box-shadow: 0 0 0 3px rgba(46, 111, 183, .15); }

/* ---------- Ενότητες ---------- */
.ithv-sec {
  background: #fff; border: 1px solid var(--ithv-line);
  border-radius: var(--ithv-radius); margin-bottom: 12px; overflow: hidden;
}
.ithv-sech {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer; background: var(--ithv-bg);
  user-select: none;
}
.ithv-secn {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 9px;
  background: var(--ithv-blue); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.ithv-sect { flex: 1 1 auto; font-size: 16px; font-weight: 700; color: var(--ithv-blue-d); }
.ithv-secm { flex: 0 0 auto; font-size: 12px; color: var(--ithv-mut); }
.ithv-caret {
  flex: 0 0 auto; width: 9px; height: 9px; margin-left: 2px;
  border-right: 2px solid var(--ithv-mut); border-bottom: 2px solid var(--ithv-mut);
  transform: rotate(45deg); transition: transform .2s ease;
}
.ithv-sec[data-open="0"] .ithv-caret { transform: rotate(-45deg); }
.ithv-sec[data-open="0"] .ithv-list { display: none; }
.ithv-list { padding: 6px; }

/* ---------- Μαθήματα ---------- */
.ithv-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 10px; cursor: pointer;
  transition: background .12s ease;
}
.ithv-item:hover { background: var(--ithv-bg); }
.ithv-item[data-active="1"] { background: #e2edfa; box-shadow: inset 3px 0 0 var(--ithv-blue); }
.ithv-item[data-hide="1"] { display: none; }
.ithv-item[data-soon="1"] { cursor: default; opacity: .62; }
.ithv-item[data-soon="1"]:hover { background: transparent; }

.ithv-check {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid var(--ithv-line); background: #fff; position: relative;
}
.ithv-item[data-done="1"] .ithv-check { background: var(--ithv-ok); border-color: var(--ithv-ok); }
.ithv-item[data-done="1"] .ithv-check::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.ithv-body { flex: 1 1 auto; min-width: 0; }
.ithv-t { font-size: 15px; font-weight: 600; color: var(--ithv-ink); }
.ithv-item[data-done="1"] .ithv-t { color: var(--ithv-mut); }
.ithv-s {
  font-size: 12.5px; color: var(--ithv-mut); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ithv-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.ithv-dur { font-size: 12px; color: var(--ithv-mut); font-variant-numeric: tabular-nums; }
.ithv-soon {
  font-size: 11px; font-weight: 700; color: #b07d12; background: #fbf3df;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.ithv-empty { padding: 22px; text-align: center; color: var(--ithv-mut); font-size: 14px; }
.ithv-empty[data-hide="1"] { display: none; }

/* ---------- Desktop: player αριστερά (sticky) + λίστα δεξιά ---------- */
@media (min-width: 900px) {
  .ithv-hub {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(340px, 1fr);
    grid-auto-rows: min-content;
    gap: 0 18px;
    align-items: start;
  }
  .ithv-stage {
    grid-column: 1;
    grid-row: 1 / span 200;
    position: sticky;
    top: 14px;
    align-self: start;
    margin-bottom: 0;
  }
  .ithv-top, .ithv-sec, .ithv-empty { grid-column: 2; }
  .ithv-search { flex: 1 1 100%; }
  .ithv-top { margin-bottom: 12px; }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .ithv-hub { --ithv-radius: 12px; }
  .ithv-play { width: 60px; height: 60px; }
  .ithv-play::before { left: 24px; top: 19px; border-width: 11px 0 11px 17px; }
  .ithv-nowtit { font-size: 16px; }
  .ithv-nowsub { display: none; }
  .ithv-btn { flex: 1 1 auto; justify-content: center; padding: 11px 10px; }
  .ithv-search { flex: 1 1 100%; }
  .ithv-s { display: none; }
  .ithv-sect { font-size: 15px; }
  .ithv-secm { display: none; }
  .ithv-item { padding: 12px 10px; gap: 10px; }
}

/* Το Moodle Book/Page μερικές φορές βάζει margins — τα εξουδετερώνουμε */
.ithv-hub p:empty { display: none; }

/* ---------- Mini hub: μέσα σε tile μαθήματος (2-4 βίντεο) ---------- */
.ithv-hub[data-mini="1"] .ithv-search { display: none; }
.ithv-hub[data-mini="1"] .ithv-sech { display: none; }
.ithv-hub[data-mini="1"] .ithv-sec { border: 0; background: transparent; margin-bottom: 0; }
.ithv-hub[data-mini="1"] .ithv-list { padding: 0; }
.ithv-hub[data-mini="1"] .ithv-item { border: 1px solid var(--ithv-line); background: #fff; margin-bottom: 8px; }
.ithv-hub[data-mini="1"] .ithv-item:hover { background: var(--ithv-bg); }
.ithv-hub[data-mini="1"] .ithv-prog { flex: 1 1 100%; }
@media (min-width: 900px) {
  .ithv-hub[data-mini="1"] { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
}
