/* frontend/css/modulos.css
   Estilos de los módulos Jugadas (Playbook) y Evaluaciones.
   Usan los tokens del tema actual (variables.css / theme.css) para integrarse
   con el resto de la app, NO Tailwind. */

/* ── Refuerzo del APP SHELL ───────────────────────────────────────────────
   Garantiza el layout de columnas (sidebar + contenido) aunque una versión
   antigua de layout.css quede en caché. modulos.css se carga al final. */
.app { display: flex; height: 100vh; overflow: hidden; }
.app > .sidebar { flex-shrink: 0; }
.app > .content { flex: 1 1 auto; min-width: 0; overflow-y: auto; overflow-x: hidden; }
@media (max-width: 900px) {
  .app { display: block; height: auto; overflow: visible; }
  .app > .content { overflow: visible; }
}

/* ── Stats row reutilizable ─────────────────────────────────────────────── */
.mod-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 800px) { .mod-stats-row { grid-template-columns: 1fr 1fr; } }
.mod-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 16px;
}
.mod-stat-lbl {
  font-size: 11px; font-weight: 700; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase;
}
.mod-stat-val { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; margin-top: 6px; }
.mod-stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ── Filtros tipo pill (reusa estética de pagos-filter-pill) ─────────────── */
.mod-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.mod-pill {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 7px 16px; border-radius: 999px; cursor: pointer; transition: all .15s;
}
.mod-pill:hover { color: var(--text); }
.mod-pill.active { background: var(--g); color: #fff; border-color: var(--g); }

/* ── Grid de tarjetas ───────────────────────────────────────────────────── */
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

/* ── JUGADAS: tarjeta de jugada ─────────────────────────────────────────── */
.play-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; transition: box-shadow .15s, transform .15s;
}
.play-card:hover { box-shadow: 0 8px 22px rgba(0,0,0,.07); transform: translateY(-3px); }
.play-diagram {
  height: 150px; border-bottom: 1px solid var(--border); position: relative;
  display: flex; align-items: center; justify-content: center; padding: 10px;
  background-image: radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 18px 18px;
}
.play-tag {
  position: absolute; top: 10px; right: 10px; font-size: 10px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px;
}
.play-tag.offense { background: rgba(26,122,74,.14); color: var(--g); }
.play-tag.defense { background: rgba(186,26,26,.12); color: var(--red); }
.play-tag.special { background: var(--gl); color: var(--muted); }
.play-body { padding: 14px; display: flex; flex-direction: column; flex: 1; }
.play-name { font-weight: 700; color: var(--text); font-size: 15px; }
.play-formation { font-size: 12px; color: var(--muted); margin-top: 2px; }
.play-metrics {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.play-metric-lbl { font-size: 10px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.play-metric-val { font-size: 16px; font-weight: 800; color: var(--g); }
.play-fav { position: absolute; top: 10px; left: 10px; color: var(--muted); }
.play-fav.on { color: #e0a800; }

/* Tarjeta "agregar" */
.mod-add-card {
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px; gap: 8px; cursor: pointer; color: var(--muted);
  min-height: 240px; transition: all .15s; text-align: center;
}
.mod-add-card:hover { border-color: var(--g); color: var(--g); background: rgba(26,122,74,.04); }
.mod-add-card .msym { font-size: 30px; }

/* ── Detalle de jugada (modal ancho) ────────────────────────────────────── */
.play-detail-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; padding: 18px; }
@media (max-width: 820px) { .play-detail-grid { grid-template-columns: 1fr; } }
.play-canvas {
  background: var(--surface2, #f2f5ec); border: 1px solid var(--border);
  border-radius: var(--radius-md); min-height: 280px; position: relative; overflow: hidden;
  background-image: radial-gradient(var(--border) 1px, transparent 1px); background-size: 22px 22px;
}
.unit-card { border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 10px; overflow: hidden; }
.unit-hd { background: var(--gl); padding: 10px 14px; display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.unit-badge { width: 30px; height: 30px; border-radius: 50%; background: var(--g); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; }
.unit-body { padding: 12px 14px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; }

/* ── EVALUACIONES: tarjeta de jugador ───────────────────────────────────── */
.eval-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px; display: flex; align-items: center; gap: 14px;
  transition: box-shadow .15s;
}
.eval-card:hover { box-shadow: 0 6px 16px rgba(0,0,0,.05); }
.eval-avatar {
  width: 52px; height: 52px; border-radius: 12px; background: var(--g); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px; flex-shrink: 0;
}
.eval-info { flex: 1; min-width: 0; }
.eval-name { font-weight: 700; color: var(--text); }
.eval-meta { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.eval-impact { text-align: center; padding: 0 8px; }
.eval-impact-lbl { font-size: 9px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; }
.eval-impact-val { font-size: 22px; font-weight: 800; color: var(--g); line-height: 1; }
.eval-impact-val.none { color: var(--muted); }
.eval-btn {
  border: none; border-radius: var(--radius-md); padding: 10px 14px; font-family: var(--font);
  font-size: 12px; font-weight: 700; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 2px; min-width: 88px; transition: opacity .15s;
}
.eval-btn .msym { font-size: 18px; }
.eval-btn.primary { background: var(--g); color: #fff; }
.eval-btn.ghost { background: var(--gl); color: var(--muted); }
.eval-btn:hover { opacity: .9; }

/* Formulario de evaluación (sliders) */
.eval-slider-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.eval-slider-head { display: flex; justify-content: space-between; align-items: center; }
.eval-slider-head label { font-size: 14px; font-weight: 600; color: var(--text); }
.eval-slider-val { color: var(--g); font-weight: 800; min-width: 34px; text-align: right; }
.eval-slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 5px;
  background: var(--border); border-radius: 3px; outline: none;
}
.eval-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  background: var(--g); cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.eval-slider::-moz-range-thumb { width: 20px; height: 20px; border: none; border-radius: 50%; background: var(--g); cursor: pointer; }
.eval-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.eval-tag {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
}
.eval-tag.on { border-color: var(--g); color: var(--g); background: rgba(26,122,74,.06); }
.eval-overall {
  display: flex; align-items: center; gap: 10px;
}
.eval-overall-badge {
  width: 44px; height: 44px; border-radius: var(--radius-md); background: var(--g); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800;
}
.eval-section-title { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 6px 0; }

/* ══════════ CALENDARIO ══════════ */
.cal-layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
@media (max-width: 1000px) { .cal-layout { grid-template-columns: 1fr; } }
.cal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.cal-hd { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.cal-nav-btn { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-md); width: 34px; height: 34px; cursor: pointer; color: var(--muted); }
.cal-nav-btn:hover { color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-dow { padding: 10px 0; text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .05em; border-bottom: 1px solid var(--border); }
.cal-day { min-height: 96px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; position: relative; cursor: pointer; transition: background .12s; }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day:hover { background: var(--gl); }
.cal-day.empty { background: var(--gl); opacity: .5; cursor: default; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--g); }
.cal-day-num { font-size: 11px; font-weight: 700; color: var(--muted); }
.cal-day.today .cal-day-num { color: var(--g); }
.cal-event { font-size: 10px; font-weight: 700; color: #fff; padding: 2px 5px; border-radius: 4px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.training { background: var(--g); }
.cal-event.meeting  { background: #6b1d3d; }
.cal-event.cond     { background: var(--muted); }
.cal-event.match    { background: #2563eb; }
/* Responsive: en teléfonos las 7 columnas quedan muy angostas; se reducen
   celdas, numeración y eventos para que sigan siendo legibles/tocables. */
@media (max-width: 560px) {
  .cal-day { min-height: 62px; padding: 3px; }
  .cal-day-num { font-size: 10px; }
  .cal-event { font-size: 9px; padding: 1px 3px; margin-top: 2px; }
  .cal-dow { font-size: 9px; padding: 6px 0; }
}

/* ══════════ ANALYTICS ══════════ */
.an-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 900px) { .an-grid { grid-template-columns: 1fr; } }
.an-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.an-card-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.an-bars { height: 200px; display: flex; align-items: flex-end; gap: 10px; }
.an-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.an-bar { width: 100%; background: var(--g); border-radius: 6px 6px 0 0; transition: opacity .15s; min-height: 4px; }
.an-bar:hover { opacity: .8; }
.an-bar-lbl { font-size: 11px; color: var(--muted); font-weight: 600; }
.an-donut-wrap { display: flex; flex-direction: column; align-items: center; }
.an-donut { position: relative; width: 150px; height: 150px; }
.an-donut .center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.an-donut .center .val { font-size: 26px; font-weight: 800; color: var(--text); }
.an-donut .center .lbl { font-size: 11px; color: var(--muted); }
.an-rank-table { width: 100%; border-collapse: collapse; }
.an-rank-table th { text-align: left; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.an-rank-table td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
.an-rank-pos { width: 28px; height: 28px; border-radius: 50%; background: var(--gl); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; color: var(--text); }

/* ══════════ COMUNICACIONES ══════════ */
.cm-layout { display: grid; grid-template-columns: 300px 1fr; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; height: 70vh; background: var(--surface); }
@media (max-width: 800px) { .cm-layout { grid-template-columns: 1fr; } .cm-thread { display: none; } }
.cm-list { border-right: 1px solid var(--border); overflow-y: auto; }
.cm-item { padding: 14px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 10px; }
.cm-item:hover, .cm-item.active { background: var(--gl); }
.cm-avatar { width: 42px; height: 42px; border-radius: 12px; background: var(--g); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.cm-thread { display: flex; flex-direction: column; }
.cm-msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.cm-bubble { max-width: 70%; padding: 10px 14px; border-radius: 14px; font-size: 14px; }
.cm-bubble.them { background: var(--gl); color: var(--text); align-self: flex-start; border-bottom-left-radius: 4px; }
.cm-bubble.me { background: var(--g); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.cm-input { border-top: 1px solid var(--border); padding: 12px; display: flex; gap: 8px; }

/* ══════════ INVENTARIO ══════════ */
.inv-status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.inv-status.ok   { background: rgba(26,122,74,.12); color: var(--g); }
.inv-status.pend { background: rgba(180,83,9,.12); color: #b45309; }
.inv-status.dmg  { background: rgba(186,26,26,.12); color: var(--red); }
.inv-status.store{ background: var(--gl); color: var(--muted); }
.inv-bar { width: 90px; height: 5px; background: var(--gl); border-radius: 3px; overflow: hidden; }
.inv-bar > div { height: 100%; background: var(--g); }
.inv-bar.low > div { background: var(--red); }

/* ══════════ VIDEO TÁCTICO ══════════ */
.vid-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; cursor: pointer; transition: box-shadow .15s; }
.vid-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.07); }
.vid-thumb { height: 150px; background: #14210f; position: relative; display: flex; align-items: center; justify-content: center; }
.vid-thumb .play { width: 52px; height: 52px; border-radius: 50%; background: rgba(255,255,255,.18); color: #fff; display: flex; align-items: center; justify-content: center; }
.vid-tagcount { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.vid-body { padding: 14px; }
.vid-detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; padding: 18px; }
@media (max-width: 860px) { .vid-detail-grid { grid-template-columns: 1fr; } }
.vid-player { aspect-ratio: 16/9; background: #14210f; border-radius: var(--radius-md); position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.vid-player .play-big { width: 72px; height: 72px; border-radius: 50%; background: var(--g); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.vid-tag { display: flex; gap: 10px; padding: 10px; border-radius: var(--radius-md); border-left: 4px solid var(--g); background: var(--gl); margin-bottom: 8px; cursor: pointer; }
.vid-tag.warn { border-left-color: var(--red); }
.vid-tag.info { border-left-color: var(--muted); }
.vid-tag-time { font-weight: 800; color: var(--g); min-width: 44px; font-size: 13px; }
.vid-tag.warn .vid-tag-time { color: var(--red); }
.vid-feedback { border: 1px solid var(--border); border-radius: var(--radius-md); display: flex; flex-direction: column; max-height: 280px; }
.vid-fb-msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.vid-fb-bubble { max-width: 85%; padding: 8px 12px; border-radius: 12px; font-size: 13px; }
.vid-fb-bubble.coach { background: var(--gl); align-self: flex-start; }
.vid-fb-bubble.me { background: var(--g); color: #fff; align-self: flex-end; }
.vid-fb-input { border-top: 1px solid var(--border); padding: 8px; display: flex; gap: 6px; }

/* ══════════ LIVE TACTICAL HUB ══════════ */
.live-grid { display: grid; grid-template-columns: 1.5fr 1fr 260px; gap: 12px; align-items: stretch; }
@media (max-width: 1100px) { .live-grid { grid-template-columns: 1fr; } }
.live-video { position: relative; border-radius: var(--radius-lg); overflow: hidden; background: #0c150a; min-height: 320px; display: flex; align-items: center; justify-content: center; }
.live-video .hud { position: absolute; inset: 0; pointer-events: none; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; }
.live-pill { background: rgba(0,0,0,.5); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; backdrop-filter: blur(6px); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: livepulse 1.2s infinite; }
@keyframes livepulse { 50% { opacity: .35; } }
.live-glass { background: rgba(12,21,10,.72); border: 1px solid rgba(192,201,187,.25); color: #fff; border-radius: 10px; padding: 8px 12px; backdrop-filter: blur(8px); }
.live-hud-row { display: flex; gap: 16px; justify-content: center; }
.live-hud-stat { text-align: center; color: #fff; }
.live-hud-stat .v { color: var(--primary-fixed, #91d78a); font-weight: 800; }
.live-hud-stat .l { font-size: 10px; opacity: .7; text-transform: uppercase; letter-spacing: .05em; }

.live-board { border-radius: var(--radius-lg); border: 1px solid var(--border); background: #0c5216; position: relative; overflow: hidden; min-height: 320px; cursor: crosshair; }
.live-board .field-line { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid rgba(255,255,255,.25); }
.live-board .field-line.dash { border-top: 1px dashed rgba(255,255,255,.18); }
.live-token { position: absolute; width: 34px; height: 34px; border-radius: 50%; border: 2px solid #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; transform: translate(-50%,-50%); box-shadow: 0 2px 6px rgba(0,0,0,.4); cursor: grab; user-select: none; }
.live-token.O { background: #ba1a1a; }
.live-token.X { background: #1b5e20; }
.live-token.D { background: #2563eb; }
.live-toolbar { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; background: rgba(20,33,15,.9); padding: 6px; border-radius: 12px; border: 1px solid rgba(255,255,255,.15); }
.live-tool { width: 38px; height: 38px; border-radius: 8px; border: none; background: transparent; color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.live-tool.active { background: var(--g); }
.live-side { display: flex; flex-direction: column; gap: 12px; }
.live-side .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; }
.live-note { background: var(--gl); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.live-note .t { font-size: 11px; font-weight: 700; color: var(--g); }
.live-timeline { position: relative; height: 8px; background: var(--gl); border-radius: 5px; margin: 18px 0 6px; }
.live-tl-prog { position: absolute; left: 0; top: 0; bottom: 0; background: var(--g); border-radius: 5px; }
.live-tl-mark { position: absolute; top: -4px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; transform: translateX(-50%); cursor: pointer; }
