/* ============================================
   LAYOUT UNIFICADO - Todas las páginas
   ============================================ */

/* Área principal de contenido (main) */
.page-main {
  flex: 1 1 0%;
  width: 100%;
  overflow: auto;
  padding: 1rem;
  margin-left: 0;
}
@media (min-width: 640px) {
  .page-main { padding: 1.5rem; }
}
@media (min-width: 768px) {
  .page-main { margin-left: 16rem; }
}

/* Título de página (h1) - mismo tamaño y estilo en toda la app */
.page-title {
  font-size: 1.5rem;
  line-height: 1.75rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .page-title {
    font-size: 1.875rem;
    line-height: 2.25rem;
  }
}
.page-title.mb-0 { margin-bottom: 0; }

/* Contenedor tipo card: TODAS las páginas usan la misma card y el mismo ancho */
.page-card {
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  background-color: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  border: 1px solid #e5e7eb;
  padding: 1rem;
}
@media (min-width: 640px) {
  .page-card { padding: 1.5rem; }
}
@media (min-width: 768px) {
  .page-card { padding: 2rem; }
}

/* Estilos para links del sidebar */
aside nav a {
  display: block;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem; /* rounded-md */
  font-weight: 600;
  color: black;
  transition: background-color 0.2s ease, color 0.2s ease;
  user-select: none;
  text-decoration: none;
}
aside nav a:hover,
aside nav a:focus {
  background-color: black;
  color: #ffffff;
  outline: none;
}
/* Estilo para el link activo del sidebar */
aside nav a.activo {
  background-color: black;
  color: #ffffff;
  font-weight: 700;
}

/* Scroll para menú lateral */
aside nav {
  scrollbar-width: thin;
  scrollbar-color: #e6c484 transparent;
}

aside nav::-webkit-scrollbar {
  width: 8px;
}

aside nav::-webkit-scrollbar-track {
  background: transparent;
}

aside nav::-webkit-scrollbar-thumb {
  background-color: #e6c484;
  border-radius: 10px;
  border: 2px solid transparent;
}

/* Para los botones de accesos rápidos */
a.bg-indigo-600,
a.bg-gray-600 {
  user-select: none;
}

/* Mensaje Toast */
#toast {
  font-weight: 600;
  pointer-events: none;
  /* Ya tiene transiciones en inline style */
}

/* Tabla responsive */
table {
  border-collapse: collapse;
}

th, td {
  border: 1px solid #d1d5db; /* gray-300 */
  padding: 0.5rem 1rem;
  text-align: left;
  vertical-align: middle;
}

th {
  background-color: #f3f4f6; /* gray-100 */
  user-select: none;
}

/* Centrar canvas en cards */
canvas {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Min height para cards con gráficas para evitar salto de layout */
section.mb-12 > div.grid > div {
  min-height: 200px;
}

/* Ajustes para foco accesible */
button:focus, a:focus {
  outline: 2px solid #e6c484;
  outline-offset: 2px;
}


/* DISEÑOS */
/* Fuente global */
body {
  font-family: 'Raleway', sans-serif;
}

/* Fondo del modal */
#modal,
#modalGaleria {
  background-color: rgba(0, 0, 0, 0.7);
}

/* Estructura del modal galería */
#modalGaleria {
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

/* Imagen principal dentro del modal */
#imagenSlider {
  max-height: 85vh;
  max-width: 90vw;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s ease;
}

/* Botones de navegación (prev / next) */
#btnPrev,
#btnNext {
  background-color: rgba(230, 196, 132, 0.9);
  color: black;
  border-radius: 9999px;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  font-size: 1.4rem;
  z-index: 60;
  transition: background-color 0.2s ease;
}

#btnPrev:hover,
#btnNext:hover {
  background-color: #c3a96d;
}

#btnPrev {
  position: absolute;
  left: 2rem;
}

#btnNext {
  position: absolute;
  right: 2rem;
}

/* Botón cerrar modal */
#cerrarGaleria {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 2.5rem;
  color: white;
  background-color: transparent;
  border: none;
  cursor: pointer;
  z-index: 70;
  transition: color 0.2s ease;
}

#cerrarGaleria:hover {
  color: #e6c484;
}

/* Diseño de las tarjetas en la galería */
.diseño-card img {
  max-height: 200px;
  width: auto;
  object-fit: contain;
}

/* Toast de mensaje */
#toast {
  transition: opacity 0.3s ease;
}

/* Loading states */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Mejoras de UX */
.form-group {
  transition: all 0.2s ease;
}

.form-group:focus-within {
  transform: translateY(-1px);
}

/* Animaciones suaves para botones */
button, .btn {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

button:hover, .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

button:active, .btn:active {
  transform: translateY(0);
}

/* Efecto ripple para botones */
button::before, .btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

button:active::before, .btn:active::before {
  width: 300px;
  height: 300px;
}

/* Mejoras para tablas */
table {
  border-collapse: collapse;
}

.estado-dropdown {
  z-index: 50 !important;
  min-width: 9rem;
  pointer-events: auto;
}

/* Mejoras para modales */
.modal {
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Mejoras para cards */
.card {
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
  border-color: #e2e8f0;
}

/* Mejoras para inputs */
input, select, textarea {
  transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  transform: scale(1.02);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Estados de validación */
.input-error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.input-success {
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Mejoras para dropdowns */
.dropdown {
  animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Mejoras para gráficos */
canvas {
  transition: all 0.3s ease;
}

canvas:hover {
  transform: scale(1.05);
}

/* Mejoras para navegación */
nav a {
  position: relative;
  overflow: hidden;
}

nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: currentColor;
  transition: left 0.3s ease;
}

nav a:hover::after,
nav a.activo::after {
  left: 0;
}

/* Mejoras para alertas */
.alert {
  animation: alertSlide 0.3s ease;
}

@keyframes alertSlide {
  from {
    opacity: 0;
    transform: translateX(-100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Mejoras para paginación */
.pagination a {
  transition: all 0.2s ease;
}

.pagination a:hover {
  transform: scale(1.1);
}

/* Mejoras para tooltips */
.tooltip {
  position: relative;
}

.tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2937;
  color: white;
  padding: 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.tooltip:hover::before {
  opacity: 1;
}

/* Mejoras para responsive */
@media (max-width: 768px) {
  .card:hover {
    transform: none;
  }

  input:focus, select:focus, textarea:focus {
    transform: none;
  }
}