/* Ajuste para pantallas móviles */
@media (max-width: 768px) {
    table {
        font-size: 8px; /* Más pequeño en pantallas móviles */
    }

    th, td {
        padding: 2px; /* Menos padding en móviles */
    }

    /* Contenedor de desplazamiento horizontal */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Mejora el desplazamiento en dispositivos iOS */
    }
}


table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px; /* Reduce el tamaño de la fuente */
}

th, td {
    border: 1px solid #ddd;
    padding: 6px; /* Reduce el padding para más espacio */
    text-align: center;
    white-space: nowrap; /* Evita que el texto se divida */
}

/* Ajuste para pantallas móviles */
@media (max-width: 768px) {
    table {
        font-size: 10px; /* Más pequeño en pantallas móviles */
    }

    th, td {
        padding: 4px; /* Menos padding en móviles */
    }
}

.competicion { 
	cursor: pointer; 
	color: blue; 
	margin-bottom: 10px; 
	padding: 5px; 
}
.competicion:hover { text-decoration: underline; }
.selected { font-weight: bold; color: darkred; }
.clasificacion { display: none; margin-top: 10px; padding: 10px; border: 1px solid #ddd; }
table {
	width: 100%;
	border-collapse: collapse;
}
tr:hover { background-color: #f0f0f0; cursor: pointer; }

/* Estilos para la caja emergente de detalles */
.detalle-box {
	position: fixed;
	top: 0;
	right: -350px; /* Oculta fuera de la pantalla */
	width: 300px;
	height: 100%;
	background: white;
	border-left: 1px solid #ddd;
	box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
	padding: 20px;
	transition: right 0.3s ease-in-out;
	overflow-y: auto;
}
.detalle-box.mostrar {
	right: 0; /* Desliza hacia adentro */
}
.detalle-box h2 {
	margin-top: 0;
}
.cerrar-detalle {
	position: absolute;
	top: 10px;
	right: 10px;
	background: red;
	color: white;
	border: none;
	padding: 5px 10px;
	cursor: pointer;
}



body {
	font-family: Montserrat;
	background-color: #f4f4f4;
	text-align: center;
}
#container {
	max-width: 800px;
	margin: auto;
}
.competicion {
	position: relative;
	background-size: cover;
	background-position: center;
	color: white;
	font-size: 20px;
	font-weight: bold;
	padding: 20px;
	margin: 10px 0;
	border-radius: 10px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 150px;
}
.competicion::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 10px;
}
.competicion span {
	position: relative;
	z-index: 1;
}
#btn-add {
	font-size: 24px;
	background: #28a745;
	color: white;
	border: none;
	padding: 10px 15px;
	border-radius: 50%;
	cursor: pointer;
	position: fixed;
	bottom: 20px;
	right: 20px;
}
/* Modal */
#modal {
	display: none;
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.5);
	justify-content: center;
	align-items: center;
}
#modal-content {
	background: white;
	padding: 20px;
	border-radius: 10px;
	width: 300px;
	text-align: center;
}
input {
	width: 90%;
	padding: 10px;
	margin: 5px 0;
}
#btn-save {
	background: #007bff;
	color: white;
	padding: 10px;
	border: none;
	cursor: pointer;
	width: 100%;
}

	.spinner {
	  display:none;
	  width: 50px;
	  height: 50px;
	  border: 5px solid #ccc;
	  border-top-color: #3498db;
	  border-radius: 50%;
	  animation: spin 1s linear infinite;
	  margin: 50px auto;
	}

	@keyframes spin {
	  to { transform: rotate(360deg); }
	}

.export-area {
  width: 90%;
  height: auto; /* O usa 1080px si es necesario */
  display: grid;
  gap: 10px;
  background-color: white;
  position: relative;
  margin: 0 auto; /* Centrar horizontalmente */
  background-color: transparent;
}

/* En pantallas grandes (por ejemplo, mayores a 1024px) */
@media (min-width: 1024px) {
  .export-area {
    width: 40%;
  }
}

#logoCarrera{
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
	border-radius: 8px; 
	opacity: 0.95; 
	filter: brightness(0.95); 
	transition: all 0.3s ease-in-out; 
}


#logoTrailLevel{
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); 
	border-radius: 8px; 
	opacity: 0.95; 
	filter: brightness(0.95); 
	transition: all 0.3s ease-in-out; 
	padding: 15px;
}



  .img-left {
    grid-row: 1 / 2;
    grid-column: 1 / 2;
    align-self: start;
    justify-self: start;
    padding: 20px;
  }

	.img-center {
	  grid-row: 1 / 2;
	  grid-column: 2 / 4;
	  align-self: center;
	  justify-self: center;
	  padding: 20px;
	}
  
  .img-right {
    grid-row: 1 / 2;
    grid-column: 4 / 5;
    align-self: start;
    justify-self: end;
    padding: 20px;
  }


  #downloadBtn {
    margin-top: 20px;
    padding: 10px 20px;
    font-size: 16px;
  }
  
  #controls {
    margin-bottom: 20px;
    background: #eee;
    padding: 10px;
    border-radius: 8px;
    width: 320px;
    font-family: sans-serif;
  }

  fieldset {
    margin-bottom: 10px;
    border: 1px solid #ccc;
    padding: 8px;
    border-radius: 4px;
  }

  
  .img-left img,
  .img-right img,
  .img-center img  {
    position: absolute;
  }

  .img-left img {
    top: 0;
    left: 0;
  }

  .img-center img {
    top: 0;
    left: 0;
  }

  .img-right img {
    top: 0;
    right: 0;
  }

  
  
  #controls {
    display: flex;
    justify-content: space-between; /* Se distribuye en columnas */
    gap: 20px; /* Espaciado entre columnas */
  }

  .fieldset-container {
    width: 30%; /* Ajusta el ancho de cada columna */
  }

  #controls fieldset {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 5px;
    border: 1px solid #ccc;
  }

  #controls label {
    display: flex;
    flex-direction: column;
    font-size: 14px;
  }

  #controls input {
    margin-top: 4px;
    padding: 4px;
    font-size: 14px;
  }

	
#rankingCanvas {
  width: 1080px !important;
  height: 1080px !important;
}


/* Clases de bloques */
.block-container {
	box-shadow: 0 8px 25px rgba(0, 0, 0, 0.8);
	grid-row: 3 / 5;
	grid-column: 3 / 5;
	align-self: end;
	justify-self: end;
	display: flex;
	flex-direction: column;
	justify-content: space-around;
	border-radius: 12px;
	background-color: rgba(240, 240, 240, 0.9);
	width: 300px;
	position: absolute;
	flex-direction: column;
	border-radius: 12px;
	padding: 20px;
}

.block {
	height: 40px;
	border-radius: 10px;
	font-family: 'Kollektiv', sans-serif;
	font-weight: bold;
	font-size: 60px;
	color: white;
	text-align: center;
	padding: 20px; /* Espacio interno dentro de los bloques */
	border-radius: 10px; /* Bordes redondeados */	
	background-color: #1e1e1e;
	border-radius: 15px;
	box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7); /* sombra */
}

.block-container .block {
	font-family: 'Kollektiv', sans-serif; /* Asumiendo que la fuente está correctamente importada */
	font-weight: bold; /* Asegura que sea en negrita */
	font-size: 20px;
	color: #000; /* Puedes cambiar el color si lo deseas */
	text-align: center; /* Para centrar el texto en los divs */
}

.block-content {
	display: grid;
	grid-template-columns: 1fr 2fr 1fr 2fr; /* 4 columnas: Posición, Nombre, Puntos, Tiempo */
	display: flex;
	align-items: center;
	gap: 20px; /* espacio entre partes internas */
}

.block-part {
	text-align: center;
	border-radius: 4px;
}

.podium-first { 
	background: linear-gradient(to bottom, #FFD700, #B8860B);
	margin-bottom: 10px; /* Espacio entre la "posición" y los siguientes bloques */
}

.podium-second { 
	background: linear-gradient(to bottom, #C0C0C0, #808080);
	margin-bottom: 10px; /* Espacio entre la "posición" y los siguientes bloques */
}

.podium-third { 
	background: linear-gradient(to bottom, #CD7F32, #8B4513);
	margin-bottom: 10px; /* Espacio entre la "posición" y los siguientes bloques */
}

#pos1{
	background-color: #fff8dc;	
	font-size: 20px;
}

#pos2{
	background-color: #f0f0f5;	
	font-size: 18px;
}

#pos3{
	background-color: #fcebd6;	
	font-size: 16px;
}

.block-part#pos1::before {
	content: "🥇";
	font-size: 75px;
	position: relative;
	transform: translateY(-50%);
}
.block-part#pos2::before {
	content: "🥈";
	font-size: 50px;
	position: relative;
	transform: translateY(-50%);
}

.block-part#pos3::before {
	content: "🥉";
	font-size: 50px;
	position: relative;
	transform: translateY(-50%);
}

.block-part#pos4::before {
	content: "4 ";
	font-size: 30px;
	position: absolute;
	left:40px;
	transform: translateY(-50%);
}

.block-part#pos5::before {
	content: "5 ";
	left:40px;
	font-size: 30px;
	position: absolute;
	transform: translateY(-50%);
}

.block-part#pos6::before {
	content: "5 ";
	left:5px;
	font-size: 30px;
	position: absolute;
	transform: translateY(-50%);
}

.block-part#pos7::before {
	content: "5 ";
	left:40px;
	font-size: 30px;
	position: absolute;
	transform: translateY(-50%);
}

.block-part#pos8::before {
	content: "5 ";
	left:40px;
	font-size: 30px;
	position: absolute;
	transform: translateY(-50%);
}
.block-part#pos9::before {
	content: "5 ";
	left:40px;
	font-size: 30px;
	position: absolute;
	transform: translateY(-50%);
}

.block-part#pos10::before {
	content: "5 ";
	left:40px;
	font-size: 30px;
	position: absolute;
	transform: translateY(-50%);
}

.podium {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: flex-end;
	position: relative;
	top: -65px;
}

.podium .block {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 200px;
    padding: 0;
    background: none;
    box-shadow: none;
    border-radius: 0;
}

.podium .athlete-name {
    font-weight: 600;
    font-size: 16px;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 175px;
}

.podium .athlete-time {
    font-size: 16px;
	font-weight: bold;
    color: #555;
    text-align: center;
}

.podium-first {
	order: 2;
	transform: translateY(-25px);
}

.podium-second {
	order: 1;
	transform: translateY(0px);
}

.podium-third {
	order: 3;
	transform: translateY(10px);
}


.podium .underline {
    margin-top: 5px;
    width: 80%;
    height: 2px;
    background-color: #000;
}

.athlete-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 600px;
  background-color:#eee;
}

.athlete-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background-color: rgba(255, 255, 255, 0.7);
  border-radius: 6px;
  font-size: 14px;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.1);
}

.athlete {
  display: flex;
  align-items: center;
  width: 100%;
}

.athlete span:not(.points-circle) {
  margin-right: 5px;
}

.points-circle {
  width: 36px;
  max-width: 50px;
  height: 36px;
  background-color: #f1c40f;
  color: #000; /* letra blanca */
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  border-radius: 5px;
}

.points-circle-rest {
  width: 36px;
  max-width: 50px;
  height: 36px;
  background-color: #000; /* fondo negro */
  color: #fff; /* letra blanca */
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  border-radius: 5px;
}

.linkClasificacionCompleta {
    text-decoration: none; /* Quita el subrayado */
    font-weight: bold; /* Aplica el estilo de negrita */
    color: #000; /* Color del enlace (negro, puedes cambiarlo) */
	text-align: center;
}

.linkClasificacionCompleta:hover {
    color: #007bff; /* Color del enlace cuando pasa el cursor (puedes cambiarlo) */
}

.podium-header {
    text-align: center;
    font-size: 28px;
    margin-bottom: 20px;
    font-weight: 600;
    color: #333;
	position: relative;
	top: -25px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 18px;
}

th, td {
  padding: 12px;
  text-align: left;
}

th {
  background-color: #23617D;
  border: #23617D;
  color: white;
}


.position {
  font-weight: bold;
}

#imagenRankingCartel {
  border-radius: 40px; /* bordes redondeados */
  overflow: hidden; /* para que la imagen no se salga de los bordes redondeados */
  position: relative;
  z-index: 10; /* para que quede superpuesta */
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* un poco de sombra para dar el efecto de estar elevada */
  margin-top: -20px; /* levanta un poco hacia arriba */
}

#imagenRankingCartel img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* para que la imagen se recorte bien dentro del cuadrado */
  display: block;
}

.boton-personalizado {
  background-color: #4CAF50; /* Verde */
  color: white;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.boton-personalizado:hover {
  background-color: #45a049;
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.boton-personalizado:active {
  transform: scale(0.98);
}

#mapa10{
	width: 150px;
	height: 150px;
	box-shadow: 0 0 4px rgba(0,0,0,0.2);
	border-radius: 8px;
	position: absolute;
	z-index:1000000;
}

#mapaCartel{
	width: 150px;
	height: 150px;
	box-shadow: 0 0 4px rgba(0,0,0,0.2);
	border-radius: 8px;
	position: absolute;
	z-index:1000000;
}

/* Ajuste para pantallas móviles */
@media (max-width: 768px) {
    table {
        font-size: 8px; /* Más pequeño en pantallas móviles */
    }

    th, td {
        padding: 2px; /* Menos padding en móviles */
    }

    /* Contenedor de desplazamiento horizontal */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Mejora el desplazamiento en dispositivos iOS */
    }
	td.limitar {
		max-width: 100px;         /* o el valor que necesites */
		word-wrap: break-word;    /* rompe palabras si es necesario */
		white-space: normal;      /* permite saltos de línea */
	}
}

#lista-competiciones {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1rem;
}

.competicion {
	background-size: cover;
	background-position: center;
	padding: 1rem;
	color: white;
	height: 150px;
	width: 150px;
	display: flex;
	align-items: flex-end;
	border-radius: 8px;
	overflow: hidden;
}

/* Para pantallas medianas o grandes */
@media (min-width: 768px) {
	#lista-competiciones {
		grid-template-columns: repeat(4, 1fr); /* 4 columnas */
	}
}

.competicion { 
	cursor: pointer; 
	color: blue; 
	margin-bottom: 10px; 
	padding: 5px; 
}
.competicion:hover { text-decoration: underline; }
.selected { font-weight: bold; color: darkred; }
.clasificacion { display: none; margin-top: 10px; padding: 10px; border: 1px solid #ddd; }


/* Estilos para la caja emergente de detalles */
.detalle-box {
	position: fixed;
	top: 0;
	right: -350px; /* Oculta fuera de la pantalla */
	width: 300px;
	height: 100%;
	background: white;
	border-left: 1px solid #ddd;
	box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
	padding: 20px;
	transition: right 0.3s ease-in-out;
	overflow-y: auto;
}
.detalle-box.mostrar {
	right: 0; /* Desliza hacia adentro */
}
.detalle-box h2 {
	margin-top: 0;
}
.cerrar-detalle {
	position: absolute;
	top: 10px;
	right: 10px;
	background: red;
	color: white;
	border: none;
	padding: 5px 10px;
	cursor: pointer;
}

input {
  border: 1px solid #ccc;
  border-radius: 5px;
  padding: 8px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.3s ease;
}

input:focus {
  border-color: #007BFF; /* azul al hacer foco */
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.3);
}


body {
	font-family: Arial, sans-serif;
	background-color: transparent;
	text-align: center;
}
#container {
	max-width: 800px;
	margin: auto;
}
.competicion {
	position: relative;
	background-size: cover;
	background-position: center;
	color: white;
	font-size: 20px;
	font-weight: bold;
	padding: 20px;
	margin: 10px 0;
	border-radius: 10px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 150px;
}
.competicion::before {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	border-radius: 10px;
}
.competicion span {
	position: relative;
	z-index: 1;
}
#btn-add {
	font-size: 24px;
	background: #28a745;
	color: white;
	border: none;
	padding: 10px 15px;
	border-radius: 50%;
	cursor: pointer;
	position: fixed;
	bottom: 20px;
	right: 20px;
}
/* Modal */
#modal {
	display: none;
	position: fixed;
	top: 0; left: 0; right: 0; bottom: 0;
	background: rgba(0,0,0,0.5);
	justify-content: center;
	align-items: center;
}
#modal-content {
	background: white;
	padding: 20px;
	border-radius: 10px;
	width: 300px;
	text-align: center;
}
input {
	width: 90%;
	padding: 10px;
	margin: 5px 0;
}
#btn-save {
	background: #007bff;
	color: white;
	padding: 10px;
	border: none;
	cursor: pointer;
	width: 100%;
}

	.spinner {
	  display:none;
	  width: 50px;
	  height: 50px;
	  border: 5px solid #ccc;
	  border-top-color: #3498db;
	  border-radius: 50%;
	  animation: spin 1s linear infinite;
	  margin: 50px auto;
	}

	@keyframes spin {
	  to { transform: rotate(360deg); }
	}
	.mes-grupo {
		margin-bottom: 30px;
	}

	.mes-titulo {
		font-weight: bold;
		font-size: 1.2em;
		margin-bottom: 10px;
	}

	.competiciones-mes {
		display: flex;
		flex-wrap: wrap;
		gap: 10px;
	}

	.filtros {
		display: flex;
		flex-wrap: wrap;
		gap: 10px;
		margin-bottom: 20px;
	}

	.filtros input,
	.filtros button {
		padding: 10px;
		font-size: 16px;
		border-radius: 8px;
		border: 1px solid #ccc;
		flex: 1;
		min-width: 50px;
	}

	.filtros button {
		background-color: #d4a017; /* amarillo oscuro */
		color: white;
		border: none;
		cursor: pointer;
		transition: background-color 0.3s ease;
	}

	.filtros button:hover {
		background-color: #b88c14;
	}

	@media (min-width: 768px) {
		.filtros {
			flex-wrap: nowrap;
		}
	}
	
	.formulario{
		color:white;
		bottom: 100px;
		padding: 8px;
		z-index: 10000000;
	}
	.formulario input,
	.formulario button {
		padding: 10px;
		font-size: 16px;
		border-radius: 8px;
		border: 1px solid #ccc;
		flex: 1;
		min-width: 50px;
		text-align:center;
	}

	.formulario button {
		background-color: #d4a017; /* amarillo oscuro */
		color: white;
		border: none;
		cursor: pointer;
		transition: background-color 0.3s ease;
	}

	.formulario button:hover {
		background-color: #b88c14;
	}
	
	.guardar{
		position: relative;
		top: 20px;
		left: 28%;
		transform: translateX(-50%);
	}
	
	.guardar input,
	.guardar button {
		padding: 10px;
		font-size: 16px;
		border-radius: 8px;
		border: 1px solid #ccc;
		flex: 1;
		min-width: 50px;
	}

	.guardar button {
		background-color: #d4a017; /* amarillo oscuro */
		color: white;
		border: none;
		cursor: pointer;
		transition: background-color 0.3s ease;
	}

	.guardar button:hover {
		background-color: #b88c14;
	}	
	
#resultado {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 1rem;
  overflow-x: auto; /* útil si tienes tablas o contenido ancho */
  font-size: 1rem;
  word-wrap: break-word;
}