@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --primary-color: #7B9244;
  --secondary-color: #0f172a;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-dark: #0f172a;
  --text-muted: #64748b;
  --border-color: #f1f5f9;
}

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
}

.header-banner {
  background: #ffffff;
  padding: 30px 20px;
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  border-top: 5px solid var(--primary-color);
  color: var(--text-dark);
  text-align: center;
  margin-bottom: 30px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.titulo-polla {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-dark);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.sub-polla {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 400;
}

/* Nav Tabs Custom Styling */
.nav-tabs-custom {
  display: flex;
  justify-content: center;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 30px;
  padding: 0;
  list-style: none;
  gap: 15px;
}

.nav-tabs-custom li a {
  display: block;
  padding: 12px 24px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
}

.nav-tabs-custom li a:hover {
  color: var(--primary-color);
}

.nav-tabs-custom li.active a {
  color: var(--primary-color);
  border-bottom: 3px solid var(--primary-color);
}

/* Secciones */
.titulo-seccion {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-dark);
  margin-top: 30px;
  margin-bottom: 20px;
  border-left: 5px solid var(--primary-color);
  padding-left: 12px;
}

/* Rejilla de Partidos */
.grid-partidos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

/* Tarjetas de partidos */
.card-partido {
  background-color: var(--card-bg);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.card-partido:hover {
  box-shadow: 0 8px 25px rgba(0,0,0,0.07);
  transform: translateY(-2px);
}

.hora-partido {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
  background-color: #f1f5f9;
  display: inline-block;
  align-self: flex-start;
  padding: 2px 10px;
  border-radius: 9999px;
}

.equipos-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.equipo-col {
  text-align: center;
  width: 40%;
}

.flag-team {
  width: 48px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border: 1px solid #e2e8f0;
  margin-bottom: 8px;
}

.team-name {
  font-weight: 700;
  font-size: 14px;
  color: #1e293b;
  display: block;
}

.vs-divider {
  font-weight: bold;
  color: #94a3b8;
  font-size: 14px;
  width: 20%;
  text-align: center;
}

/* Inputs de goles debajo de tarjetas */
.score-inputs {
  display: flex;
  justify-content: space-around;
  gap: 15px;
  border-top: 1px solid #f1f5f9;
  padding-top: 15px;
}

.input-goles-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 45%;
}

.input-goles-group label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.input-goles {
  width: 65px;
  padding: 6px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  color: var(--text-dark);
}

.input-goles:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(123, 146, 68, 0.15);
}

.score-display-completed {
  font-size: 16px;
  font-weight: 800;
  color: var(--primary-color);
  background: #eff6ff;
  padding: 4px 12px;
  border-radius: 8px;
  text-align: center;
  margin-top: 5px;
}

/* Estilos del Podio 3D */
.podio-container {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  margin: 30px auto;
  max-width: 600px;
  height: 280px;
  padding-bottom: 10px;
}

.puesto {
  text-align: center;
  width: 160px;
  font-weight: bold;
  color: #0f172a;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  transition: transform 0.3s ease;
}

.puesto:hover {
  transform: translateY(-5px);
}

.puesto img {
  width: 65px;
  height: auto;
  margin-bottom: 10px;
  box-shadow: 0px 8px 16px rgba(0,0,0,0.15);
  border-radius: 6px;
  border: 2px solid white;
}

.bloque-1 {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  height: 150px;
  width: 100%;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(217, 119, 6, 0.2);
}

.bloque-2 {
  background: linear-gradient(135deg, #94a3b8, #475569);
  height: 115px;
  width: 100%;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(71, 85, 105, 0.2);
}

.bloque-3 {
  background: linear-gradient(135deg, #d97706, #b45309);
  height: 90px;
  width: 100%;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(180, 83, 9, 0.2);
}

.num-puesto {
  font-size: 42px;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: -5px;
}

.nombre-equipo-podio {
  font-size: 14px;
  color: white;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  padding: 0 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

/* Leaderboard Table Styles */
.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0,0,0,0.02);
}

.leaderboard-table th {
  background-color: var(--secondary-color);
  color: #f8fafc;
  text-align: left;
  padding: 15px;
  font-weight: 600;
  font-size: 14px;
}

.leaderboard-table td {
  padding: 15px;
  border-bottom: 1px solid var(--border-color);
  font-size: 15px;
  color: #334155;
}

.leaderboard-table tr:hover {
  background-color: #f8fafc;
  cursor: pointer;
}

.badge-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 13px;
}

.rank-1 { background-color: #fef3c7; color: #d97706; border: 1px solid #fde68a; }
.rank-2 { background-color: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.rank-3 { background-color: #ffedd5; color: #c2410c; border: 1px solid #fed7aa; }
.rank-other { background-color: #f1f5f9; color: #64748b; }

/* Tarjetas en Admin */
.admin-match-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 15px;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 8px;
}

.admin-match-info {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 50%;
}

.admin-match-score-inputs {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 30%;
}

.admin-match-actions {
  width: 20%;
  text-align: right;
}

.admin-score-input {
  width: 50px;
  text-align: center;
  padding: 4px;
  font-weight: bold;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
}

/* Alertas de Bootstrap Personalizadas */
.alert {
  padding: 15px;
  margin-bottom: 20px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.alert-success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.alert-danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.alert-info {
  color: #0c5460;
  background-color: #d1ecf1;
  border-color: #bee5eb;
}

/* Placeholder de bandera para cruces por definir */
.flag-placeholder {
  width: 48px;
  height: 32px;
  background-color: #f1f5f9;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  margin-bottom: 8px;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

/* ==========================================================================
   PERSONALIZACIÓN DE COLORES CORPORATIVOS (ELIMINACIÓN DE AZUL BOOTSTRAP)
   ========================================================================== */

/* 1. Botones principales (btn-primary y btn-success) con el verde oliva de Estrada y Velásquez */
.btn-primary, .btn-success {
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  color: #ffffff !important;
  transition: all 0.2s ease-in-out;
}

.btn-primary:hover, .btn-primary:focus, .btn-primary:active,
.btn-success:hover, .btn-success:focus, .btn-success:active {
  background-color: #637735 !important; /* Verde oliva más oscuro para hover */
  border-color: #637735 !important;
  color: #ffffff !important;
  box-shadow: 0 4px 12px rgba(123, 146, 68, 0.2) !important;
}

/* 1.1 Botón delineado (btn-outline-primary) con el color verde oliva */
.btn-outline-primary {
  color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  background-color: transparent !important;
  transition: all 0.2s ease-in-out;
}

.btn-outline-primary:hover, .btn-outline-primary:focus, .btn-outline-primary:active {
  color: #ffffff !important;
  background-color: var(--primary-color) !important;
  border-color: var(--primary-color) !important;
  box-shadow: 0 4px 12px rgba(123, 146, 68, 0.2) !important;
}

/* 1.2 Textos de color primario (text-primary) */
.text-primary {
  color: var(--primary-color) !important;
}

/* 2. Pestañas de navegación activas (nav-pills) en el login/registro */
.nav-pills .nav-link.active, .nav-pills .show > .nav-link {
  background-color: var(--primary-color) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(123, 146, 68, 0.15);
}

.nav-pills .nav-link {
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.nav-pills .nav-link:hover {
  color: var(--primary-color);
  background-color: rgba(123, 146, 68, 0.05);
}

/* 3. Focos de campos de entrada (input focus) con brillo verde oliva en lugar de azul */
.form-control:focus, .form-select:focus {
  border-color: #9cb166 !important;
  box-shadow: 0 0 0 0.25rem rgba(123, 146, 68, 0.25) !important;
}

/* 4. Ocultar las flechitas (spinners) de los inputs de tipo número para escribir directamente por teclado */
/* Para Chrome, Safari, Edge y Opera */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Para Firefox */
input[type=number] {
  -moz-appearance: textfield;
}

/* ==========================================================================
   DISEÑO RESPONSIVO (ADAPTACIÓN A CELULARES Y TABLETAS)
   ========================================================================== */

/* Línea de separación vertical en el detalle de usuarios (Leaderboard) */
@media (min-width: 992px) {
  .border-end-lg {
    border-right: 1px solid var(--border-color) !important;
  }
}

/* Ajustes para pantallas medianas/pequeñas (Tabletas y móviles en general) */
@media (max-width: 992px) {
  #details-box .col-lg-5 {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
  }
}

@media (max-width: 768px) {
  /* Panel de administración - Fila de partido */
  .admin-match-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 15px;
    text-align: center;
  }
  .admin-match-info {
    width: 100%;
    flex-wrap: wrap;
    justify-content: center;
  }
  .admin-match-score-inputs {
    width: 100%;
    justify-content: center;
  }
  .admin-match-actions {
    width: 100%;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
  }
  .admin-match-info .admin-date-input {
    margin-top: 8px;
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* Ajustes para pantallas pequeñas (Celulares) */
@media (max-width: 576px) {
  /* Contenedor principal de la app */
  body {
    font-size: 14px;
  }
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Banner Superior */
  .header-banner {
    padding: 20px 15px !important;
    margin-bottom: 20px !important;
  }
  .header-banner img[alt="Estrada y Velásquez Logo"] {
    max-height: 100px !important;
  }
  .header-banner img[alt="Copa Mundial"] {
    max-height: 40px !important;
    margin-top: 10px;
  }
  .titulo-polla {
    font-size: 22px !important;
  }
  .sub-polla {
    font-size: 13px !important;
  }

  /* Pestañas de Navegación Deslizables Horizontalmente */
  .nav-tabs-custom {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    margin-bottom: 20px;
    padding-bottom: 5px;
  }
  .nav-tabs-custom li a {
    padding: 8px 14px !important;
    font-size: 13px !important;
    white-space: nowrap;
  }

  /* Rejilla de Partidos */
  .grid-partidos {
    grid-template-columns: 1fr !important;
    gap: 15px !important;
  }
  .card-partido {
    padding: 15px !important;
  }
  .flag-team, .flag-placeholder {
    width: 40px !important;
    height: auto !important;
  }
  .team-name {
    font-size: 12px !important;
  }
  .vs-divider {
    font-size: 12px !important;
  }
  .input-goles {
    width: 55px !important;
    padding: 5px !important;
    font-size: 14px !important;
  }

  /* Podio 3D Redimensionado */
  .podio-container {
    height: 200px !important;
    margin: 20px auto !important;
    padding-bottom: 5px;
  }
  .puesto {
    width: 32% !important;
  }
  .puesto img {
    width: 42px !important;
    margin-bottom: 5px !important;
    box-shadow: 0px 4px 8px rgba(0,0,0,0.1);
  }
  .bloque-1 {
    height: 110px !important;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
  }
  .bloque-2 {
    height: 85px !important;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
  }
  .bloque-3 {
    height: 65px !important;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
  }
  .num-puesto {
    font-size: 26px !important;
  }
  .nombre-equipo-podio {
    font-size: 10px !important;
  }
  
  /* Botones generales */
  .btn-lg {
    padding: 10px 16px !important;
    font-size: 16px !important;
  }
}

/* ==========================================================================
   ESTILOS DE LLAVES (BRACKET DEL TORNEO)
   ========================================================================== */

.bracket-scroll-container {
  overflow-x: auto;
  padding: 10px 0;
  -webkit-overflow-scrolling: touch;
}

.bracket-wrapper {
  display: flex;
  gap: 40px;
  min-width: 1400px;
  padding: 20px;
  background-color: #f8fafc;
  border-radius: 16px;
  border: 1px solid #cbd5e1;
}

.bracket-round {
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  flex: 1;
  min-height: 1050px; /* Suficiente altura para espaciar 16 llaves verticales */
  gap: 15px;
}

.bracket-round-title {
  text-align: center;
  font-weight: 800;
  color: var(--text-dark);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-color);
}

.bracket-match-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.03);
  transition: all 0.25s ease-in-out;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bracket-match-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.08);
  border-color: var(--primary-color);
}

.bracket-match-card-static {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.03);
  transition: all 0.25s ease-in-out;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bracket-match-card-static:hover {
  border-color: var(--primary-color);
  box-shadow: 0 6px 15px rgba(0,0,0,0.05);
}

.bracket-match-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 4px;
  margin-bottom: 2px;
}

.bracket-team-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.bracket-team-info {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bracket-team-flag {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #cbd5e1;
  object-fit: cover;
}

.bracket-team-name {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
}

.bracket-team-name.placeholder-team {
  font-weight: 400;
  color: var(--text-muted);
  font-style: italic;
}

.bracket-score {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary-color);
  min-width: 15px;
  text-align: right;
}

.bracket-match-date {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 4px;
  border-top: 1px solid #f1f5f9;
  padding-top: 4px;
  font-weight: 600;
}

/* Ampliar el ancho del contenedor en pantallas grandes para aprovechar mejor el espacio de la hoja */
@media (min-width: 1200px) {
  .container {
    max-width: 95% !important;
  }
}
@media (min-width: 1600px) {
  .container {
    max-width: 1560px !important;
  }
}
