:root {
  --color-principal: #062794;
  --color-fondo: #f5f7fb;
  --color-borde: #d1d9e6;
  --color-acento: #4CAF50;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--color-fondo);
  color: #333;
  overflow-x: hidden;
}

header {
  background-color: var(--color-principal);
  color: white;
  padding: 20px;
  text-align: center;
}

header h1 {
  font-size: clamp(16px, 4vw, 24px);
  margin: 0;
}

section {
  max-width: 1000px;
  margin: 20px auto;
  background-color: white;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.panel-carga label,
.panel-dni label {
  font-weight: bold;
  display: block;
  margin-top: 10px;
  font-size: clamp(13px, 2.5vw, 15px);
}

input[type="file"],
input[type="number"],
input[type="text"],
select {
  display: inline-block;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  margin: auto;
  border-radius: 5px;
  border: 1px solid var(--color-borde);
  font-size: clamp(13px, 2.5vw, 14px);
  box-sizing: border-box;
}

#infoParticipante {
  margin-top: 10px;
  padding: 10px;
  background-color: #cad6ff;
  border: 1px solid var(--color-borde);
  border-radius: 5px;
  font-size: clamp(12px, 2.5vw, 14px);
}

.botones-asistencia {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.botones-asistencia button {
  flex: 1;
  min-width: 120px;
  padding: 12px 20px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  cursor: pointer;
  font-size: clamp(13px, 2.5vw, 15px);
  transition: opacity 0.3s;
}

#btnPresente {
  background-color: #4CAF50;
  color: white;
}

#btnAusente {
  background-color: #f44336;
  color: white;
}

.botones-asistencia button:hover {
  opacity: 0.9;
}

.presente {
  background-color: #d0f0d0 !important;
  color: #256029;
  font-weight: bold;
}

.ausente {
  background-color: #fbdada !important;
  color: #b70000;
  font-weight: bold;
}

.panel-tabla {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  font-size: clamp(12px, 2vw, 14px);
}

table, th, td {
  border: 1px solid var(--color-borde);
}

th, td {
  padding: 10px;
  text-align: center;
}

th {
  background-color: #e7ecff;
  color: var(--color-principal);
  font-weight: bold;
  white-space: nowrap;
}

#btnExportar,
#btnExportarData {
  margin-top: 15px;
  margin-right: 10px;
  padding: 12px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: clamp(13px, 2.5vw, 15px);
  font-weight: bold;
  transition: background-color 0.3s;
}

#btnExportar {
  background-color: var(--color-principal);
  color: white;
}

#btnExportar:hover {
  background-color: #031d65;
}

#btnExportarData {
  background-color: var(--color-acento);
  color: white;
}

#btnExportarData:hover {
  background-color: #036513;
}

#fileStatus {
  margin-top: 10px;
  font-weight: bold;
  font-size: clamp(12px, 2.5vw, 14px);
}

/* ============================
   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);
}

/* Modal overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  padding: 20px;
}

.modal-content {
  background-color: white;
  padding: 30px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  max-width: 400px;
  width: 90%;
}

/* 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 */
@media (max-width: 768px) {
  header {
    padding: 15px 10px;
  }

  header h1 {
    font-size: 18px;
  }

  section {
    margin: 15px 10px;
    padding: 15px;
  }

  .botones-asistencia {
    flex-direction: column;
    gap: 8px;
  }

  .botones-asistencia button {
    min-width: 100%;
    padding: 10px 15px;
  }

  #btnExportar,
  #btnExportarData {
    width: 100%;
    margin: 8px 0;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 8px 5px;
  }

  #btnAdminEsquina {
    width: 40px;
    height: 40px;
    font-size: 18px;
    top: 10px;
    right: 10px;
  }
}

/* Móviles */
@media (max-width: 480px) {
  header {
    padding: 10px 5px;
  }

  header h1 {
    font-size: 15px;
    line-height: 1.3;
  }

  section {
    margin: 10px 5px;
    padding: 10px;
    border-radius: 8px;
  }

  .panel-carga label,
  .panel-dni label {
    font-size: 13px;
    margin-top: 8px;
  }

  input[type="file"],
  input[type="number"],
  input[type="text"],
  select {
    padding: 8px;
    font-size: 13px;
  }

  #infoParticipante {
    padding: 8px;
    font-size: 12px;
  }

  .botones-asistencia button {
    padding: 10px 12px;
    font-size: 13px;
  }

  #btnExportar,
  #btnExportarData {
    padding: 10px 15px;
    font-size: 13px;
    margin: 6px 0;
  }

  table {
    font-size: 11px;
  }

  th, td {
    padding: 6px 4px;
  }

  /* Hacer la tabla scrolleable horizontalmente en móviles */
  .panel-tabla {
    overflow-x: scroll;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 500px;
  }

  #btnAdminEsquina {
    width: 35px;
    height: 35px;
    font-size: 16px;
    top: 8px;
    right: 8px;
  }

  .modal-content {
    padding: 20px 15px;
    width: 95%;
  }
}

/* Móviles muy pequeños */
@media (max-width: 360px) {
  header h1 {
    font-size: 13px;
  }

  section {
    margin: 8px 3px;
    padding: 8px;
  }

  .panel-carga label,
  .panel-dni label {
    font-size: 12px;
  }

  input[type="file"],
  input[type="number"],
  input[type="text"],
  select {
    padding: 6px;
    font-size: 12px;
  }

  .botones-asistencia button {
    padding: 8px 10px;
    font-size: 12px;
  }

  #btnExportar,
  #btnExportarData {
    padding: 8px 12px;
    font-size: 12px;
  }

  table {
    font-size: 10px;
  }

  th, td {
    padding: 5px 3px;
  }

  #btnAdminEsquina {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }
}

/* Landscape en móviles */
@media (max-height: 500px) and (orientation: landscape) {
  header {
    padding: 8px 5px;
  }

  header h1 {
    font-size: 14px;
  }

  section {
    margin: 10px;
    padding: 10px;
  }

  .botones-asistencia {
    flex-direction: row;
  }

  .botones-asistencia button {
    padding: 8px 10px;
  }
}

/* Pantallas grandes */
@media (min-width: 1200px) {
  section {
    max-width: 1200px;
    padding: 30px;
  }

  table {
    font-size: 15px;
  }

  th, td {
    padding: 12px;
  }
}