/* ludoteca.css — Castelli in Gioco APS
   Stesso carattere (Poppins, servito dal tema) e stessi colori del sito:
   blu notte #24283a, azzurro #1f6f99, cielo #eef6fb / #cfe6f2, oro #d0944a / #9a5f1a */

#cig-ludoteca {
  font-family: 'Poppins', system-ui, sans-serif;
  color: #24283a;
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 0 3rem;
  font-size: 15px;
}

/* ── LOGIN WALL ── */
#cig-login-wall {
  text-align: center;
  padding: 3.5rem 2rem;
  background: #eef6fb;
  border-radius: 16px;
  border: 1px solid #cfe6f2;
}
#cig-login-wall h2 { font-size: 24px; font-weight: 800; margin-bottom: .5rem; }
#cig-login-wall p { color: #404040; font-size: 15px; margin-bottom: 1.5rem; }
#cig-login-wall a {
  display: inline-block; padding: 12px 28px;
  background: #24283a; color: #fff;
  border-radius: 12px; text-decoration: none;
  font-size: 15px; font-weight: 600;
}
#cig-login-wall a:hover { background: #1f6f99; }

/* ── HEADER (il titolo lo dà già la pagina: resta il benvenuto) ── */
.cig-header { margin-bottom: 1.25rem; }
.cig-title, .cig-tagline { display: none; }
.cig-user-bar {
  font-size: 15px; color: #404040;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.cig-user-bar strong { color: #24283a; }
.cig-user-bar .manager-pill {
  background: #24283a; color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 2px 10px; border-radius: 20px;
}

/* ── STATS ── */
.cig-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 1.25rem;
}
.cig-stat {
  background: #fff; border: 1px solid #e5e5e5;
  border-radius: 16px; padding: 14px 16px; text-align: center;
}
.cig-stat .n { font-size: 30px; font-weight: 800; line-height: 1.1; color: #24283a; }
.cig-stat .l { font-size: 13px; color: #525252; margin-top: 4px; }
.cig-stat.av .n { color: #0f6e56; }
.cig-stat.lo .n { color: #9a5f1a; }
.cig-stat.tm .n { color: #1f6f99; }

/* ── CONTROLS ── */
.cig-controls {
  display: flex; gap: 8px; flex-wrap: wrap;
  align-items: center; margin-bottom: 1.25rem;
}
.cig-search-wrap { position: relative; flex: 1; min-width: 200px; }
.cig-search-wrap svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); opacity: .5; pointer-events: none;
}
.cig-search-wrap input {
  width: 100%; padding: 10px 14px 10px 38px;
  border: 1px solid #d4d4d4; border-radius: 12px;
  font-family: inherit; font-size: 15px;
  outline: none; background: #fff; color: #24283a;
}
.cig-search-wrap input:focus { border-color: #1f6f99; box-shadow: 0 0 0 3px #cfe6f2; }
.cig-fb {
  font-family: inherit; font-size: 14px; font-weight: 500;
  padding: 8px 14px; border: 1px solid #d4d4d4;
  border-radius: 999px; cursor: pointer; background: #fff;
  color: #404040; transition: all .15s;
}
.cig-fb.active { background: #24283a; border-color: #24283a; color: #fff; font-weight: 600; }
.cig-fb:hover:not(.active) { background: #eef6fb; border-color: #cfe6f2; }
.cig-add-btn {
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 14px; border: 1px solid #24283a;
  border-radius: 12px; cursor: pointer; background: #fff; color: #24283a;
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: auto; transition: all .15s;
}
.cig-add-btn:hover { background: #eef6fb; }

/* ── GRID ── */
.cig-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr));
  gap: 16px;
}

/* ── CARD orizzontale ── */
.cig-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  min-height: 180px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  transition: border-color .15s, box-shadow .15s;
}
.cig-card:hover { border-color: #cfe6f2; box-shadow: 0 4px 14px rgba(36,40,58,.08); }
.cig-card.solo-tmp { border-left: 4px solid #1f6f99; }

/* ── COPERTINA a sinistra ── */
/* L'immagine riempie la colonna ma non decide l'altezza della scheda (copertine alte o basse uguali) */
.cig-cover-wrap {
  position: relative;
  width: 160px;
  min-width: 160px;
  background: #eef6fb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.cig-cover-wrap.loaded .cig-cover-placeholder { display: none; }
.cig-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: none;
}
.cig-cover.loaded-direct { display: block; }
.cig-cover-placeholder { font-size: 40px; opacity: .25; }

/* ── CORPO CARD a destra ── */
.cig-card-body {
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-width: 0;
}
.cig-ctop { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.cig-gname { font-size: 16px; font-weight: 700; flex: 1; line-height: 1.3; color: #24283a; }
.cig-badges { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }

.cig-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 20px; white-space: nowrap;
}
.b-av  { background: #e1f5ee; color: #0f6e56; }
.b-lo  { background: #faeeda; color: #7a4a0b; }
.b-tm  { background: #eef6fb; color: #1f6f99; }
.b-ex  { background: #24283a; color: #fff; }

.cig-meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 13px; color: #525252;
}
.cig-meta span { display: flex; align-items: center; gap: 4px; }

.cig-info {
  font-size: 13px; display: flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 10px;
}
.info-lo   { background: #faeeda; color: #7a4a0b; }
.info-tm   { background: #eef6fb; color: #1f6f99; }
.info-scad { background: #fcebeb; color: #a32d2d; font-weight: 600; }
.info-nocust { background: #fff; color: #525252; border: 1px dashed #d4d4d4; }

.cig-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: auto; align-items: center;
}
.cig-act {
  font-family: inherit; font-size: 13px; font-weight: 600; padding: 6px 12px; min-height: 34px;
  border: 1px solid #d4d4d4; border-radius: 10px;
  cursor: pointer; background: #fff; color: #404040;
  display: inline-flex; align-items: center; gap: 4px; transition: all .15s;
}
.cig-act:hover           { background: #eef6fb; color: #24283a; }
.cig-act.primary         { background: #24283a; border-color: #24283a; color: #fff; }
.cig-act.primary:hover   { background: #1f6f99; border-color: #1f6f99; color: #fff; }
.cig-act.blue            { border-color: #1f6f99; color: #1f6f99; }
.cig-act.blue:hover      { background: #eef6fb; }
.cig-act.warn            { background: #d0944a; border-color: #d0944a; color: #24283a; }
.cig-act.warn:hover      { background: #e0a85f; }
.cig-act.danger          { border-color: #e5b4b4; color: #a32d2d; }
.cig-act.danger:hover    { background: #fcebeb; }

.cig-bgg {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: #525252; text-decoration: none;
  padding: 5px 9px; border: 1px solid #e5e5e5;
  border-radius: 10px; transition: all .15s; margin-left: auto;
}
.cig-bgg:hover { border-color: #cfe6f2; color: #24283a; background: #eef6fb; }
.bgg-logo {
  background: #ff5100; color: #fff; font-size: 9px;
  font-weight: 700; padding: 1px 4px; border-radius: 3px;
}

.cig-no-res {
  grid-column: 1/-1; text-align: center;
  padding: 3rem; color: #525252; font-size: 15px;
}

/* ── Telefono ── */
@media (max-width: 480px) {
  #cig-ludoteca { overflow-x: hidden; }
  .cig-card { min-height: 150px; }
  .cig-cover-wrap { width: 112px; min-width: 112px; }
  .cig-card-body { padding: .75rem .8rem; }
  .cig-gname { font-size: 15px; }
  .cig-actions { gap: 5px; }
  .cig-act { font-size: 12.5px; padding: 6px 10px; }
  .cig-bgg { margin-left: 0; }
}

/* ── MODALE ── */
.cig-modal-bg {
  position: fixed; inset: 0; background: rgba(36,40,58,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 99999; padding: 1rem;
}
.cig-modal-bg.hidden { display: none; }
.cig-modal {
  background: #fff; border-radius: 18px; padding: 1.5rem;
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto;
  font-size: 15px; box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.cig-modal-title {
  font-size: 19px; font-weight: 800; color: #24283a;
  margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.cig-modal-close {
  background: none; border: none; cursor: pointer;
  color: #525252; font-size: 22px; line-height: 1; padding: 0 2px;
}
.cig-regolo, .cig-regolo-scroll {
  background: #eef6fb; border-radius: 10px; border-left: 3px solid #1f6f99;
  padding: 10px 14px; font-size: 13.5px; color: #404040;
  line-height: 1.6; margin-bottom: .9rem;
}
.cig-regolo-scroll { max-height: 240px; overflow-y: auto; }
.cig-regolo strong, .cig-regolo-scroll strong { color: #24283a; }
.cig-regolo-scroll ul { margin: 4px 0 10px 18px; padding: 0; list-style: disc; }
.cig-regolo-scroll li { margin-bottom: 3px; }
.cig-regolo-scroll .art-h { font-weight: 700; color: #24283a; font-size: 14px; margin: 10px 0 3px; }
.cig-regolo-scroll .art-h:first-child { margin-top: 0; }
.cig-regolo-scroll p { margin: 0 0 6px; }
.cig-regolo-warn {
  background: #fff8e1; border-left: 3px solid #d0944a;
  border-radius: 10px; padding: 10px 14px; font-size: 13.5px;
  color: #5c4310; line-height: 1.6; margin-bottom: .9rem;
}
.cig-regolo-warn strong { color: #7a4a0b; }
.cig-accept-row {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 14px; color: #24283a; line-height: 1.5;
  cursor: pointer; margin-bottom: .25rem;
}
.cig-accept-row input { margin-top: 4px; flex-shrink: 0; width: 18px; height: 18px; accent-color: #24283a; }
.cig-fg { margin-bottom: .85rem; }
.cig-fg label { display: block; font-size: 13.5px; font-weight: 600; color: #404040; margin-bottom: 5px; }
.cig-fg input, .cig-fg textarea, .cig-fg select {
  width: 100%; padding: 9px 12px;
  border: 1px solid #d4d4d4; border-radius: 10px;
  font-family: inherit; font-size: 15px; outline: none; color: #24283a; background: #fff;
}
.cig-fg input:focus, .cig-fg textarea:focus, .cig-fg select:focus { border-color: #1f6f99; box-shadow: 0 0 0 3px #cfe6f2; }
.cig-fg input[readonly] { background: #eef6fb; color: #525252; }
.cig-fg textarea { resize: vertical; min-height: 64px; }
.cig-fr { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cig-hint { font-size: 12.5px; color: #525252; margin-top: 4px; }
.cig-sep { border: none; border-top: 1px solid #e5e5e5; margin: 1rem 0; }
.cig-mfooter { display: flex; justify-content: flex-end; gap: 8px; margin-top: 1.1rem; flex-wrap: wrap; }
.cig-cancel {
  font-family: inherit; font-size: 14px; font-weight: 600; padding: 9px 18px;
  border: 1px solid #d4d4d4; border-radius: 12px;
  cursor: pointer; background: #fff; color: #404040;
}
.cig-cancel:hover { background: #f5f5f5; }
.cig-confirm {
  font-family: inherit; font-size: 14px; font-weight: 600;
  padding: 9px 18px; border-radius: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  border: 1px solid #24283a; background: #24283a; color: #fff;
}
.cig-confirm:hover { background: #1f6f99; border-color: #1f6f99; }
.cig-confirm.danger { border-color: #a32d2d; background: #a32d2d; color: #fff; }
.cig-confirm:disabled { opacity: .45; cursor: not-allowed; }

/* Campi bloccati e ricerca BoardGameGeek: chiari come il resto (gli stili scuri sono iniettati dallo script) */
.cig-fg .cig-readonly { background: #eef6fb !important; color: #525252 !important; }
.cig-bgg-results.open { border: 1px solid #cfe6f2 !important; background: #fff !important; }
.cig-bgg-item { border-bottom: 1px solid #eef6fb !important; }
.cig-bgg-item:hover { background: #eef6fb !important; }
.cig-bgg-name { color: #24283a !important; }
.cig-bgg-year { color: #1f6f99 !important; }
.cig-bgg-loading, .cig-bgg-empty, .cig-label-note, .cig-act-note { color: #525252 !important; }

/* ── TOAST ── */
.cig-toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  background: #24283a; color: #fff;
  border-radius: 14px; padding: 12px 18px; font-size: 14px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  transform: translateY(80px); opacity: 0;
  transition: all .3s ease; z-index: 100000;
}
.cig-toast.show { transform: translateY(0); opacity: 1; }
.cig-dot { width: 9px; height: 9px; border-radius: 50%; background: #8cc6e4; flex-shrink: 0; }
.cig-toast.ok   .cig-dot { background: #5fd3a5; }
.cig-toast.warn .cig-dot { background: #d0944a; }
