:root {
  --primary: #ff4430;
  --secondary: #1E3E62;
  --background: #0B192C;
  --surface: #1e293b;
  --surfacelight: #31425e;
  --text: #f8fafc;
  --border: rgba(248, 250, 252, 0.1);
  --glow: 0 0 7px #0B192C;
}

body {
  color: var(--text);
  background: var(--background);
  min-height: 100vh;
  margin: 0;
  font-family: system-ui, -apple-system, sans-serif;
}

.container-fluid {
  padding: 1rem;
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(16px);
  animation: fadeIn 0.5s ease-out;
}

.cardglass {
  background: rgba(0, 0, 0, 0);
  border: 1px solid var(--border);
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  backdrop-filter: blur(16px) saturate(110%);
  animation: fadeIn 0.5s ease-out;
}

.score-container {
  background: linear-gradient(180deg,var(--surfacelight), var(--surface));
  border: 2px solid var(--background);
  border-radius: 1rem;
  padding: 1.5rem;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: visible;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
  min-height: 200px;
  gap: 0.5rem;
}

.score-container.winning {
  border-color: var(--primary);
  box-shadow: var(--glow);
  animation: pulseWin 1s infinite;
}

.team-name {
  font-size: clamp(0.75rem, 4vw,1.125rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  width: 100%;
  padding: 0 0.75rem;
  word-wrap: break-word;
  hyphens: auto;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  margin: 0;
}

.nomatch-message{
  font-size: clamp(0.75rem, 4vw,1.125rem);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-align: center;
  width: 100%;
  padding: 0 0.75rem;
  word-wrap: break-word;
  hyphens: auto;
  min-height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
  margin: 0;
}

.display-1 {
  font-size: 5rem;
  font-weight: 800;
  color: var(--primary);
  text-shadow: var(--glow);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  margin: 0;
  padding: 0.5rem 0;
}

.point-difference {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  background: var(--primary);
  color: var(--text);
  padding: 0.3rem 0.3rem;
  border-radius: 9px;
  font-size: 0.97rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s, transform 0.3s;
}

.winning .point-difference {
  opacity: 1;
  transform: translateY(0);
}

.table {
  margin: 0;
  background: var(--background);
  font-size: 0.875rem;
}

.table th {
  color: var(--primary);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  padding: 0.75rem;
}

.table td {
  padding: 0.75rem;
  border-color: var(--border);
}

.table td.higher-score {
  background: color-mix(in srgb, var(--primary) 15%, var(--surface));
  font-weight: bold;
}

.input-group {
  gap: 0.5rem;
}

.input-group .form-control {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
}

.input-group > .btn-custom-start {
  border-top-left-radius: 0.75rem !important;
  border-bottom-left-radius: 0.75rem !important;
}

.btn {
  border-radius: 0.75rem;
  padding: 0.75rem 1.5rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-outline-info {
    border: 1px solid var(--primary);
    color: var(--primary);
    --bs-btn-color: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-color: #0E1525;
    --bs-btn-hover-bg: var(--primary);
    --bs-btn-hover-border-color: var(--primary);;
    --bs-btn-focus-shadow-rgb: 39, 185, 214;
    --bs-btn-active-color: #0E1525;
    --bs-btn-active-bg: var(--primary);
    --bs-btn-active-border-color: var(--primary);
    --bs-btn-active-shadow: inset 0 3px 5px rgba(14, 21, 37, .125);
    --bs-btn-disabled-color: var(--primary);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--primary);
    --bs-gradient: none
}

.btn:hover {
}

.sticky-nav {
  margin-left: 15px;
  margin-right: 15px;
}

.spacer{
  height: 90px;
}

.btn .fa-sync-alt {
  transition: transform 0.4s ease-in-out;
}

.btn:active .fa-sync-alt {
  transform: rotate(180deg);
}


@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    min-height: 100vh;
}

.loader {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(99, 102, 241, 0.1);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes pulseWin {
  0% { box-shadow: 0 0 0 0 rgba(255, 68, 48, 0.4); } /* Color primario */
  70% { box-shadow: 0 0 0 20px rgba(255, 68, 48, 0); } /* Color primario */
  100% { box-shadow: 0 0 0 0 rgba(255, 68, 48, 0); } /* Color primario */
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 576px) {
  .container-fluid { padding: 0.5rem; }
  .card-body { padding: 0.75rem; }
  .team-name { font-size: 1rem; }
  .display-1 { font-size: 3.5rem; }
  .score-container { padding: 1rem; }
  .table { font-size: 0.75rem; }
  .table td, .table th { padding: 0.5rem; }
  .btn { padding: 0.5rem 1rem; }
}

@media (min-width: 768px) {
  .container-fluid { padding: 1.5rem; }
  .display-1 { font-size: 5rem; }
}

.match-info .badge {
  background: color-mix(in srgb, var(--primary) 15%, var(--surface));
  color: var(--primary);
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
  box-shadow: 0 0 15px color-mix(in srgb, var(--primary) 10%, transparent);
  min-width: 5rem;
  width: 5rem;
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.player-stats.mt-3 {
  margin-top: 1rem;
}

.player-stats h5 {
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.max-fouls {
  color: #dc3545 !important;
  font-weight: bold;
}

.player-stats .d-flex {
  flex-direction: column;
  gap: 0.5rem;
}

.player-stats .input-group {
  gap: 0.5rem;
  width: 100%;
}

.player-stats .btn-group {
  width: fit-content;
  margin-left: auto;
}

.team-fouls {
  margin-top: 0;
  display: flex;
  justify-content: center;
  width: 100%;
}

.team-fouls .badge {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  background: var(--primary);
  transition: background-color 0.3s ease;
}

.team-fouls .badge.danger {
  background: #dc3545;
}

@media (max-width: 576px) {
  .team-fouls .badge {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
  }
}

.period-time {
    margin-top: 0.5rem;
}

.period-time .badge {
    background: color-mix(in srgb, var(--primary) 15%, var(--surface));
    color: var(--primary);
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
    box-shadow: 0 0 15px color-mix(in srgb, var(--primary) 10%, transparent);
    min-width: 5rem;
    width: 5rem;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
}

@media (max-width: 576px) {
    .period-time .badge {
        font-size: 1rem;
        padding: 0.25rem 0.5rem;
    }
}

.btn-autorefresh {
  position: relative;
  border: none;
  background: none;
  transition: color 0.3s ease, transform 0.3s ease; /* Transiciones suaves */
  display: flex;
  align-items: center; /* Alinear icono y contador */
}

.btn-autorefresh:hover {
  transform: scale(1.05); /* Efecto de hover */
}

/* Estilo para cuando el botón está activo */
.btn-autorefresh.active {
  color: var(--primary);
  font-weight: bold; /* Hacer el texto más grueso */
}

.player-stats-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
}

.player-stats-link:hover {
    color: var(--text);
    transform: scale(1.2);
}

.player-stats-link:active {
    transform: scale(0.95);
}

#autoRefreshCounter {
  font-weight: bold;
  color: none;
  background: none;
  padding: 0;
  margin-left: 0.5rem;
  width: 3rem; /* Ancho fijo */
  text-align: center;
  transition: opacity 0.3s ease; /* Suave aparición del contador */
}

/* Match List Styles */
.match-list {
  width: 100%;
  animation: fadeIn 0.5s ease-out;
}

.match-list h3 {
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 1.5rem;
}

.match-filter-container {
  width: 100%;
}

.match-filter-container .input-group {
  max-width: 100%;
}

.match-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(180deg,var(--surfacelight), var(--surface));
  border: 2px solid var(--background);
  border-radius: 0.75rem;
  transition: all 0.3s ease;
}

.match-card:hover {
  border-color: var(--primary);
  transform: translateX(3px);
  box-shadow: 0 0 20px rgba(255, 68, 48, 0.2);
}

.match-info-row {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
}

.match-category {
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.2;
  white-space: normal;
  word-wrap: break-word;
  text-align: center;
}

.match-teams {
  display: flex;
  align-items: center;
  justify-content: space-around; /* Distribuye el espacio entre los elementos */
  gap: 0.2rem; /* Espacio entre los elementos */
  flex-grow: 1; /* Permite que este contenedor crezca para ocupar el espacio disponible */
  min-width: 0; /* Evitar desbordamiento */
}

.match-teams .team-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  white-space: normal;
  word-wrap: break-word;
  width: 100%;
  text-align: center;
}

.match-score {
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  align-items: center;
}

@media (max-width: 576px) {
  .match-card {
    padding: 0.6rem 0.75rem;
    gap: 0.5rem;
  }

  .match-category {
    font-size: 0.75rem;
  }

  .match-teams .team-name {
    font-size: 0.85rem;
  }

  .match-score {
    font-size: 3.2rem;
  }
}

/* Player Stats Modal */
.player-stats-modal {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 97vh; /* Ocupa al menos el 100% de la altura de la ventana */
  width: 100%;
  overflow: auto;
  z-index: 1040; /* Below navbar (1050) but above content */
  display: flex;
  flex-direction: column;
  animation: slideUp 0.5s ease-out;
  filter: drop-shadow(0 0 0.75rem var(--surface));
  background: rgba(var(--bs-dark-rgb),var(--bs-bg-opacity))!important;
  border-top-left-radius: 1rem;
  border-top-right-radius: 1rem;
  border: 1px solid var(--border);
  padding-top: 1em;
}

.blocker {
  position: fixed; /* Fija el div en la pantalla */
  top: 0;         /* Lo alinea arriba */
  left: 0;        /* Lo alinea a la izquierda */
  right: 0;       /* Lo alinea a la derecha */
  bottom: 0;      /* Lo alinea abajo, ocupando todo el espacio */
  z-index: 1030;  /* Un valor alto para asegurar que esté encima de otros elementos */
  /* Puedes añadir otras propiedades como un color de fondo para hacerlo visible */
  background-color: rgba(0, 0, 0, 0.5); /* Fondo semi-transparente para oscurecer */
  overflow: hidden;
  /* O incluso ocultar el contenido pero no el fondo */
  /* background-color: transparent; */
}

.player-stats-iframe {
  background: rgba(var(--bs-dark-rgb),var(--bs-bg-opacity))!important;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.player-stats-modal-header h6 {
  color: var(--primary);
  margin: 0;
}

.player-stats-modal-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.player-stats-modal-body iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Botón flotante para ir a home */
.floating-home-btn {
    position: fixed;  /* Mantiene el botón en una posición fija */
    bottom: 2rem;     /* Distancia desde la parte inferior */
    right: 2rem;      /* Distancia desde la derecha */
    width: 60px;      /* Ancho del botón */
    height: 60px;     /* Altura del botón */
    background: var(--primaryglass); /* Color de fondo */
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    backdrop-filter: blur(16px) saturate(120%);
    color: white;     /* Color del icono */
    border-radius: 50%; /* Hace el botón redondo */
    display: flex;    /* Para centrar el icono en el botón */
    align-items: center; /* Centra contenido verticalmente */
    justify-content: center; /* Centra contenido horizontalmente */
    font-size: 1.5rem; /* Tamaño del icono */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(255, 101, 0, 0.4);
    transition: all 0.3s ease; /* Transición suave para hover */
    z-index: 1050; /* Asegura que esté en la parte superior */
    text-decoration: none; /* Sin subrayado */
    -webkit-tap-highlight-color: transparent; /* Sin resaltado en móviles */
    cursor: pointer; /* Cambia el cursor al pasar sobre el botón */
}

.floating-home-btn:hover {
    background: color-mix(in srgb, var(--primary) 80%, white);
    transform: scale(1.15); /* Aumenta ligeramente el tamaño al hover */
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), 0 0 0 8px rgba(255, 101, 0, 0.2);
}

.floating-home-btn:active {
    transform: scale(0.95); /* Reduce el tamaño al hacer clic */
}

/* Events Section */
.events-section {
    margin-top: 2rem;
}

.events-section .d-flex {
  flex-direction: column;
  gap: 0.5rem;
}

.events-section .input-group {
  gap: 0.5rem;
  width: 100%;
}

.events-section .btn-group {
  width: fit-content;
  margin-left: auto;
}

.events-section h5 {
    color: var(--primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.events-filters {
    flex-direction: column;
    gap: 0.5rem;
}

.events-filters .input-group {
    width: 100%;
}

@media (min-width: 768px) {
    .events-filters {
        flex-direction: row;
    }
}

#eventsContainer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 600px;
    overflow-y: auto;
    padding: 0.5rem;
}

.event-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    
    border: 2px solid var(--background);
    border-radius: 0.75rem;
    transition: all 0.3s ease;
    animation: fadeIn 0.3s ease-out;
}

.event-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(255, 68, 48, 0.2);
}

.event-local {
    flex-direction: row;
    text-align: left;
    background: linear-gradient(90deg, var(--surfacelight), var(--surface));
}

.event-visitor {
    flex-direction: row-reverse;
    text-align: right;
    background: linear-gradient(90deg, var(--surface), var(--surfacelight));
}

.event-noteam {
    flex-direction: center;
    text-align: center;
    background: linear-gradient(180deg,var(--surfacelight), var(--surface));
}

.event-avatar {
    flex-shrink: 0;
}

.avatar-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    border: 2px solid;
}

.avatar-local {
    background: var(--primary);
    border-color: var(--secondary);
}

.avatar-visitor {
    background: var(--primary);
    border-color: var(--secondary);
}

.event-content {
    flex: 1;
    min-width: 0;
}

.event-player {
    font-weight: 700;
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.event-description {
    font-size: 0.95rem;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.event-time {
    font-size: 0.85rem;
    color: rgba(253, 253, 253, 0.7);
}

@media (max-width: 576px) {
    .event-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .avatar-circle {
        width: 40px;
        height: 40px;
        font-size: 1.25rem;
    }

    .event-player {
        font-size: 0.9rem;
    }

    .event-description {
        font-size: 0.85rem;
    }

    .event-time {
        font-size: 0.75rem;
    }

    #eventsContainer {
        max-height: 400px;
    }
}