body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f9f9f9;
  color: #333;
  overflow-x: hidden;
}

.titulo {
  background-color: #062794;
  color: white;
  text-align: center;
  padding: 10px 0;
}

.titulo h1 {
  margin: 5px 0;
  font-size: clamp(18px, 4vw, 28px);
}

.titulo h2 {
  margin: 1%;
  font-size: clamp(14px, 3vw, 20px);
  letter-spacing: 1px;
}

.titulo h3 {
  margin-top: 10px;
  font-size: clamp(12px, 2.5vw, 15px);
  font-weight: normal;
}

h4 {
  margin: 0px;
  padding: 0px;
  font-size: clamp(13px, 2.5vw, 15px);
  font-weight: 700;
  color: #11791f;
}

/*******************************************************/

#fileNameDisplay {
  text-align: center;
  padding-top: 8px;
  color: #777;
  font-style: italic;
  font-size: clamp(12px, 2vw, 14px);
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 15px 10px;
  background-color: #e6ecff;
}

.acciones button {
  padding: 10px 15px;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  font-size: clamp(12px, 2vw, 14px);
  white-space: nowrap;
}

input {
  padding: 8px 5px;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  text-decoration-line: none;
}

.acciones1 button {
  width: 40%;
  margin: 2px;
  padding: 8px 10px;
  border: none;
  border-radius: 4px;
  font-weight: bold;
  flex-wrap: nowrap;
}

#sortear {
  background-color: rgb(43, 156, 43);
}

#sortear:hover {
  background-color: #11791f;
}

.ganador {
  text-align: center;
  color: rgb(0, 13, 189);
}

/* Estilo personalizado para el botón */
.file-input-label {
  display: inline-block;
  padding: 10px 15px;
  background-color: #cf4355;
  color: #ffffff;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: clamp(12px, 2vw, 14px);
}

.acciones button {
  background-color: #1e42bb;
  color: white;
  cursor: pointer;
}

#asistencia {
  padding: 10px 15px;
}

#reiniciarSorteo {
  background-color: #ffa500;
}

#reiniciarTodo {
  background-color: #cf4355;
}

#reiniciarSorteo:hover {
  background-color: #ff8c00;
}

#exportarJSON {
  background-color: #28a745;
  color: white;
}

#exportarJSON:hover {
  background-color: #218838;
}

.acciones1 button {
  background-color: #062794;
  color: white;
  cursor: pointer;
}

.acciones button:hover,
.acciones1 button:hover {
  background-color: #041c6d;
}

.contenido {
  display: flex;
  flex-direction: row;
  justify-content: center;
  padding: 10px;
  gap: 10px;
}

.izquierda,
.derecha {
  flex: 1;
  max-width: 100%;
}

.izquierda {
  margin-top: 20px;
}

.ruleta-container {
  position: relative;
  max-width: 100%;
  width: 100%;
  margin: auto;
  justify-content: center;
  align-items: center;
}

.flecha {
  margin-top: 8px;
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 30px solid rgb(218, 2, 2);
  z-index: 10;
  animation: pulse 1s infinite alternate;
}

@keyframes pulse {
  from {
    transform: translateX(-50%) scale(1);
  }
  to {
    transform: translateX(-50%) scale(1.1);
  }
}

#canvas {
  width: 100%;
  max-width: 570px;
  height: auto;
  display: block;
  margin: auto;
  background: #fff;
  border: 2px solid #b2f0ff;
  border-radius: 10px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#animacion {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(20px, 5vw, 35px);
  font-weight: bold;
  color: rgb(13, 170, 13);
  text-align: center;
  z-index: 5;
  border-style: solid;
  border-color: #c5ffc333;
  background-color: #dbdbdba4;
  border-radius: 15px;
  padding: 10px;
}

.grid-grupos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0px;
}

.grupo-box {
  background-color: #fcfcfc;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 5px rgba(100, 144, 173, 0.308);
}

.grupo-box h3 {
  margin-top: 0;
  color: #062794ec;
  font-size: clamp(14px, 2.5vw, 18px);
}

/* Estilos para los botones */
.grupo-box button {
  padding: 8px 12px;
  margin: 5px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.3s;
  font-size: clamp(12px, 2vw, 14px);
}

.grupo-box button:first-of-type {
  background-color: #28a745;
  color: white;
}

.grupo-box button:first-of-type:hover {
  background-color: #218838;
}

.grupo-box button:last-of-type {
  background-color: #28a745;
  color: #ffffff;
}

.grupo-box button:last-of-type:hover {
  background-color: #218838;
}

.resultados-scroll {
  max-height: 150px;
  overflow-y: auto;
  margin-top: 2px;
  padding-top: 5px;
  font-size: clamp(12px, 2vw, 14px);
}

.subgrupos div {
  display: flex;
  gap: 10px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.subgrupos input {
  flex: 1;
  min-width: 80px;
  font-size: clamp(12px, 2vw, 14px);
}

.subgrupos div input {
  color: #ffffff;
}

.resultados-scroll {
  overflow-y: auto;
  flex: 1;
  background-color: white;
  margin-top: 10px;
  padding: 8px;
  border-radius: 4px;
  font-size: clamp(12px, 2vw, 14px);
  line-height: 1.4;
}

#animacion {
  animation: zoomGanador 0.5s ease-out;
}

@keyframes zoomGanador {
  from {
    transform: scale(0.3) translate(-50%, -50%);
    opacity: 0;
  }
  to {
    transform: scale(1) translate(-50%, -50%);
    opacity: 1;
  }
}

.subgrupos input[type="number"] {
  max-width: 60px;
  text-align: center;
}

/*agregadoo v.1.*/
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
}

.modal-content {
  background-color: white;
  padding: 30px 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.modal-content h1 {
  color: #062794;
  font-size: clamp(20px, 4vw, 32px);
  margin-bottom: 15px;
}

.modal-content h2 {
  color: #444;
  margin-top: 10px;
  font-size: clamp(16px, 3vw, 24px);
}

.modal-content p {
  margin: 20px 0;
  font-size: clamp(14px, 2vw, 16px);
  color: #555;
}

.modal-content button {
  margin: 10px 5px;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: clamp(14px, 2vw, 16px);
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

#aceptaBtn {
  background-color: #28a745;
  color: white;
}

#aceptaBtn:hover {
  background-color: #218838;
}

#rechazaBtn {
  background-color: #dc3545;
  color: white;
}

#rechazaBtn:hover {
  background-color: #c82333;
}

/* ============================
   SISTEMA DE MODOS ADMIN/PÚBLICO
   ============================ */
.admin-only {
  /* Será controlado por JavaScript */
}

/* Botón discreto en esquina superior derecha */
#btnAdminEsquina {
  position: fixed;
  top: 15px;
  right: 15px;
  width: 45px;
  height: 45px;
  background-color: #062794;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  font-size: 20px;
}

#btnAdminEsquina:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

#btnAdminEsquina:active {
  transform: scale(0.95);
}

/* Animaciones para notificaciones */
@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

/* ============================
   MEDIA QUERIES RESPONSIVE
   ============================ */

/* Tablets en horizontal y pantallas medianas */
@media (max-width: 1024px) {
  .contenido {
    flex-direction: column;
  }

  .izquierda {
    margin-top: 10px;
    order: 2;
  }

  .derecha {
    order: 1;
  }

  #canvas {
    max-width: 450px;
  }
}

/* Tablets en vertical */
@media (max-width: 768px) {
  .titulo {
    padding: 8px 0;
  }

  .titulo h1 {
    font-size: 20px;
  }

  .titulo h2 {
    font-size: 16px;
  }

  .titulo h3 {
    font-size: 13px;
  }

  .acciones {
    gap: 6px;
    padding: 10px 5px;
  }

  .acciones button {
    padding: 8px 10px;
    font-size: 12px;
  }

  .file-input-label {
    padding: 8px 10px;
    font-size: 12px;
  }

  .grid-grupos {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .grupo-box {
    padding: 8px;
  }

  .grupo-box h3 {
    font-size: 15px;
  }

  .grupo-box button {
    padding: 6px 10px;
    font-size: 12px;
    width: 100%;
    margin: 3px 0;
  }

  .resultados-scroll {
    max-height: 120px;
    font-size: 12px;
  }

  #canvas {
    max-width: 350px;
  }

  .modal-content {
    padding: 20px 15px;
  }

  #btnAdminEsquina {
    width: 40px;
    height: 40px;
    font-size: 18px;
    top: 10px;
    right: 10px;
  }
}

/* Móviles */
@media (max-width: 480px) {
  .titulo {
    padding: 5px 0;
  }

  .titulo h1 {
    font-size: 16px;
    margin: 3px 0;
  }

  .titulo h2 {
    font-size: 13px;
  }

  .titulo h3 {
    font-size: 11px;
    margin-top: 5px;
  }

  .acciones {
    gap: 5px;
    padding: 8px 5px;
  }

  .acciones button {
    padding: 6px 8px;
    font-size: 11px;
  }

  .file-input-label {
    padding: 6px 8px;
    font-size: 11px;
  }

  #fileNameDisplay {
    font-size: 11px;
    padding-top: 5px;
  }

  .contenido {
    padding: 5px;
    gap: 5px;
  }

  .izquierda {
    margin-top: 5px;
  }

  .grid-grupos {
    gap: 6px;
  }

  .grupo-box {
    padding: 6px;
  }

  .grupo-box h3 {
    font-size: 13px;
    margin-bottom: 5px;
  }

  .grupo-box button {
    padding: 5px 8px;
    font-size: 11px;
    margin: 2px 0;
  }

  .subgrupos div {
    gap: 5px;
  }

  .subgrupos input {
    padding: 5px;
    font-size: 11px;
    min-width: 60px;
  }

  .subgrupos input[type="number"] {
    max-width: 40px;
  }

  .resultados-scroll {
    max-height: 100px;
    font-size: 11px;
    padding: 5px;
  }

  #canvas {
    max-width: 280px;
    border-width: 1px;
  }

  .flecha {
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 22px solid rgb(218, 2, 2);
  }

  .modal-content {
    padding: 15px 10px;
    width: 95%;
  }

  .modal-content h1 {
    font-size: 18px;
    margin-bottom: 10px;
  }

  .modal-content h2 {
    font-size: 15px;
  }

  .modal-content button {
    padding: 8px 15px;
    font-size: 13px;
    margin: 5px 3px;
  }

  #btnAdminEsquina {
    width: 35px;
    height: 35px;
    font-size: 16px;
    top: 8px;
    right: 8px;
  }
}

/* Móviles muy pequeños */
@media (max-width: 360px) {
  .titulo h1 {
    font-size: 14px;
  }

  .titulo h2 {
    font-size: 12px;
  }

  .titulo h3 {
    font-size: 10px;
  }

  .acciones button,
  .file-input-label {
    font-size: 10px;
    padding: 5px 6px;
  }

  .grupo-box h3 {
    font-size: 12px;
  }

  .grupo-box button {
    font-size: 10px;
    padding: 4px 6px;
  }

  #canvas {
    max-width: 240px;
  }
}

/* Pantallas muy grandes */
@media (min-width: 1400px) {
  .contenido {
    max-width: 1400px;
    margin: 0 auto;
  }

  .grid-grupos {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Modo landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
  .titulo {
    padding: 3px 0;
  }

  .titulo h1,
  .titulo h2,
  .titulo h3 {
    margin: 2px 0;
  }

  .acciones {
    padding: 5px;
    gap: 4px;
  }

  .contenido {
    padding: 5px;
  }

  .izquierda {
    margin-top: 5px;
  }

  #canvas {
    max-width: 250px;
  }

  .grid-grupos {
    grid-template-columns: repeat(2, 1fr);
  }

  .grupo-box {
    padding: 5px;
  }

  .resultados-scroll {
    max-height: 80px;
  }
}