/* aMareYoga — area riservata
   Palette: nero profondo, testo bianco, accento verde-mare. */

:root {
  --bg:        #000000;
  --surface:   #0d0f10;
  --surface-2: #15181a;
  --line:      #23282b;
  --line-soft: #1a1e20;
  --text:      #f2f4f3;
  --muted:     #9aa5a2;
  --faint:     #6b7573;
  --accent:    #7ec8b8;
  --accent-dk: #4f9a8a;
  --danger:    #e2725b;
  --ok:        #7fbf7f;
  --radius:    14px;
  --shadow:    0 10px 40px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #a8ded2; }

h1, h2, h3 { font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

p { margin: 0 0 1rem; }
small, .small { font-size: .82rem; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.center { text-align: center; }
.mt { margin-top: 1.5rem; }
.mb { margin-bottom: 1.5rem; }
.nowrap { white-space: nowrap; }

/* ------------------------------------------------------------ intestazione */

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .7rem 1.1rem;
  background: #000;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Il logo è un PNG con fondo nero pieno: "screen" rende trasparente il nero
   e lascia solo la scritta bianca, su qualsiasi superficie scura. */
.brand img { height: 34px; display: block; mix-blend-mode: screen; }

.topnav {
  display: flex;
  gap: .35rem;
  flex: 1 1 auto;
  flex-wrap: wrap;
}

.topnav a {
  color: var(--muted);
  padding: .35rem .7rem;
  border-radius: 999px;
  font-size: .9rem;
  white-space: nowrap;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a.active { color: #04120f; background: var(--accent); font-weight: 600; }

.topuser { display: flex; align-items: center; gap: .6rem; }
.topuser .who { color: var(--faint); font-size: .85rem; }

@media (max-width: 640px) {
  .topbar { gap: .6rem; padding: .6rem .8rem; }
  .topuser .who { display: none; }
  .topnav { order: 3; width: 100%; overflow-x: auto; }
}

/* -------------------------------------------------------------- struttura */

.wrap {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 1.8rem 1.1rem 3rem;
  flex: 1 0 auto;
}
.wrap-wide { max-width: 1280px; }

.foot {
  padding: 1.2rem;
  text-align: center;
  color: var(--faint);
  font-size: .8rem;
  border-top: 1px solid var(--line-soft);
}

.pagehead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.4rem;
}
.pagehead p { margin: 0; }

/* ---------------------------------------------------------------- login */

.login-page { display: flex; align-items: center; justify-content: center; }
.login-page .wrap { max-width: 420px; display: flex; align-items: center; }

.login-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 2.2rem 1.8rem;
  box-shadow: var(--shadow);
}
.login-card .logo {
  display: block;
  width: 250px;
  max-width: 88%;
  margin: 0 auto 2rem;
  mix-blend-mode: screen;
}

/* ----------------------------------------------------------------- form */

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }

input[type=text], input[type=email], input[type=password],
input[type=number], input[type=search], select, textarea {
  width: 100%;
  padding: .7rem .8rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: .95rem;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-dk);
  box-shadow: 0 0 0 3px rgba(126, 200, 184, .13);
}
textarea { min-height: 90px; resize: vertical; }

.field { margin-bottom: 1rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

.check { display: flex; align-items: center; gap: .55rem; color: var(--text); font-size: .93rem; }
.check input { width: auto; accent-color: var(--accent); width: 17px; height: 17px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .68rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #04120f;
  font: inherit;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #96d8c9; color: #04120f; }
.btn-block { width: 100%; }
.btn-sm { padding: .38rem .7rem; font-size: .83rem; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; border-color: #5a2f27; color: var(--danger); }
.btn-danger:hover { background: #2a1512; color: var(--danger); }

.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------- avvisi */

.flash {
  padding: .75rem 1rem;
  border-radius: 10px;
  margin-bottom: 1.2rem;
  font-size: .92rem;
  border: 1px solid;
}
.flash-ok    { background: rgba(127, 191, 127, .1); border-color: #2f5a3a; color: #b6e3b6; }
.flash-error { background: rgba(226, 114, 91, .1);  border-color: #5a2f27; color: #f0a897; }
.flash-info  { background: rgba(126, 200, 184, .08); border-color: #2c4c47; color: #a8ded2; }

.notice {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

/* --------------------------------------------------------------- schede */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem;
  margin-bottom: 1.3rem;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; margin-bottom: 1.6rem; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.stat .n { font-size: 1.9rem; font-weight: 600; line-height: 1.1; }
.stat .l { color: var(--faint); font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; }

/* ------------------------------------------------------- griglia lezioni */

.section-title {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  margin: 2rem 0 .9rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--line-soft);
}
.section-title:first-of-type { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1.1rem;
}

.vcard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--text);
  transition: border-color .15s ease, transform .15s ease;
}
.vcard:hover { border-color: var(--accent-dk); transform: translateY(-2px); color: var(--text); }

.vthumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #16211f, #0b0d0e);
  overflow: hidden;
}
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0,0,0,0) 40%, rgba(0,0,0,.45) 100%);
}
.vthumb .play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  border: 1px solid rgba(255, 255, 255, .35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.vthumb .play::before {
  content: "";
  border-left: 13px solid #fff;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  margin-left: 4px;
}
.vthumb .badge {
  position: absolute;
  right: .5rem;
  bottom: .5rem;
  z-index: 2;
  background: rgba(0, 0, 0, .75);
  padding: .12rem .45rem;
  border-radius: 5px;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}

.vbody { padding: .8rem .9rem 1rem; }
.vbody h3 { font-size: .97rem; margin-bottom: .25rem; }
.vbody .meta { color: var(--faint); font-size: .8rem; }

/* --------------------------------------------------------------- tabelle */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
table.data th, table.data td {
  padding: .6rem .7rem;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.data th {
  color: var(--faint);
  font-weight: 500;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
}
table.data tbody tr:hover { background: var(--surface-2); }

.pill {
  display: inline-block;
  padding: .12rem .55rem;
  border-radius: 999px;
  font-size: .74rem;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill-ok     { border-color: #2f5a3a; color: #9ed49e; }
.pill-off    { border-color: #5a3b27; color: #d8a97f; }
.pill-admin  { border-color: var(--accent-dk); color: var(--accent); }

/* ------------------------------------------------------ liste permessi */

.picker {
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .4rem;
  background: var(--surface-2);
}
.picker label {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .55rem;
  border-radius: 8px;
  color: var(--text);
  font-size: .9rem;
  margin: 0;
  cursor: pointer;
}
.picker label:hover { background: rgba(255, 255, 255, .04); }
.picker input { width: 17px; height: 17px; accent-color: var(--accent); flex: none; }
.picker .sub { color: var(--faint); font-size: .78rem; margin-left: auto; padding-left: .6rem; }

/* --------------------------------------------------------------- player */

.player-page { background: #000; }

.player-shell { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }

.player-back { display: inline-block; color: var(--muted); font-size: .88rem; margin-bottom: .9rem; }

/* Il contenitore intercetta tutti i click: l'iframe sottostante non è
   mai raggiungibile, quindi niente logo/titolo YouTube cliccabile. */
#player-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  user-select: none;
}
#player-stage.is-fullscreen { border-radius: 0; border: none; height: 100%; aspect-ratio: auto; }

#player-stage iframe,
#player-stage > div[id^="yt-"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  pointer-events: none;   /* nessun click arriva a YouTube */
}

/* Ritaglia i bordi superiore/inferiore dove YouTube disegna
   titolo e watermark, anche quando compaiono all'hover. */
#player-stage .yt-wrap {
  position: absolute;
  top: -6%;
  left: 0;
  width: 100%;
  height: 112%;
  pointer-events: none;
}

/* Poster: copre il player finche' non si preme play.
   Nello stato iniziale YouTube disegna titolo, canale e "Guarda su YouTube"
   con sovrapposizioni di altezza FISSA: il ritaglio percentuale sopra non
   basta a nasconderle sugli schermi bassi. Un'immagine che copre tutto si'. */
.p-poster {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #000 center/cover no-repeat;
  transition: opacity .25s ease;
}
.p-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(0,0,0,.15) 30%, rgba(0,0,0,.6) 100%);
}
.p-poster.hidden { opacity: 0; pointer-events: none; }

.p-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  cursor: pointer;
  background: transparent;
}

.p-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 6;
  pointer-events: none;
  transition: opacity .2s ease;
}
.p-center .bubble {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .6);
  border: 1px solid rgba(255, 255, 255, .3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.p-center .bubble::before {
  content: "";
  border-left: 20px solid #fff;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  margin-left: 6px;
}
.p-center.hidden { opacity: 0; }

.p-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 7;
  color: var(--muted);
  font-size: .85rem;
  background: #000;
}
.p-spinner.hidden { display: none; }

.p-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  padding: 2.5rem .8rem .6rem;
  background: linear-gradient(to top, rgba(0,0,0,.88), rgba(0,0,0,0));
  display: flex;
  flex-direction: column;
  gap: .35rem;
  transition: opacity .25s ease;
}
.p-controls.hidden { opacity: 0; pointer-events: none; }

.p-seek {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.p-seek .track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  background: rgba(255, 255, 255, .25);
  overflow: hidden;
}
.p-seek .buf  { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255,255,255,.22); }
.p-seek .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); }
.p-seek:hover .track { height: 6px; }

.p-btns {
  display: flex;
  align-items: center;
  gap: .55rem;
  color: #fff;
  font-size: .8rem;
}
.p-btns button {
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: .25rem .35rem;
  font: inherit;
  font-size: .95rem;
  line-height: 1;
  border-radius: 6px;
}
.p-btns button:hover { background: rgba(255, 255, 255, .12); }
.p-time { font-variant-numeric: tabular-nums; color: rgba(255,255,255,.85); }
.p-spacer { flex: 1; }
.p-btns input[type=range] {
  width: 78px;
  accent-color: var(--accent);
  background: transparent;
  padding: 0;
  border: 0;
}
@media (max-width: 560px) {
  .p-btns input[type=range] { display: none; }
}

.player-meta { margin-top: 1.2rem; }
.player-meta h1 { font-size: 1.25rem; }
.player-meta .desc { color: var(--muted); font-size: .93rem; white-space: pre-line; }

.protected {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
