/* Estilos generales */
body {
  font-family: Verdana, sans-serif;
  /* tono arena */
  background-color: #F4EAD5;
  margin: 0;
  padding: 0;
}

* {
  box-sizing: border-box;
}

header {
  background-color: #E8DDB5;
  padding: 20px;
  text-align: center;
}

header img#logo {
  max-width: 100px;
  display: block;
  margin: 0 auto;
}

h1 {
  margin: 10px 0 0 0;
  font-size: 24px;
}

/* Navegación (tabs) */
nav.tabs {
  display: flex;
  background-color: #D2BA8E;
}

nav.tabs button {
  flex: 1;
  padding: 15px;
  border: none;
  background-color: #D2BA8E;
  color: #333;
  cursor: pointer;
  font-size: 16px;
}

nav.tabs button.active,
nav.tabs button:hover {
  background-color: #BFA376;
}

/* Contenido de pestañas */
.tabcontent {
  display: none;
  padding: 20px;
}

.tabcontent.active {
  display: block;
}

/* Formularios y filtros */
.form-container {
  margin-bottom: 20px;
}

.form-container form input,
.form-container form select,
.form-container form button {
  padding: 10px;
  margin: 5px;
  font-size: 14px;
}

/* Input específico para número de fallero */
#falleroNumero {
  min-width: 200px;
}

/* Input específico para nombre de evento - ocupa todo el ancho */
#eventoNombre {
  width: calc(100% - 20px); /* Resta padding y margin */
  max-width: 100%;
  box-sizing: border-box;
}

/* Ayuda del formulario */
.form-help {
  display: block;
  margin-top: 10px;
  color: #666;
  font-size: 12px;
  line-height: 1.4;
}

/* Contenedor de inputs de fecha */
.date-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 5px;
}

.date-inputs label {
  font-weight: bold;
  font-size: 13px;
  color: #555;
  margin-bottom: 3px;
}

.date-inputs input[type="datetime-local"] {
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  background-color: #fff;
}

.date-inputs input[type="datetime-local"]:focus {
  outline: none;
  border-color: #D2BA8E;
  box-shadow: 0 0 0 2px rgba(210, 186, 142, 0.2);
}

.filter-container {
  margin-bottom: 10px;
}

/* Pestaña Fallero */
#falleroTab {
  display: none;
  padding: 20px;
}

#falleroTab.active {
  display: block;
}

.filter-container input {
  width: 100%;
  padding: 10px;
  font-size: 14px;
}

/* Tablas */
table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
}

table th,
table td {
  padding: 10px;
  border: 1px solid #ccc;
  text-align: left;
}

table th {
  cursor: pointer;
  background-color: #f0e6d2;
}

tbody>tr:hover {
  background-color: #F4EAD5;
}

#asistenciaTable thead th {
  position: sticky;
  top: 0;
  background-color: #fff;
  z-index: 1;
}


#asistenciaTable tbody tr td:nth-child(4), #asistenciaTable tbody tr td:nth-child(5) {
  text-align: center;
}

.scrollbox {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #ccc;
  padding: 10px;
  background: #fff;
}

.fallero-item {
  padding: 8px;
  cursor: pointer;
  border-bottom: 1px solid #ddd;
}

.fallero-item:hover {
  background-color: #f0e6d2;
}

#falleroEventos {
  margin-top: 20px;
}

#falleroEventosLista li {
  list-style: none;
  padding: 5px 0;
  display: flex;
  justify-content: space-between;
}

#falleroEventosLista button {
  padding: 5px 10px;
  background: #BFA376;
  color: white;
  border: none;
  cursor: pointer;
}

/* Botones con íconos */
button.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
}

button.icon-btn img {
  width: 20px;
  height: 20px;
  margin-left: 10px;
}

.icon-excel img {
  width: 30px;
  height: 20px;
  cursor: pointer;
  border: none;
  margin-left: 10px;
}


/* Selección de evento */
#eventoSeleccionado {
  margin-bottom: 10px;
  padding: 10px;
  background-color: #eee;
}

/* Responsive */
@media (max-width: 600px) {
  nav.tabs button {
    font-size: 14px;
    padding: 10px;
  }

  header h1 {
    font-size: 20px;
  }

  .form-container form input,
  .form-container form select,
  .form-container form button {
    font-size: 12px;
    padding: 8px;
    margin: 3px;
  }

  table th,
  table td {
    padding: 8px;
    font-size: 12px;
  }

  #falleroEventosLista button:hover {
    background: #A08962;
  }
}

/* ========== PERFORMANCE & UX IMPROVEMENTS ========== */

/* Estados vacíos y de error */
.empty-state td, .error-state td {
  text-align: center;
  color: #666;
  font-style: italic;
  padding: 20px;
}

.error-state td {
  color: #d63384;
  background-color: #f8d7da;
}

/* Indicadores de loading */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #ddd;
  border-top: 4px solid #D2BA8E;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Sistema de notificaciones */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  max-width: 400px;
}

.notification {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin-bottom: 10px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  animation: slideIn 0.3s ease;
}

.notification-success { background-color: #198754; color: white; }
.notification-error { background-color: #dc3545; color: white; }
.notification-warning { background-color: #ffc107; color: black; }
.notification-info { background-color: #0dcaf0; color: black; }

.notification button {
  background: none;
  border: none;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  margin-left: 10px;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Mejoras en botones y formularios */
.form-container form button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-container form input:focus,
.form-container form select:focus {
  outline: none;
  border-color: #D2BA8E;
  box-shadow: 0 0 0 2px rgba(210, 186, 142, 0.2);
}

/* Mejoras para accesibilidad */
.icon-btn:focus {
  outline: 2px solid #D2BA8E;
  outline-offset: 2px;
}

/* Checkboxes optimizados */
input[type="checkbox"]:focus {
  outline: 2px solid #D2BA8E;
  outline-offset: 2px;
}

/* Responsive mejorado para notificaciones */
@media (max-width: 768px) {
  .date-inputs {
    gap: 8px;
  }

  .date-inputs input[type="datetime-local"] {
    font-size: 16px; /* Evita zoom en iOS */
  }

  .notification-container {
    left: 10px;
    right: 10px;
    max-width: none;
  }

  .notification {
    font-size: 14px;
    padding: 12px;
  }
}

/* Clases de accesibilidad */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mejorar focus visible para navegación con teclado */
button:focus,
input:focus,
select:focus,
a:focus,
[tabindex]:focus {
  outline: 2px solid #2196F3;
  outline-offset: 2px;
}

/* Indicadores visuales para elementos interactivos */
[role="tab"][aria-selected="true"] {
  background-color: #BFA376;
  font-weight: bold;
}

[role="columnheader"]:hover {
  background-color: #E8DDB5;
  cursor: pointer;
}

[role="columnheader"][aria-sort="ascending"]::after {
  content: " ↑";
}

[role="columnheader"][aria-sort="descending"]::after {
  content: " ↓";
}

/* Mejorar contraste para mejor legibilidad */
th[role="columnheader"] {
  background-color: #D2BA8E;
  color: #333;
  font-weight: bold;
}

/* Estados de focus mejorados para elementos de tabla */
table[role="table"] {
  border-collapse: collapse;
}

table[role="table"] th,
table[role="table"] td {
  border: 1px solid #D2BA8E;
}

/* Indicadores de estado para elementos dinámicos */
[aria-live] {
  min-height: 20px;
}

/* Mejorar visibilidad de elementos de formulario */
label {
  font-weight: 500;
  color: #333;
}

/* Estados hover y focus consistentes */
input:hover:not(:disabled),
select:hover:not(:disabled),
button:hover:not(:disabled) {
  border-color: #BFA376;
  box-shadow: 0 0 0 1px #BFA376;
}

/* Alto contraste para textos de ayuda */
.form-help {
  color: #666;
  line-height: 1.4;
}

/* Indicadores visuales para elementos requeridos */
input[required]::placeholder,
textarea[required]::placeholder {
  font-weight: 600;
  opacity: 1;
}

input[required]:invalid,
textarea[required]:invalid {
  color: #f44336;      /* rojo si inválido */
}

input[required]:valid,
textarea[required]:valid {
  color: #4caf50;      /* verde si válido */
}

/* Estados de error para tablas */
.error-state {
  background-color: #ffeaa7 !important;
}

.error-state td {
  text-align: center;
  color: #d63031;
  font-weight: bold;
  padding: 20px;
}
