/* ==========================================================================
   CSTV SPORT — PORTAL DE ALINEACIONES PARA DIRECTORES TÉCNICOS (DT)
   Diseño Mobile-First + Escritorio para uso rápido desde celular o PC.
   ========================================================================== */

:root {
  --dt-bg: #060d1c;
  --dt-panel: #0e1b33;
  --dt-card: #132545;
  --dt-input: #081225;
  --dt-border: #253f6e;
  --dt-blue: #1d63ff;
  --dt-cyan: #38bdf8;
  --dt-gold: #f5b942;
  --dt-green: #10b981;
  --dt-danger: #ef4444;
  --dt-text: #f1f5f9;
  --dt-muted: #93aac9;
  --font-display: 'Barlow Condensed', 'Oswald', 'Arial Narrow', sans-serif;
  --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 0%, rgba(29, 99, 255, 0.2), transparent 45%), var(--dt-bg);
  color: var(--dt-text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
}

button, input, select {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

.dt-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(6, 13, 28, 0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--dt-border);
  padding: 12px 16px;
}

.dt-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dt-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.dt-brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d63ff, #0a2d75 65%, #f5b942);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 19px;
  color: #fff;
}

.dt-brand h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1;
}

.dt-brand h1 span {
  color: var(--dt-gold);
}

.dt-brand small {
  font-size: 11px;
  color: var(--dt-muted);
  display: block;
}

.dt-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 48px;
}

.card {
  background: linear-gradient(180deg, var(--dt-panel), #0a1529);
  border: 1px solid var(--dt-border);
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  margin-bottom: 16px;
}

.card-header {
  padding: 12px 16px;
  background: rgba(19, 37, 69, 0.72);
  border-bottom: 1px solid var(--dt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.card-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.card-body {
  padding: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 15px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
  background: var(--dt-card);
  border: 1px solid var(--dt-border);
  color: #fff;
  transition: filter 0.15s ease, transform 0.08s ease;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.12);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #1d63ff, #1240a8);
  border-color: #60a5fa;
}

.btn-gold {
  background: linear-gradient(135deg, #f5b942, #c98612);
  border-color: #fde68a;
  color: #09111f;
}

.btn-success {
  background: linear-gradient(135deg, #10b981, #047857);
  border-color: #6ee7b7;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #991b1b);
  border-color: #fca5a5;
}

.btn-sm {
  padding: 7px 11px;
  font-size: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dt-muted);
}

.input, .select {
  width: 100%;
  background: var(--dt-input);
  border: 1px solid var(--dt-border);
  border-radius: 9px;
  padding: 10px 12px;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.input:focus, .select:focus {
  border-color: var(--dt-cyan);
}

/* Login */
.login-card {
  max-width: 460px;
  margin: 28px auto;
}

.demo-hint {
  background: rgba(245, 185, 66, 0.12);
  border: 1px solid rgba(245, 185, 66, 0.45);
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 12px;
  color: #fde68a;
  margin-top: 12px;
}

/* Estados de alineación */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-badge.none { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; border: 1px solid #475569; }
.status-badge.draft { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; border: 1px solid #38bdf8; }
.status-badge.submitted { background: rgba(245, 185, 66, 0.18); color: #fde68a; border: 1px solid #f5b942; }
.status-badge.approved { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; border: 1px solid #10b981; }
.status-badge.rejected { background: rgba(239, 68, 68, 0.18); color: #fca5a5; border: 1px solid #ef4444; }

/* Lista de partidos del club */
.matches-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 10px;
}

.match-pick-card {
  text-align: left;
  background: var(--dt-input);
  border: 1px solid var(--dt-border);
  border-radius: 11px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.match-pick-card.active {
  border-color: var(--dt-gold);
  box-shadow: 0 0 0 2px rgba(245, 185, 66, 0.25);
  background: #102140;
}

.match-pick-teams {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  text-transform: uppercase;
  color: #fff;
}

/* Editor táctico */
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.toolbar-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: end;
  margin-bottom: 14px;
}

/* Cancha visual de fútbol */
.pitch-container {
  position: relative;
  width: 100%;
  aspect-ratio: 68 / 92;
  max-height: 680px;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.35);
  background:
    repeating-linear-gradient(
      180deg,
      #14532d 0%,
      #14532d 10%,
      #166534 10%,
      #166534 20%
    );
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45);
}

/* Líneas de la cancha */
.pitch-lines {
  position: absolute;
  inset: 14px;
  border: 2px solid rgba(255, 255, 255, 0.52);
  border-radius: 4px;
  pointer-events: none;
}

.pitch-midline {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 2px;
  background: rgba(255, 255, 255, 0.52);
}

.pitch-circle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.52);
  border-radius: 50%;
}

.pitch-box-top, .pitch-box-bottom {
  position: absolute;
  left: 50%;
  width: 52%;
  height: 15%;
  transform: translateX(-50%);
  border: 2px solid rgba(255, 255, 255, 0.52);
}

.pitch-box-top {
  top: -2px;
  border-top: none;
}

.pitch-box-bottom {
  bottom: -2px;
  border-bottom: none;
}

/* Fichas de jugadores en la cancha */
.pitch-slot {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  z-index: 4;
  padding: 2px;
}

.slot-disc {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d63ff, #0a2d75);
  border: 2px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55);
}

.pitch-slot.empty .slot-disc {
  background: rgba(7, 17, 36, 0.78);
  border: 2px dashed rgba(255, 255, 255, 0.7);
  color: #cbd5e1;
}

.pitch-slot.is-gk .slot-disc {
  background: linear-gradient(135deg, #f59e0b, #b45309);
  border-color: #fef08a;
}

.pitch-slot.swap-selected .slot-disc {
  outline: 4px solid #38bdf8;
  transform: scale(1.1);
}

.captain-tag {
  position: absolute;
  top: -5px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--dt-gold);
  color: #09111f;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #fff;
}

.slot-name-pill {
  background: rgba(4, 11, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  max-width: 112px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pitch-slot.empty .slot-name-pill {
  color: #fde68a;
  border-color: rgba(245, 185, 66, 0.55);
}

/* Lista de suplentes */
.subs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}

.sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--dt-input);
  border: 1px solid var(--dt-border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

.sub-item.is-selected {
  border-color: var(--dt-green);
  background: rgba(16, 185, 129, 0.12);
}

.sub-item.is-starter {
  opacity: 0.45;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(3, 8, 18, 0.84);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-box {
  width: min(460px, 100%);
  background: var(--dt-panel);
  border: 1px solid var(--dt-border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 22px 54px rgba(0, 0, 0, 0.65);
}

.modal-header {
  padding: 13px 16px;
  background: var(--dt-card);
  border-bottom: 1px solid var(--dt-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-family: var(--font-display);
  font-size: 20px;
  text-transform: uppercase;
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  padding: 12px 16px;
  background: rgba(8, 16, 32, 0.72);
  border-top: 1px solid var(--dt-border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 120;
  background: #0f2042;
  border: 1px solid var(--dt-cyan);
  color: #fff;
  padding: 11px 15px;
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.toast.error {
  border-color: var(--dt-danger);
  background: #3d0d14;
}

@media (max-width: 880px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .pitch-slot {
    width: 86px;
  }
  .slot-disc {
    width: 38px;
    height: 38px;
    font-size: 16px;
  }
  .slot-name-pill {
    font-size: 10px;
    max-width: 86px;
  }
}
