/* EHIS EDITOR - Stylesheet */
:root {
  --bg-primary: #0a0c10;
  --bg-secondary: #121620;
  --bg-card: rgba(22, 27, 39, 0.85);
  --bg-card-hover: rgba(30, 37, 52, 0.95);
  --border-color: rgba(255, 255, 255, 0.1);
  --border-focus: #00e5ff;
  
  --speccy-cyan: #00e5ff;
  --speccy-magenta: #ff0055;
  --speccy-yellow: #ffd600;
  --speccy-green: #00e676;
  --speccy-blue: #2979ff;
  --speccy-red: #ff1744;
  
  --pitch-green: #14532d;
  --pitch-lines: rgba(255, 255, 255, 0.4);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 15% 15%, rgba(0, 229, 255, 0.05) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(255, 0, 85, 0.04) 0%, transparent 40%);
}

/* NAVBAR */
header {
  background: rgba(18, 22, 32, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  padding: 8px 18px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.retro-badge {
  background: #111;
  border-left: 4px solid var(--speccy-magenta);
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 1px;
  color: var(--speccy-yellow);
  font-weight: 700;
  text-transform: uppercase;
}

.logo-text h1 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-text h1 span {
  color: var(--speccy-cyan);
}

.logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ACTION BUTTONS */
.actions-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  background: var(--bg-card);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.btn:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, #00b0ff, #00e5ff);
  color: #05101a;
  border: none;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.45);
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-magenta {
  background: linear-gradient(135deg, #d81b60, #ff0055);
  color: #ffffff;
  border: none;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(255, 0, 85, 0.3);
}

.btn-magenta:hover {
  box-shadow: 0 6px 20px rgba(255, 0, 85, 0.45);
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-sound {
  padding: 8px 12px;
  font-size: 1rem;
}

.btn-sound.muted {
  opacity: 0.5;
}

.btn-help {
  padding: 8px 12px;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--speccy-yellow);
  border-color: rgba(255, 214, 0, 0.4);
}

.btn-help:hover {
  background: rgba(255, 214, 0, 0.15);
  border-color: var(--speccy-yellow);
  box-shadow: 0 0 10px rgba(255, 214, 0, 0.4);
}

/* ACTION DROPDOWNS */
.dropdown-wrapper {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  user-select: none;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #111622;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.7), 0 0 10px rgba(0, 229, 255, 0.15);
  min-width: 220px;
  display: none;
  flex-direction: column;
  padding: 6px;
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.dropdown-menu.show {
  display: flex;
}

.dropdown-item {
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 9px 12px;
  border-radius: 5px;
  text-align: left;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.dropdown-item:hover {
  background: rgba(0, 229, 255, 0.12);
  color: var(--speccy-cyan);
}

/* MAIN CONTAINER */
main {
  max-width: 1400px;
  margin: 10px auto 14px auto;
  padding: 0 16px;
  flex: 1;
  width: 100%;
}

/* TEAM SELECTOR TABS */
.team-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

.team-tab {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.team-tab::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: transparent;
  transition: background 0.2s;
}

.team-tab:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.team-tab.active {
  background: rgba(0, 229, 255, 0.08);
  border-color: var(--speccy-cyan);
}

.team-tab.active::before {
  background: var(--speccy-cyan);
}

.team-tab-idx {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.team-tab-name {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* TEAM INFO BAR */
.team-meta-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 16px;
}

.meta-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.meta-field label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--speccy-cyan);
}

.input-retro {
  background: #0d111a;
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.2s;
}

.team-meta-bar select.input-retro,
.team-meta-bar input.input-retro {
  height: 32px;
  box-sizing: border-box;
  padding: 0 10px;
  line-height: 30px;
  font-size: 0.88rem;
  display: inline-block;
  vertical-align: middle;
}

.team-select-input {
  width: 175px;
  min-width: 160px;
  max-width: 190px;
  color: var(--speccy-cyan);
  cursor: pointer;
}

.short-name-input {
  width: 135px;
  min-width: 120px;
  max-width: 150px;
}

.input-retro:focus {
  border-color: var(--speccy-cyan);
  box-shadow: 0 0 0 2px rgba(0, 229, 255, 0.2);
}

.quick-tools {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.quick-tools .btn {
  height: 32px;
  box-sizing: border-box;
  padding: 0 12px;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* WORKSPACE GRID: DOS COLUMNAS */
.editor-grid {
  display: grid;
  grid-template-columns: 410px 1fr;
  gap: 16px;
  align-items: start;
}

.main-right-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

@media (max-width: 1024px) {
  .editor-grid {
    grid-template-columns: 1fr;
  }
}

/* PITCH COLUMN */
.pitch-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  position: sticky;
  top: 90px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pitch-container {
  background: linear-gradient(180deg, #166534 0%, #14532d 100%);
  border: 2px solid var(--pitch-lines);
  border-radius: 8px;
  height: 476px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 25px rgba(0,0,0,0.5);
}

/* Field markings */
.pitch-center-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--pitch-lines);
  transform: translateY(-50%);
}

.pitch-center-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 90px;
  height: 90px;
  border: 2px solid var(--pitch-lines);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.pitch-penalty-top {
  position: absolute;
  top: 0;
  left: 50%;
  width: 140px;
  height: 60px;
  border: 2px solid var(--pitch-lines);
  border-top: none;
  transform: translateX(-50%);
}

.pitch-penalty-bottom {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 140px;
  height: 60px;
  border: 2px solid var(--pitch-lines);
  border-bottom: none;
  transform: translateX(-50%);
}

/* Player markers on pitch */
.pitch-player {
  position: absolute;
  transform: translate(-50%, -50%);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.2s, z-index 0.2s;
  z-index: 5;
}

.pitch-player:hover {
  transform: translate(-50%, -50%) scale(1.15);
  z-index: 10;
}

.pitch-player.selected .player-disc {
  box-shadow: 0 0 0 3px var(--speccy-yellow), 0 0 14px rgba(255, 214, 0, 0.8);
  transform: scale(1.1);
}

.player-disc {
  width: 28px;
  height: 28px;
  background: #111;
  border: 2px solid #fff;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: all 0.2s;
}

.player-disc.gk {
  background: #f59e0b;
  color: #000;
  border-color: #fef3c7;
}

.player-tag-name {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 600;
  white-space: nowrap;
  margin-top: 3px;
  letter-spacing: 0.3px;
}

.bench-section {
  margin-top: 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 6px;
  padding: 10px 12px;
}

.bench-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  margin-bottom: 6px;
}

.bench-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.bench-chip {
  background: #1c2230;
  border: 1px solid var(--border-color);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}

.bench-chip:hover {
  border-color: var(--speccy-cyan);
  background: #252e42;
}

.bench-chip.sub {
  border-left: 3px solid var(--speccy-yellow);
}

.bench-chip.res {
  border-left: 3px solid var(--text-dim);
  opacity: 0.75;
}

/* ROSTER TABLE COLUMN */
.roster-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 18px;
}

.roster-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 10px;
}

.roster-legend {
  display: flex;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.roster-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 2px;
}

.roster-table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  text-align: left;
  padding: 4px 6px;
}

.roster-table tbody tr {
  background: rgba(18, 22, 32, 0.6);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.roster-table tbody tr:hover {
  background: rgba(28, 35, 52, 0.8);
}

.roster-table tbody tr.active-row {
  background: rgba(0, 229, 255, 0.08);
  outline: 1px solid var(--speccy-cyan);
}

.roster-table td {
  padding: 2px 5px;
}

.roster-table td:first-child {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.roster-table td:last-child {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.slot-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 4px;
  text-align: center;
  min-width: 28px;
  transition: all 0.2s ease;
}

/* Indicadores de rol por dorsal según la leyenda */
.roster-table tbody tr.role-gk td:first-child {
  border-left: 3px solid #f59e0b;
}
.roster-table tbody tr.role-starter td:first-child {
  border-left: 3px solid #00e5ff;
}
.roster-table tbody tr.role-sub td:first-child {
  border-left: 3px solid #ffd600;
}
.roster-table tbody tr.role-reserve td:first-child {
  border-left: 3px solid #64748b;
}

/* Slot badges estilizados con la paleta de la leyenda */
.slot-badge.role-gk {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.4);
}
.slot-badge.role-starter {
  background: rgba(0, 229, 255, 0.12);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.35);
}
.slot-badge.role-sub {
  background: rgba(255, 214, 0, 0.12);
  color: #ffd600;
  border: 1px solid rgba(255, 214, 0, 0.35);
}
.slot-badge.role-reserve {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

/* Number input con rol posicional */
.num-select {
  background: #0d111a;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  width: 96px;
  height: 26px;
  text-align: left;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.num-select.role-gk {
  border-color: rgba(245, 158, 11, 0.6);
  color: #fbbf24;
}
.num-select.role-starter {
  border-color: rgba(0, 229, 255, 0.5);
  color: #00e5ff;
}
.num-select.role-sub {
  border-color: rgba(255, 214, 0, 0.6);
  color: #ffd600;
}
.num-select.role-reserve {
  border-color: rgba(100, 116, 139, 0.5);
  color: #94a3b8;
}

.num-select:focus {
  border-color: var(--speccy-cyan);
}

/* SEPARADORES VISUALES ENTRE TITULARES, SUPLENTES Y RESERVAS */
.roster-section-divider td {
  padding: 10px 4px 4px 4px !important;
  background: transparent !important;
  border: none !important;
}

.divider-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.divider-bar::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.18) 0%, transparent 100%);
}

.divider-tag {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.divider-tag.sub {
  background: rgba(255, 214, 0, 0.12);
  color: #ffd600;
  border: 1px solid rgba(255, 214, 0, 0.35);
}

.divider-tag.res {
  background: rgba(100, 116, 139, 0.16);
  color: #cbd5e1;
  border: 1px solid rgba(100, 116, 139, 0.35);
}

/* Player Name input */
.name-input {
  background: #0d111a;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  height: 26px;
  width: 100%;
  max-width: 170px;
  text-transform: uppercase;
  outline: none;
}

.name-input:focus {
  border-color: var(--speccy-cyan);
}

/* Position Selector */
.pos-select {
  background: #0d111a;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.8rem;
  font-weight: 600;
  outline: none;
  cursor: pointer;
}

.pos-select:focus {
  border-color: var(--speccy-cyan);
}

/* RETRO SKILL BUTTONS (Spd, Def, Att: 1 a 3 botones) */
.skill-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #0d111a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  padding: 2px 6px;
  height: 26px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.skill-btn:hover {
  background: #161c2b;
  border-color: var(--speccy-cyan);
  transform: translateY(-1px);
}

.skill-btn:active {
  transform: translateY(0);
}

.skill-dots {
  display: inline-flex;
  gap: 3px;
}

.skill-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #1f2738;
  border: 1px solid rgba(255, 255, 255, 0.15);
  transition: all 0.15s ease;
}

.skill-dot.active.spd {
  background: #ffd600;
  border-color: #fff;
  box-shadow: 0 0 6px rgba(255, 214, 0, 0.8), inset 0 0 2px #fff;
}

.skill-dot.active.def {
  background: #00e5ff;
  border-color: #fff;
  box-shadow: 0 0 6px rgba(0, 229, 255, 0.8), inset 0 0 2px #fff;
}

.skill-dot.active.att {
  background: #ff0055;
  border-color: #fff;
  box-shadow: 0 0 6px rgba(255, 0, 85, 0.8), inset 0 0 2px #fff;
}

.skill-level-text {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--text-muted);
  margin-left: 2px;
}

/* Badge Goalkeeper para el portero */
.gk-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  height: 26px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Inputs numéricos para Fit, Mat, Gls */
.stat-num-input {
  background: #0d111a;
  color: #fff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 2px 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.82rem;
  width: 44px;
  height: 26px;
  text-align: center;
  outline: none;
}

.stat-num-input:focus {
  border-color: var(--speccy-cyan);
}

.stat-num-input.fit {
  color: #10b981;
}

/* MODAL */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  background: #141824;
  border: 1px solid var(--speccy-cyan);
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  padding: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.8);
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-backdrop.active .modal-box {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--speccy-cyan);
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
}

.modal-body {
  margin-bottom: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* TOAST NOTIFICATION */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #182030;
  border-left: 4px solid var(--speccy-green);
  color: #fff;
  padding: 12px 20px;
  border-radius: 6px;
  font-size: 0.9rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-msg.show {
  transform: translateY(0);
  opacity: 1;
}
