/* MuteTube — tema scuro, accento ambra (ispirato allo stile zzztube) */
* { box-sizing: border-box; }
:root {
  --bg: #131313;
  --panel: #1d1c1c;
  --panel2: #262525;
  --line: #2e2d2d;
  --text: #ffffff;
  --muted: #c6c6c6;
  --accent: #ffab00;
  --accent-dark: #e69a00;
  --on-accent: #1d1400;
  --danger: #ff5c72;
  --ok: #3ecf8e;
  --radius: 8px;
}
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a, button, select, input, summary { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
main { flex: 1; width: 100%; max-width: 1320px; margin: 0 auto; padding: 18px 20px 40px; }

/* ============ HEADER (logo | categorie | lingua e altro) ============ */
.site-header {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 20px; background: #000;
  border-bottom: 2px solid var(--accent);
  position: sticky; top: 0; z-index: 50;
}
.logo { font-size: 23px; font-weight: 800; color: var(--text); letter-spacing: -.5px; white-space: nowrap; }
.logo span { color: var(--accent); }
.logo:hover { text-decoration: none; }

.cats-nav { display: flex; align-items: center; }
.header-right { display: flex; align-items: center; gap: 12px; margin-left: auto; flex-wrap: wrap; }
.nav-link { color: var(--text); font-weight: 600; font-size: 14px; }
.nav-link:hover { color: var(--accent); text-decoration: none; }

/* Dropdown generico (categorie, lingua) */
details.dd { position: relative; }
details.dd summary {
  list-style: none; cursor: pointer; user-select: none;
  padding: 7px 14px; border-radius: var(--radius);
  background: var(--panel2); color: var(--text); font-weight: 700; font-size: 14px;
  border: 1px solid var(--line);
}
details.dd summary::-webkit-details-marker { display: none; }
details.dd summary::after { content: " ▾"; color: var(--accent); }
details.dd[open] summary { background: var(--accent); color: var(--on-accent); }
details.dd[open] summary::after { color: var(--on-accent); }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 190px; max-height: 60vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 6px; z-index: 100; box-shadow: 0 8px 24px rgba(0,0,0,.5);
  display: flex; flex-direction: column;
}
.dd-menu a, .dd-item { padding: 8px 12px; border-radius: 6px; color: var(--text); font-size: 14px; }
.dd-menu a:hover { background: var(--panel2); color: var(--accent); text-decoration: none; }
.dd-item.active { color: var(--accent); font-weight: 700; }
.dd-item.soon { color: var(--muted); font-style: italic; }
.lang-dd .dd-menu { left: auto; right: 0; }

/* Ricerca */
.search { display: flex; }
.search input {
  width: 220px; max-width: 44vw; padding: 8px 12px;
  border: 1px solid var(--line); border-right: 0; border-radius: var(--radius) 0 0 var(--radius);
  background: var(--panel); color: var(--text); outline: none; font: inherit;
}
.search input:focus { border-color: var(--accent); }
.search button {
  padding: 8px 13px; border: 1px solid var(--accent); background: var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0; cursor: pointer; font-size: 15px;
}

/* Barra categorie scorrevole (visibile solo su mobile) */
.catbar { display: none; }
.catchip {
  flex: 0 0 auto; padding: 8px 15px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); font-size: 13.5px; font-weight: 700; white-space: nowrap;
}
.catchip:hover { text-decoration: none; }
.catchip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* Flash */
.flash {
  max-width: 1320px; margin: 14px auto 0; padding: 10px 16px;
  background: var(--panel2); border: 1px solid var(--accent); border-radius: var(--radius);
  width: calc(100% - 40px);
}

/* ============ TESTATA ELENCO (titolo, filtri, ordina per) ============ */
.listhead {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px 12px; display: flex; flex-direction: column; gap: 12px;
}
.listhead h1 { margin: 0; font-size: 22px; }
.listhead h1 small { color: var(--muted); font-size: 14px; font-weight: 400; margin-left: 8px; }
.filters { display: flex; flex-direction: column; gap: 8px; }
.filter-group { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.flabel {
  color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px;
  min-width: 52px; font-weight: 700;
}
.chip {
  padding: 5px 13px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; font-size: 13px; color: var(--text); font-weight: 600;
}
.chip small { color: var(--muted); font-weight: 400; }
.chip:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.chip.active small { color: var(--on-accent); }
.chip.cat { border-color: var(--accent); }
.sortrow { align-self: flex-end; display: flex; align-items: center; gap: 8px; margin-top: -4px; }
.sortrow label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.sortrow select {
  padding: 7px 10px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); font: inherit; font-size: 13px; cursor: pointer;
}
.sortrow select:focus { border-color: var(--accent); outline: none; }

/* ============ GRIGLIA VIDEO ============ */
.videos-section { margin-top: 18px; }
.grid {
  display: grid; gap: 18px 16px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.card { display: block; color: var(--text); }
.card:hover { text-decoration: none; }
.card h3 {
  font-size: 14.5px; font-weight: 600; margin: 8px 2px 3px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card:hover h3 { color: var(--accent); }
.cardmeta { margin: 0 2px; font-size: 12.5px; color: var(--muted); }
.cardmeta .src { color: var(--accent-dark); font-weight: 600; }
.thumb {
  position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden;
  background: var(--panel2); border: 1px solid var(--line);
}
.card:hover .thumb { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s; }
.card:hover .thumb img { transform: scale(1.04); }
.thumb-ph { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 42px; opacity: .35; }
.dur, .mutebadge {
  position: absolute; bottom: 6px; padding: 2px 7px; font-size: 12px; font-weight: 700;
  background: rgba(0,0,0,.8); border-radius: 5px; color: #fff;
}
.dur { right: 6px; }
.mutebadge { left: 6px; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

/* Paginazione (elenco pagine, centrato) */
.pager { display: flex; gap: 6px; align-items: center; justify-content: center; margin: 28px 0 4px; flex-wrap: wrap; }
.pbtn {
  min-width: 38px; text-align: center; padding: 8px 10px; border-radius: var(--radius);
  background: var(--panel2); border: 1px solid var(--line); color: var(--text); font-weight: 700; font-size: 14px;
}
.pbtn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.pbtn.current { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pdots { color: var(--muted); padding: 0 2px; }

/* ============ CATEGORIE CORRELATE ============ */
.relcats {
  margin-top: 28px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
}
.relcats h2 { margin: 0 0 12px; font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.catbtns { display: flex; flex-wrap: wrap; gap: 10px; }
.catbtn {
  padding: 9px 18px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: var(--radius); color: var(--text); font-weight: 700; font-size: 14px;
}
.catbtn small { color: var(--muted); font-weight: 400; margin-left: 4px; }
.catbtn:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); text-decoration: none; }
.catbtn:hover small { color: var(--on-accent); }

/* Tag bar (pagina video) */
.tagbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }

/* ============ PAGINA VIDEO ============ */
.player-shell {
  position: relative; aspect-ratio: 16/9; background: #000;
  border-radius: var(--radius); overflow: hidden; max-height: 72vh;
}
.player-shell iframe.mt-embed, .player-shell video.mt-player {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block;
}
video.mt-player::-webkit-media-controls-volume-slider,
video.mt-player::-webkit-media-controls-mute-button,
video.mt-player::-webkit-media-controls-volume-control-container { display: none !important; }
.mute-note {
  margin: 10px 0; padding: 8px 14px; background: var(--panel);
  border-left: 3px solid var(--accent); border-radius: 6px; font-size: 13px; color: var(--muted);
}
.watch h1 { font-size: 22px; margin: 10px 0 6px; }
.meta { color: var(--muted); font-size: 13px; }
.verified { color: var(--ok); }
.description { color: var(--text); max-width: 900px; }
.related h2 { font-size: 17px; margin: 30px 0 14px; }

/* ============ FOOTER (grigio) ============ */
.site-footer {
  background: #1a1a1a; border-top: 1px solid var(--line);
  padding: 22px 20px; text-align: center; font-size: 13px; color: var(--muted);
}
.site-footer .tagline { font-size: 15px; font-weight: 700; color: var(--text); }
.site-footer nav { margin-top: 8px; }
.site-footer a { margin: 0 6px; }

/* ============ AGE GATE ============ */
.age-body { align-items: center; justify-content: center; display: flex; padding: 20px; }
.age-box {
  max-width: 520px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 34px; text-align: center;
}
.age-logo { font-size: 30px; font-weight: 800; margin-bottom: 10px; }
.age-logo span { color: var(--accent); }
.age-box h1 { font-size: 20px; }
.age-mute { background: var(--panel2); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }
.age-small { font-size: 12px; color: var(--muted); margin-top: 18px; }
.btn-exit { display: inline-block; margin-top: 14px; color: var(--muted); }

/* ============ PULSANTI & FORM ============ */
.btn, .btn-primary, .btn-danger {
  display: inline-block; padding: 9px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  font-weight: 700; font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn:hover, .btn-primary:hover, .btn-danger:hover { text-decoration: none; filter: brightness(1.12); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #2b0710; }
.btn-danger.outline { background: transparent; color: var(--danger); }
form.inline { display: inline; }
.stacked { display: flex; flex-direction: column; gap: 12px; margin: 14px 0; }
.stacked label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.stacked input[type=text], .stacked input[type=url], .stacked input[type=password], .stacked input[type=number],
.stacked input[type=search], .stacked select, .stacked textarea {
  padding: 9px 12px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius); outline: none; font: inherit;
}
.stacked input:focus, .stacked textarea:focus, .stacked select:focus { border-color: var(--accent); }
.stacked .check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.check.inline { display: inline-flex; margin-left: 10px; }
.catchecks {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px;
  display: flex; flex-wrap: wrap; gap: 6px 18px;
}
.catchecks legend { color: var(--muted); font-size: 13px; padding: 0 6px; }
.catchecks .check { display: inline-flex; }

/* ============ ADMIN ============ */
.adminbox { max-width: 460px; margin: 40px auto; background: var(--panel); padding: 26px; border-radius: 14px; }
.adminbox.wide { max-width: 780px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin: 6px 0 14px; }
.admin-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat { background: var(--panel); padding: 14px 20px; border-radius: var(--radius); color: var(--muted); }
.stat b { color: var(--accent); font-size: 20px; margin-right: 6px; }
.admintable { width: 100%; border-collapse: collapse; margin: 10px 0 26px; }
.admintable th, .admintable td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.admintable th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.admintable input[type=text], .admintable input[type=number] {
  padding: 6px 9px; background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; font: inherit; width: 100%;
}
.admintable .wnum { width: 72px; }
.badge { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-pending { background: #3d3413; color: #ffd35c; }
.badge-approved { background: #11341f; color: var(--ok); }
.badge-rejected { background: #3a121a; color: var(--danger); }
.hint { color: var(--muted); font-size: 13px; }
.review-cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 22px; }
@media (max-width: 900px) { .review-cols { grid-template-columns: 1fr; } }
.checklist { background: var(--panel); padding: 16px; border-radius: var(--radius); }
.source-card { background: var(--panel); padding: 16px 18px; border-radius: var(--radius); margin-bottom: 16px; }
.source-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.source-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
@media (max-width: 700px) { .source-grid { grid-template-columns: 1fr; } }
.catadd { background: var(--panel); padding: 14px 18px; border-radius: var(--radius); max-width: 640px; }
.errorbox { text-align: center; padding: 60px 0; }
.staticpage { max-width: 800px; }
.draft-note { background: #3d3413; color: #ffd35c; padding: 8px 14px; border-radius: var(--radius); font-size: 13px; }
code { background: var(--panel2); padding: 1px 6px; border-radius: 5px; font-size: 13px; }

/* ============ MOBILE ============ */
body { min-height: 100svh; }
.age-box form .btn-primary { width: 100%; }

@media (max-width: 760px) {
  /* Header compatto: logo + lingua/admin; la ricerca scende su una riga piena */
  .site-header { gap: 8px 10px; padding: 8px 12px; }
  .logo { font-size: 20px; }
  .cats-nav { display: none; }            /* il menu a tendina lascia il posto alla barra categorie */
  .header-right { gap: 8px; margin-left: auto; }
  .search { order: 10; flex-basis: 100%; }
  .search input { width: 100%; max-width: none; }
  details.dd summary { padding: 9px 12px; }

  /* Barra categorie swipeabile sotto l'header */
  .catbar {
    display: flex; gap: 8px; align-items: center;
    padding: 10px 12px; background: var(--panel);
    border-bottom: 1px solid var(--line);
    overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
  }
  .catbar::-webkit-scrollbar { display: none; }

  main { padding: 14px 12px 30px; }

  /* Testata: filtri scorrevoli in orizzontale, niente andare a capo */
  .listhead { padding: 12px 12px 10px; gap: 10px; }
  .listhead h1 { font-size: 19px; }
  .filter-group { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; padding-bottom: 2px; }
  .filter-group::-webkit-scrollbar { display: none; }
  .flabel { flex: 0 0 auto; min-width: 0; }
  .chip { flex: 0 0 auto; padding: 8px 14px; }
  .sortrow { align-self: stretch; justify-content: flex-end; }
  .sortrow select { padding: 10px 12px; }

  .grid { gap: 14px 10px; }

  /* Paginazione scorrevole, tasti più grandi */
  .pager { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .pager::-webkit-scrollbar { display: none; }
  .pbtn { padding: 10px 13px; flex: 0 0 auto; }

  .catbtn { padding: 10px 16px; }
  .watch h1 { font-size: 18px; }

  /* Tabelle admin scorrevoli invece che schiacciate */
  .admintable { display: block; overflow-x: auto; }
}

@media (max-width: 560px) {
  /* Griglia a 2 colonne fisse, player a tutta larghezza (edge-to-edge) */
  .grid { grid-template-columns: 1fr 1fr; }
  .card h3 { font-size: 13.5px; }
  .cardmeta { font-size: 11.5px; }
  .player-shell { margin: 0 -12px; border-radius: 0; }
  .mute-note { font-size: 12px; }
  .age-box { padding: 26px 20px; }
}
