/* =============================================================
   components.css — Botones, inputs, cards, pitch, modal, etc.
   5le Fantasy 2026
============================================================= */

/* ══════════════════════════════════════════════════════════
   BOTONES
══════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--space-2); padding: 0 var(--space-5);
  height: 42px; min-width: 80px;
  border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: 700;
  line-height: 1; white-space: nowrap;
  cursor: pointer; border: 1px solid transparent;
  user-select: none; text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--c-accent); color: #fff;
  border-color: var(--c-accent);
}
.btn-primary:hover { background: var(--c-accent-hover); border-color: var(--c-accent-hover); }

.btn-success {
  background: var(--c-success, #16a34a); color: #fff;
}
.btn-success:hover { filter: brightness(1.1); }

.btn-danger {
  background: var(--c-error); color: #fff;
}
.btn-danger:hover { filter: brightness(0.9); }

.btn-ghost {
  background: transparent; color: var(--c-text-muted);
  border-color: var(--c-border);
}
.btn-ghost:hover { background: var(--c-surface-2); color: var(--c-text); }

.btn-outline {
  background: transparent; color: var(--c-accent);
  border-color: var(--c-accent);
}
.btn-outline:hover { background: var(--c-accent-subtle); }

.btn-sm  { height: 32px; min-width: auto; padding: 0 var(--space-3); font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-xs  { height: 26px; min-width: auto; padding: 0 var(--space-2); font-size: 0.7rem; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }

/* ── Filtros / Orden ──────────────────────────────────────── */
.filter-btn, .sort-btn, .formation-btn {
  padding: var(--space-1) var(--space-3);
  height: 32px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 700;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2); color: var(--c-text-muted);
  cursor: pointer; white-space: nowrap;
}
.filter-btn:hover, .sort-btn:hover, .formation-btn:hover { color: var(--c-text); background: var(--c-surface-3); }
.filter-btn.active, .sort-btn.active {
  background: var(--c-accent-subtle); color: var(--c-accent);
  border-color: var(--c-accent-muted, var(--c-accent));
}
.formation-btn.active {
  background: var(--c-accent-subtle); color: var(--c-accent);
  border-color: var(--c-accent-muted, var(--c-accent));
}

/* ══════════════════════════════════════════════════════════
   INPUTS
══════════════════════════════════════════════════════════ */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
  height: 42px; padding: 0 var(--space-3);
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm); color: var(--c-text);
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea { height: auto; padding: var(--space-3); resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--c-text-faint); }
input:hover, textarea:hover { border-color: var(--c-text-muted); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px var(--c-accent-subtle);
}
.form-group { display: flex; flex-direction: column; gap: var(--space-2); }
.form-label { font-size: var(--text-sm); font-weight: 700; color: var(--c-text); }
.form-input {
  height: 40px; padding: 0 var(--space-3);
  background: var(--c-surface-2); border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md); font-size: var(--text-sm);
}
.form-input:focus { outline: none; border-color: var(--c-accent); box-shadow: 0 0 0 3px var(--c-accent-subtle); }
.form-hint { font-size: var(--text-xs); color: var(--c-text-muted); }
.contract-terms {
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-radius: var(--radius-md); padding: var(--space-3);
  font-size: var(--text-xs); color: var(--c-text-muted); min-height: 48px;
}

/* ══════════════════════════════════════════════════════════
   BADGES DE POSICIÓN
══════════════════════════════════════════════════════════ */
.pos-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 22px;
  border-radius: var(--radius-sm);
  font-size: 0.6rem; font-weight: 900;
  letter-spacing: 0.04em; flex-shrink: 0;
}
.pos-badge--gk  { background: rgba(245,158,11,0.15); color: var(--pos-gk); }
.pos-badge--def { background: rgba(59,130,246,0.15);  color: var(--pos-def); }
.pos-badge--mid { background: rgba(16,185,129,0.15);  color: var(--pos-mid); }
.pos-badge--fwd { background: rgba(239,68,68,0.15);   color: var(--pos-fwd); }

/* ══════════════════════════════════════════════════════════
   PLAYER CARDS (mercado)
══════════════════════════════════════════════════════════ */
.player-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-3);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.player-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: var(--c-accent-muted, var(--c-border));
}
.player-card--owned {
  border-left: 3px solid var(--c-accent);
  padding-left: calc(var(--space-4) - 2px);
}

.player-card-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: var(--space-2);
}
.player-name {
  font-size: var(--text-sm); font-weight: 800;
  line-height: 1.3; color: var(--c-text);
}
.player-value {
  font-size: var(--text-base); font-weight: 800;
  color: var(--c-accent); font-variant-numeric: tabular-nums;
}
.player-clause {
  font-size: var(--text-xs); color: var(--c-text-muted);
  font-variant-numeric: tabular-nums;
}
/* ── Player card modo foto ── */
.player-card.photo-mode {
  padding: 0;
  overflow: hidden;
  gap: 0;
}
.player-card.photo-mode .player-card-photo {
  width: 100%; height: 160px;        /* más alto para no cortar la cara */
  overflow: hidden; position: relative;
  flex-shrink: 0;
}
.player-card.photo-mode .player-card-photo img {
  width: 100%; height: 100%;
  object-fit: contain;               /* contener sin recortar */
  object-position: center top;
  background: var(--c-surface-2);
  display: block;
}
.player-card.photo-mode .player-card-photo-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(transparent 60%, var(--c-surface));
}
.player-card.photo-mode .player-card-body {
  padding: var(--space-3) var(--space-4) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2);
}

/* ── Vistas lista/mosaico ── */
.view-toggle {
  display: flex; gap: var(--space-1);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  padding: 2px;
}
.view-toggle-btn {
  width: 32px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  border: none; background: transparent;
  color: var(--c-text-muted); cursor: pointer;
  font-size: 0.85rem; transition: all var(--transition);
}
.view-toggle-btn.active {
  background: var(--c-surface);
  color: var(--c-accent);
  box-shadow: var(--shadow-sm);
}

/* Grid mosaico de jugadores */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
}
.players-grid .player-card {
  min-width: 0;
}

/* Vista lista compacta */
.players-list-row {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--c-divider);
  transition: background var(--transition);
}
.players-list-row:hover { background: var(--c-surface-2); }
.players-list-row:last-child { border-bottom: none; }

/* ── Barra de felicidad ───────────────────────────────────── */
.happiness-row {
  display: flex; align-items: center; gap: var(--space-2);
}
.happiness-bar {
  flex: 1; height: 6px;
  background: var(--c-surface-3);
  border-radius: var(--radius-full); overflow: hidden;
}
.happiness-fill {
  height: 100%; border-radius: var(--radius-full);
  background: var(--c-accent);
  transition: width 0.6s cubic-bezier(0.16,1,0.3,1);
}
.happiness-fill--mid { background: var(--c-warning, #d97706); }
.happiness-fill--low { background: var(--c-error, #dc2626); }
.happiness-pct {
  font-size: var(--text-xs); font-weight: 700;
  color: var(--c-text-muted); min-width: 2.5ch;
  text-align: right; font-variant-numeric: tabular-nums;
}

/* ══════════════════════════════════════════════════════════
   CAMPO DE FÚTBOL
══════════════════════════════════════════════════════════ */
.formation-bar {
  display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap;
}
.formation-label {
  font-size: var(--text-xs); color: var(--c-text-muted); font-weight: 700;
  margin-right: var(--space-1);
}

.pitch {
  background: linear-gradient(180deg, #2a7a4a 0%, #35904f 50%, #2a7a4a 100%);
  background-image:
    repeating-linear-gradient(
      180deg, transparent 0px, transparent 44px,
      rgba(0,0,0,0.05) 44px, rgba(0,0,0,0.05) 88px
    ),
    linear-gradient(180deg, #2a7a4a 0%, #35904f 50%, #2a7a4a 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-4);
  position: relative;
  display: flex; flex-direction: column; gap: var(--space-3);
  min-height: 460px;
  border: 3px solid rgba(255,255,255,0.18);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.pitch-overlay { position: absolute; inset: 0; pointer-events: none; }
.pitch-center-line {
  position: absolute; left: 5%; right: 5%; top: 50%;
  height: 1px; background: rgba(255,255,255,0.22);
}
.pitch-center-circle {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 66px; height: 66px;
  border: 1.5px solid rgba(255,255,255,0.22);
  border-radius: 50%;
}
.pitch-penalty-top {
  position: absolute; left: 28%; right: 28%; top: 2%;
  height: 17%; border: 1.5px solid rgba(255,255,255,0.18);
  border-top: none;
}
.pitch-penalty-bot {
  position: absolute; left: 28%; right: 28%; bottom: 2%;
  height: 17%; border: 1.5px solid rgba(255,255,255,0.18);
  border-bottom: none;
}

.pitch-row {
  display: flex; justify-content: space-around;
  align-items: center; gap: var(--space-2);
  position: relative; z-index: 1;
}
.pitch-row-label {
  position: absolute; left: 4px;
  font-size: 0.55rem; font-weight: 700;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase; letter-spacing: 0.08em;
  writing-mode: vertical-lr; transform: rotate(180deg);
}

.player-slot {
  width: 68px; height: 76px;
  border: 2px dashed rgba(255,255,255,0.3);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; font-size: 0.6rem; font-weight: 600;
  color: rgba(255,255,255,0.45); gap: 3px;
  background: rgba(0,0,0,0.08);
  transition: all var(--transition);
  cursor: default; user-select: none;
}
.player-slot .slot-role { font-size: 0.55rem; text-transform: uppercase; letter-spacing: 0.08em; }
.player-slot.drag-over { background: rgba(74,222,128,0.25); border-color: rgba(74,222,128,0.8); border-style: solid; }
.player-slot.occupied {
  background: rgba(255,255,255,0.12); border-style: solid;
  border-color: rgba(255,255,255,0.55); color: white;
  cursor: grab; box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.player-slot.occupied:active { cursor: grabbing; }
.player-slot.occupied:hover { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.8); transform: scale(1.04); }
.slot-jersey { font-size: 1.2rem; line-height: 1; }
.slot-name { font-size: 0.58rem; font-weight: 700; line-height: 1.2; max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot-pts  { font-size: 0.55rem; color: rgba(74,222,128,0.9); font-weight: 700; }

.player-slot.photo-view {
  padding: 0;
  overflow: hidden;
}
.player-slot.photo-view .slot-name {
  font-size: 0.52rem;
  max-width: 100%;
}

/* Banquillo */
.bench-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl); padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.bench-title { font-size: var(--text-sm); font-weight: 700; margin-bottom: var(--space-3); color: var(--c-text-muted); }
.bench-list { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.bench-player {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-radius: var(--radius-lg); font-size: var(--text-xs); font-weight: 700;
  cursor: grab; transition: all var(--transition); user-select: none;
}
.bench-player:hover { background: var(--c-surface-3); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.bench-player:active { cursor: grabbing; }
.bench-player.dragging { opacity: 0.5; }

/* ══════════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════════ */
.modal {
  border: none; padding: 0; background: transparent;
  max-width: 480px; width: calc(100% - var(--space-8));
  border-radius: var(--radius-2xl); box-shadow: var(--shadow-xl);
}
.modal::backdrop {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
}
.modal-inner {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-2xl);
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-3); padding: var(--space-5);
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface-2);
}
.modal-title { font-size: var(--text-lg); font-weight: 800; }
.modal-subtitle { font-size: var(--text-xs); color: var(--c-text-muted); margin-top: 2px; }
.modal-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: var(--radius-md);
  color: var(--c-text-muted); border: 1px solid var(--c-border);
  background: var(--c-surface); cursor: pointer;
}
.modal-close:hover { background: var(--c-surface-3); color: var(--c-error); }
.modal-body {
  padding: var(--space-5);
  display: flex; flex-direction: column; gap: var(--space-4);
  max-height: 60vh; overflow-y: auto;
}
.modal-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--c-border);
  display: flex; justify-content: flex-end; gap: var(--space-3);
  background: var(--c-surface-2);
}
.modal-happiness { display: flex; flex-direction: column; gap: var(--space-2); }

/* ══════════════════════════════════════════════════════════
   SKELETONS
══════════════════════════════════════════════════════════ */
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.skeleton {
  background: linear-gradient(
    90deg,
    var(--c-surface-2) 25%,
    var(--c-surface-3) 50%,
    var(--c-surface-2) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
.skeleton-card     { height: 148px; border-radius: var(--radius-xl); }
.skeleton-row      { height: 46px;  border-radius: var(--radius-md); }
.skeleton-activity { height: 50px;  border-radius: var(--radius-lg); }

/* ══════════════════════════════════════════════════════════
   EMPTY / ERROR
══════════════════════════════════════════════════════════ */
.empty-hint {
  text-align: center; color: var(--c-text-faint);
  font-size: var(--text-sm); padding: var(--space-10) 0; max-width: none;
}
.empty-hint.small { padding: var(--space-6) 0; }

.error-inline {
  color: var(--c-error); font-size: var(--text-sm);
  padding: var(--space-3) var(--space-4);
  background: var(--c-error-subtle); border-radius: var(--radius-md);
  max-width: none;
}

/* ══════════════════════════════════════════════════════════
   STAT LABEL en modal/squad
══════════════════════════════════════════════════════════ */
.stat-label-sm { font-size: var(--text-xs); font-weight: 700; color: var(--c-text-muted); display: block; margin-bottom: var(--space-1); }

/* ── Podium mejorado ── */
.podium-item--me {
  background: var(--c-accent-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-1) var(--space-2);
  margin: 0 calc(-1 * var(--space-2));
}
.podium-item--me .podium-name { color: var(--c-accent); }
.podium-item--me .podium-pts  { color: var(--c-accent); }

/* ── Mini player list mejorada ── */
.mini-player-name {
  flex: 1; font-size: var(--text-sm); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.mini-player-pts {
  font-size: var(--text-sm); font-weight: 700;
  color: var(--c-accent); font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* ── Stats row ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.stat-card {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-xl);
  padding: var(--space-3) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-1);
  min-width: 0; overflow: hidden;
}

.stat-label {
  font-size: var(--text-xs); font-weight: 700;
  color: var(--c-text-muted); text-transform: uppercase;
  letter-spacing: 0.05em; white-space: nowrap;
}

.stat-value {
  font-size: clamp(var(--text-base), 2.5vw, var(--text-xl));
  font-weight: 800;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  word-break: break-all;
}

.stat-value--blue  { color: var(--c-link, #3b82f6); }
.stat-value--green { color: var(--c-accent); }
.stat-value--red   { color: var(--c-error, #dc2626); }