:root {
  --bg: #f4f6f9;
  --card: #fff;
  --ink: #1f2937;
  --muted: #6b7280;
  --accent: #184651;
  --accent-light: #e9ff00;
  --border: #e5e7eb;
  --sidebar-bg: #f8f8f8;
  --sidebar-hover: #1f2937;
  --sidebar-active: #374151;
  --radius: 10px;
  --shadow: 0 4px 10px rgba(0,0,0,0.08);
  --transition: 0.2s ease;
  font-size: 16px;
}

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

body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
}

/* === SIDEBAR === */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--sidebar-bg);
  color: #e5e7eb;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

.sidebar .brand {
  padding: 18px 20px;
  font-weight: 700;
  font-size: 1.2rem;
  border-bottom: 1px solid #222;
  letter-spacing: 0.5px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  padding: 10px;
  flex: 1;
}

.sidebar nav a {
  color: #9ca3af;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: var(--radius);
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  background: var(--sidebar-hover);
  color: #fff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 14px;
  border-top: 1px solid #1f2937;
  color: #9ca3af;
  font-size: 14px;
}

/* === MAIN === */
.main {
  margin-left: 240px;
  padding: 32px;
  flex: 1;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.topbar h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-weight: 500;
  transition: var(--transition);
}

.btn:hover {
  opacity: 0.9;
}

.btn-dark {
  background: var(--accent);
  color: #fff;
}

.btn.small {
  font-size: 0.85rem;
  padding: 5px 10px;
}

.btn.danger {
  background: #dc2626;
  color: #fff;
}

.btn.warning {
  background: #f59e0b;
  color: #fff;
}

/* === CARDS & FORMS === */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

input, select, textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 0.95rem;
  transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(24,70,81,0.15);
}

/* === TABLES === */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th {
  text-align: left;
  background: #f9fafb;
  border-bottom: 2px solid var(--border);
  padding: 10px;
  color: var(--muted);
  font-weight: 600;
}

.table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
}

.table tbody tr:hover {
  background: #f3f4f6;
}

/* === MODAL === */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(3px);
}

.modal-popup {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 700px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.25);
  animation: modalFade 0.25s ease;
  padding: 24px;
  position: relative;
  max-height: 85vh;
  overflow-y: auto;
}

.modal-popup h3 {
  margin-top: 0;
  color: var(--accent);
  margin-bottom: 10px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  border: none;
  background: none;
  font-size: 24px;
  cursor: pointer;
  color: #888;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--accent);
}

@keyframes modalFade {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.search {
  margin-top: 1rem;
}

.buscadorResultados {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 200px;
  overflow-y: auto;
  background: #fff;
  box-shadow: var(--shadow);
}

.player-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.player-result:hover {
  background: #f3f4f6;
}

.player-result img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.player-item img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

/* === UTILITIES === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.gap-2 { gap: 8px; }
.flex { display: flex; align-items: center; }
.space-between { justify-content: space-between; }
.mt-2 { margin-top: 10px; }
.mt-4 { margin-top: 20px; }


/* === FORZAR MODAL ARRIBA DE TODO === */
html, body {
  position: relative !important;
  z-index: auto !important;
  overflow-x: hidden;
}

.sidebar {
  z-index: 100; /* Sidebar fijo */
}

.main {
  z-index: 1;
  position: relative;
}

/* === Modal overlay === */
.modal-overlay {
  position: fixed !important;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.65);
  display: none; /* oculto por defecto */
  align-items: center;
  justify-content: center;
  z-index: 99999 !important; /* siempre sobre el sidebar */
  backdrop-filter: blur(3px);
}

/* === Modal popup === */
.modal-popup {
  background: #fff;
  border-radius: 12px;
  max-width: 700px;
  width: 90%;
  padding: 24px;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  animation: modalFade .3s ease-out;
  overflow-y: auto;
  max-height: 85vh;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  font-size: 26px;
  color: #666;
  cursor: pointer;
}

.modal-close:hover {
  color: #000;
}

@keyframes modalFade {
  from { opacity: 0; transform: translateY(-10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}


/* === Responsive Sidebar + Hamburguesa === */

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 8px;
  font-size: 1.5rem;
  color: #fff;
}

.hamburger-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  background: var(--accent);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  transition: 0.3s ease;
}

.hamburger, .hamburger::before, .hamburger::after {
  content: "";
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: 0.3s ease;
  position: relative;
}
.hamburger::before {
  transform: translateY(-6px);
}
.hamburger::after {
  transform: translateY(4px);
}

/* Animación hamburguesa → X */
.hamburger-btn.active .hamburger {
  background: transparent;
}
.hamburger-btn.active .hamburger::before {
  transform: rotate(45deg);
}
.hamburger-btn.active .hamburger::after {
  transform: rotate(-45deg);
}

/* Botón de cerrar dentro del sidebar (solo móvil) */
.close-btn {
  display: none;
  position: absolute;
  right: 16px;
  top: 12px;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

/* === Sidebar ocultable === */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: -240px;
    top: 0;
    bottom: 0;
    transition: left 0.3s ease;
    z-index: 2000;
  }

  .sidebar.active {
    left: 0;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.4);
  }

  .hamburger-btn {
    display: flex;
  }

  .close-btn {
    display: block;
  }

  .main {
    margin-left: 0;
    padding-top: 70px;
  }

  /* Fondo oscuro detrás del menú abierto */
  .sidebar.active::after {
    content: "";
    position: fixed;
    top: 0;
    left: 240px;
    width: calc(100vw - 240px);
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: -1;
  }
}

/* === Dashboard === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card.kpi {
  background: white;
  border-radius: 10px;
  text-align: center;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.card.kpi h4 {
  margin-bottom: .3rem;
  color: #184651;
}
.kpi-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #184651;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.card.highlight {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.goleador {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.2rem;
}
.goleador .info p {
  margin: 0;
  color: #777;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.table th, .table td {
  padding: .6rem;
  border-bottom: 1px solid #ddd;
}
.table th {
  background-color: #f5f5f5;
}
.badge {
  padding: .3rem .6rem;
  border-radius: 5px;
  font-size: .8rem;
  color: #fff;
}
.badge.cerrado { background: #184651; }
.badge.abierto { background: #00A86B; }

.comentario-row td {
  border-top: none !important;
  background: #f9fafb;
  font-style: italic;
}

/* Asegura que los botones con íconos sean referencia para posicionamiento */
button.btn.position-relative {
  position: relative !important;
}

.comentario-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: #e63946; /* rojo */
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 2px rgba(0,0,0,.4);
  pointer-events: none; /* evita interferencias */
}

.jugador-foto-wrap {
  position: relative;
  display: inline-block;
}
/* === ESTILO GENERAL DE LA TABLA === */
.mini-table {
  width: 100%;
  border-collapse: separate !important;
  border-spacing: 0;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  margin-top: 0.5rem;
}

/* === CABECERA === */
.mini-table thead th {
  background: linear-gradient(90deg, #f1f3f6, #e9ecef);
  color: #333;
  font-weight: 600;
  border-bottom: 2px solid #dee2e6;
  padding: 10px 12px;
  text-align: center;
}

/* === CELDAS === */
.mini-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
  transition: background 0.2s ease, transform 0.1s ease;
  font-size: 0.95rem;
}

.mini-table tr:last-child td {
  border-bottom: none;
}

/* === REDONDEADO Y SOMBRA === */
.mini-table tr:first-child th:first-child {
  border-top-left-radius: 12px;
}
.mini-table tr:first-child th:last-child {
  border-top-right-radius: 12px;
}
.mini-table tr:last-child td:first-child {
  border-bottom-left-radius: 12px;
}
.mini-table tr:last-child td:last-child {
  border-bottom-right-radius: 12px;
}

/* === COLORES POR EQUIPO === */
.mini-table tr[data-team='1'] td {
  background-color: #eaf3ff; /* Azul claro */
}
.mini-table tr[data-team='2'] td {
  background-color: #ffe9e9; /* Rojo claro */
}

/* === EFECTO HOVER === */
.mini-table tbody tr:hover td {
  background: #f9fafb;
  transform: scale(1.01);
}

/* === FOTO DE JUGADOR === */
.jugador-foto {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  margin-right: 8px;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  vertical-align: middle;
}

/* === BOTONES DE ACCIÓN === */
.mini-table .acciones button {
  border-radius: 8px !important;
  margin: 2px;
}

/* === TABLA CONTENEDORA === */
.table-responsive {
  background: #fdfdfd;
  border-radius: 14px;
  padding: 8px;
}

/* Círculo del dorsal con número centrado y legible */
.dorsal-badge {
  position: absolute;
  bottom: -6px;
  right: -6px;
  background: #184651;      /* verde VMSC */
  color: #fff;
  font-size: 0.9rem;        /* ↑ texto más grande */
  font-weight: 800;
  border-radius: 50%;
  width: 26px;              /* ↑ círculo más grande */
  height: 26px;
  display: flex;
  align-items: center;      /* centra vertical */
  justify-content: center;  /* centra horizontal */
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0,0,0,.35);
  line-height: 1;           /* evita recortes raros */
}

/* Si usas dorsales de dos cifras grandes (10–99), puedes ir a: 
.dorsal-badge { width: 28px; height: 28px; font-size: 1rem; } */

.jugador-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.jugador-nombre {
  font-size: 0.85rem;
  text-align: center;
  color: #1f2a37;
  margin-top: 2px;
  white-space: nowrap;
}

.top-goleadores {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 1rem;
}

.goleador-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9fafc;
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: transform 0.2s ease, background 0.2s ease;
}

.goleador-item:hover {
  background: #eef4f8;
  transform: scale(1.01);
}

.goleador-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.goleador-foto {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #ddd;
}

.goleador-pos {
  font-size: 1.2rem;
  width: 28px;
  text-align: center;
}

.goleador-goles {
  font-weight: bold;
  font-size: 1rem;
  color: #184651;
}


/* === SUBMENÚ === */
.submenu {
  margin-top: 5px;
}

.submenu-toggle {
  width: 100%;
  background: none;
  border: none;
  color: #a0a4ab;
  padding: 10px 16px;
  text-align: left;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.submenu .arrow {
  border: solid #fff;
  border-width: 0 2px 2px 0;
  display: inline-block;
  padding: 3px;
  transform: rotate(45deg);
  transition: 0.2s ease;
}

.submenu.open .arrow {
  transform: rotate(-135deg);
}

.submenu-items {
  display: none;
  flex-direction: column;
}

.submenu.open .submenu-items {
  display: flex;
}

.submenu-items a {
  padding-left: 30px !important;
  font-size: 14px;
  opacity: .85;
}

/* === Ajuste específico para la tabla de jugadores === */

/* La última columna solo ocupa lo necesario y centra el botón */
#tblJugadores th:last-child,
#tblJugadores td:last-child {
  width: 1%;
  white-space: nowrap;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}

/* Botón más compacto dentro de la celda */
#tblJugadores td:last-child .btn-outline,
#tblJugadores td:last-child .btn {
  padding: 6px 12px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Card que contiene la tabla de jugadores: menos padding a la derecha */
.card:has(#tblJugadores) {
  padding-right: 12px;
}


.sms-card {
      border-radius: 14px;
      border: 1px solid rgba(0,0,0,.06);
      box-shadow: 0 4px 14px rgba(15,23,42,.08);
      background: #ffffff;
      padding: 1.5rem;
      margin-bottom: 1.5rem;
    }
    .sms-badge {
      font-size: .75rem;
      text-transform: uppercase;
      letter-spacing: .08em;
    }
    .sms-section-title {
      font-weight: 600;
      font-size: .95rem;
      text-transform: uppercase;
      color: #6b7280;
      margin-bottom: .5rem;
    }
    .preview-box {
      background: #f9fafb;
      border-radius: 0.75rem;
      padding: 1rem 1.25rem;
      border: 1px dashed #e5e7eb;
    }
    .preview-count {
      font-size: 1.25rem;
      font-weight: 600;
      color: #111827;
    }
    .preview-table thead th {
      font-size: .75rem;
      text-transform: uppercase;
      letter-spacing: .06em;
      color: #6b7280;
    }
    .preview-table tbody td {
      font-size: .875rem;
    }
    .btn-pill {
      border-radius: 999px;
    }
    .text-muted-xs {
      font-size: .75rem;
      color: #9ca3af;
    }
    @media (max-width: 768px) {
      .sms-card {
        padding: 1.1rem;
      }
    }
