/* Galleria delle partite pubbliche (partite.html, js/partite.js). Card come quelle di
   "Analisi video" nell'app: miniatura 16:9, squadre, nome e data. */

.gl-main { background: var(--grey-50); padding: 18px 0 56px; min-height: 70vh; }

/* style.css dà 80px sopra e sotto a ogni <section>: qui titolo e griglia sono <section> ma lo
   spazio lo decidono le regole di questa pagina. */
.gl-main section { padding: 0; }

.gl-head { text-align: center; margin: 0 auto 16px; }
.gl-title { font-size: 2rem; color: var(--navy); margin: 0 0 6px; }
.gl-sub { color: var(--grey-600); margin: 0 auto 14px; line-height: 1.5; max-width: 720px; }

/* ── Barra di ricerca: la stessa dell'app (MatchSearchBar.razor.css), quattro riquadri ── */
.msb-bar { display: flex; flex-direction: column; gap: 10px; text-align: left; container-type: inline-size; }
.msb-row-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; width: 100%; }
@container (max-width: 900px) { .msb-row-fields { grid-template-columns: repeat(2, 1fr); } }
@container (max-width: 480px) { .msb-row-fields { grid-template-columns: 1fr; } }

.msb-field { position: relative; width: 100%; }
.msb-icon { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); width: 15px; height: 15px;
  color: #9aa5bd; pointer-events: none; }
.msb-input { width: 100%; box-sizing: border-box; border: 1.5px solid #e0e5f0; border-radius: 999px; background: #fff;
  color: #222; font: inherit; font-size: .88rem; padding: 9px 14px 9px 34px; outline: none;
  transition: border-color .15s, box-shadow .15s; }
.msb-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(5, 39, 103, .1); }
.msb-input::placeholder { color: #aab2c5; }
.msb-input::-webkit-search-cancel-button { cursor: pointer; }

.msb-date-group { display: flex; align-items: center; gap: 6px; border: 1.5px solid #e0e5f0; border-radius: 999px;
  background: #fff; padding: 6px 12px; width: 100%; box-sizing: border-box; min-width: 0; }
.msb-date-input { border: none; outline: none; background: transparent; font: inherit; font-size: .8rem; color: #222;
  flex: 1; min-width: 0; }
.msb-date-sep { color: #b7bfd0; flex-shrink: 0; }

.msb-dd-wrap { position: relative; flex-shrink: 0; }
.msb-dd-trigger { display: flex; align-items: center; gap: 6px; border: none; outline: none; background: transparent;
  font: inherit; font-size: .78rem; font-weight: 600; color: #555; cursor: pointer; padding: 0; white-space: nowrap; }
.msb-dd-chevron { width: 9px; height: 6px; flex-shrink: 0; color: #9aa5bd; transition: transform .15s; }
.msb-dd-chevron-open { transform: rotate(180deg); }
.msb-sort-wrap { width: 100%; flex-shrink: 1; }
.msb-sort-trigger { width: 100%; box-sizing: border-box; justify-content: space-between; border: 1.5px solid #e0e5f0;
  border-radius: 999px; background: #fff; color: #444; font-size: .82rem; padding: 9px 14px; transition: border-color .15s; }
.msb-sort-trigger:hover { border-color: #c4cde3; }
.msb-dd-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 50; min-width: 170px; background: #fff;
  border: 1px solid #e0e5f0; border-radius: 12px; box-shadow: 0 8px 24px rgba(18, 29, 53, .18); padding: 6px;
  box-sizing: border-box; }
.msb-dd-menu[hidden] { display: none; }
.msb-dd-menu-wide { min-width: 100%; }
.msb-dd-item { display: block; width: 100%; box-sizing: border-box; border: none; border-radius: 8px; background: transparent;
  color: #333; font: inherit; font-size: .85rem; font-weight: 500; text-align: left; padding: 8px 11px; cursor: pointer;
  white-space: nowrap; transition: background .12s, color .12s; }
.msb-dd-item + .msb-dd-item { margin-top: 2px; }
.msb-dd-item:hover { background: #eef1f7; }
.msb-dd-item-selected, .msb-dd-item-selected:hover { background: var(--navy); color: #fff; font-weight: 700; }

.msb-row-clear { display: flex; justify-content: flex-end; }
.msb-row-clear[hidden] { display: none; }
.msb-clear-btn { border: none; border-radius: 999px; background: #eef1f7; color: #666; font: inherit; font-size: .82rem;
  font-weight: 600; padding: 6px 14px; cursor: pointer; transition: background .15s, color .15s; white-space: nowrap; }
.msb-clear-btn:hover { background: rgba(220, 53, 69, .12); color: #dc3545; }

.gl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.gl-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(5, 39, 103, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.gl-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(5, 39, 103, 0.14); }

.gl-thumb { position: relative; aspect-ratio: 16 / 9; background: var(--navy-dark); overflow: hidden; }
.gl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gl-thumb-none { background: linear-gradient(135deg, var(--navy), var(--navy-mid)); }
.gl-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  border-radius: 50%;
  background: rgba(5, 39, 103, 0.72);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.gl-play::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 14px;
  border-style: solid;
  border-width: 10px 0 10px 16px;
  border-color: transparent transparent transparent #fff;
}
.gl-card:hover .gl-play { opacity: 1; }

.gl-card-body { padding: 12px 14px 14px; }
.gl-card-title { font-size: 1rem; margin: 0; color: var(--navy); line-height: 1.3; }
.gl-card-name { font-size: 0.82rem; color: var(--grey-600); margin: 4px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gl-card-date { font-size: 0.82rem; color: var(--grey-600); margin: 4px 0 0; }

.gl-empty { text-align: center; color: var(--grey-600); margin: 32px 0; }
/* Rotellina mentre arrivano le partite (js/partite.js, classe gl-loading): al posto della scritta
   finché non c'è nulla, poi sotto le card già mostrate finché non arrivano tutte. */
.gl-empty.gl-loading:not([hidden]) { display: flex; justify-content: center; }
.gl-empty.gl-loading::before {
  content: "";
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--grey-200);
  border-top-color: var(--navy);
  animation: gl-spin 0.8s linear infinite;
}
@keyframes gl-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .gl-empty.gl-loading::before { animation-duration: 2.4s; } }
/* Pagine da 50 partite: frecce e numeri, la pagina corrente in blu. */
.gl-pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 28px; }
.gl-pager[hidden] { display: none; }
.gl-page { min-width: 38px; height: 38px; padding: 0 10px; border: 1.5px solid #e0e5f0; border-radius: 999px;
  background: #fff; color: var(--navy); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: border-color .15s, background .15s; }
.gl-page:hover:not(:disabled) { border-color: #c4cde3; background: #eef1f7; }
.gl-page:disabled { color: #b7bfd0; cursor: default; }
.gl-page.is-current, .gl-page.is-current:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.gl-page-gap { color: #9aa5bd; padding: 0 2px; }

.gl-note { text-align: center; color: var(--grey-600); font-size: 0.85rem; margin: 36px auto 0; max-width: 620px; }
.gl-note a { color: var(--blue); }

@media (max-width: 600px) {
  .gl-main { padding: 12px 0 40px; }
  .gl-title { font-size: 1.6rem; }
  .gl-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* Accuratezza dell'analisi, in alto a destra sulla miniatura: stessi colori dell'app. */
.gl-acc { position: absolute; top: 8px; right: 8px; padding: 3px 9px; border-radius: 999px; font-size: .72rem;
  font-weight: 700; color: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.gl-acc-green { background: #198754; }
.gl-acc-blue  { background: var(--blue); }
.gl-acc-grey  { background: #6c757d; }

/* Accesso (dal 20/11/2026): l'elenco si vede solo con l'account dell'app. */
.msb-bar[hidden], .gl-login[hidden], .gl-user[hidden] { display: none; }
.gl-login { max-width: 380px; margin: 8px auto 0; background: #fff; border-radius: var(--radius); padding: 22px 22px 18px;
  box-shadow: 0 1px 4px rgba(5, 39, 103, .08); text-align: left; display: flex; flex-direction: column; }
.gl-login-title { font-size: 1.15rem; color: var(--navy); margin: 0 0 4px; }
.gl-login-sub { color: var(--grey-600); font-size: .88rem; margin: 0 0 14px; line-height: 1.45; }
.gl-login-label { font-size: .82rem; font-weight: 600; color: #444; margin: 0 0 4px; }
.gl-login-input { border: 1.5px solid #e0e5f0; border-radius: 10px; padding: 10px 12px; font: inherit; font-size: .92rem;
  margin: 0 0 12px; outline: none; transition: border-color .15s, box-shadow .15s; }
.gl-login-input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(5, 39, 103, .1); }
.gl-login-msg { font-size: .85rem; margin: 0 0 12px; color: #dc3545; line-height: 1.4; }
.gl-login-msg.is-ok { color: #198754; }
.gl-login-btn { width: 100%; justify-content: center; }
.gl-login-btn:disabled { opacity: .6; cursor: default; }
.gl-login-link { background: none; border: none; padding: 0; font: inherit; color: var(--blue); cursor: pointer; font-size: .86rem; }
.gl-login-link:hover { text-decoration: underline; }
.gl-login > .gl-login-link { margin: 12px auto 0; }
.gl-login-foot { text-align: center; font-size: .85rem; color: var(--grey-600); margin: 12px 0 0; }
.gl-login-foot a { color: var(--blue); }
.gl-user { text-align: center; font-size: .85rem; color: var(--grey-600); margin: 0 0 12px; }

/* "Scarica": apre la finestra con il link da incollare nell'app (Scarica partita condivisa). */
.gl-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.gl-copy { border: 1.5px solid #e0e5f0; border-radius: 999px; background: #fff; color: var(--navy); font: inherit;
  font-size: .78rem; font-weight: 600; padding: 4px 11px; cursor: pointer; white-space: nowrap;
  transition: border-color .15s, background .15s; }
.gl-copy:hover { border-color: #c4cde3; background: #eef1f7; }
.gl-copy.is-done { border-color: #198754; color: #198754; }

/* Finestra di "Scarica" (openDownload in js/partite.js). */
body.gl-dl-open { overflow: hidden; }
.gl-dl-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(10, 18, 40, .55);
  display: flex; align-items: center; justify-content: center; padding: 16px; }
.gl-dl-backdrop[hidden] { display: none; }
.gl-dl { position: relative; background: #fff; border-radius: 16px; width: min(720px, 100%);
  max-height: calc(100vh - 32px); overflow-y: auto; padding: 26px 26px 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.gl-dl-close { position: absolute; top: 10px; right: 12px; border: none; background: none; font-size: 1.7rem;
  line-height: 1; color: var(--grey-600); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.gl-dl-close:hover { background: #eef1f7; color: var(--navy); }
.gl-dl-title { margin: 0 32px 10px 0; font-size: 1.2rem; color: var(--navy); }
.gl-dl-text { margin: 0 0 14px; font-size: .92rem; line-height: 1.55; color: #333; }
.gl-dl-link { display: flex; gap: 8px; margin: 0 0 16px; }
.gl-dl-input { flex: 1; min-width: 0; border: 1.5px solid #e0e5f0; border-radius: 10px; padding: 9px 12px;
  font: inherit; font-size: .88rem; color: #222; background: #f7f8fb; }
.gl-dl-copy { white-space: nowrap; }
.gl-dl-copy.is-done { background: #198754; border-color: #198754; }
.gl-dl-shot { margin: 0 0 12px; }
.gl-dl-shot img { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid #e0e5f0; }
.gl-dl-shot figcaption { margin-top: 6px; font-size: .8rem; color: var(--grey-600); text-align: center; }
.gl-dl-foot { margin: 0; font-size: .85rem; color: var(--grey-600); text-align: center; }
.gl-dl-foot a { color: var(--blue); }
@media (max-width: 560px) {
  .gl-dl { padding: 22px 16px 16px; }
  .gl-dl-link { flex-direction: column; }
}
