/* ==========================================================================
   🎯 ESTILOS DEL PROYECTO: BÚSQUEDA DE EMPRESAS - SEPREC
   ==========================================================================
   Este archivo está dividido en 4 secciones principales:
   1. Estilos generales y reset
   2. Diseño del BUSCADOR
   3. Diseño de la LISTA de empresas
   4. Diseño del DETALLE (acordeón)
   ========================================================================== */


/* ==========================================================================
   1. 🧱 ESTILOS GENERALES Y RESET
   -------------------------------------------------------------------------- 
   - Reset básico de márgenes y box-sizing
   - Fuente principal y colores base
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background-color: #f9f9f9;
  color: #222;
  line-height: 1.6;
  padding: 20px;
  max-width: 900px;
  margin: 0 auto;
}

h1 {
  font-size: 1.6rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 8px;
  color: #1a1a1a;
}

p.center {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  margin-bottom: 20px;
}

/* Clase para ocultar elementos */
.hidden {
  display: none;
}

/* Mensaje de carga */
#loading {
  text-align: center;
  margin: 20px 0;
  color: #666;
  font-style: italic;
}


/* ==========================================================================
   2. 🔍 DISEÑO DEL BUSCADOR
   -------------------------------------------------------------------------- 
   - Contenedor de búsqueda
   - Estilos del input y botón
   ========================================================================== */
.search-container {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

#searchInput {
  flex: 1;
  min-width: 200px;
  padding: 12px 16px;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  outline: none;
}

#searchInput:focus {
  border-color: #0077cc;
}

#searchBtn,
#exportExcel {
  padding: 12px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
#searchBtn {
  background-color: #0077cc;
  color: white;
}

#searchBtn:hover {
  background-color: #005fa3;
}

#exportExcel {
  background-color: #1d6f42;
  color:white;
}
#exportExcel:not(:disabled) {
  background-color: #165c34;
}
#exportExcel:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

/* ==========================================================================
   3. 📋 DISEÑO DE LA LISTA DE EMPRESAS
   -------------------------------------------------------------------------- 
   - Título de resultados
   - Tarjeta de cada empresa
   - Encabezado clickeable (acordeón)
   - Estado y formato visual
   ========================================================================== */
#results h2 {
  font-size: 1.2rem;
  font-weight: 500;
  color: #333;
  margin: 20px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #eee;
}

.empresa-item {
  margin-bottom: 1px;
  border-bottom: 1px solid #f0f0f0;
  border-radius: 6px;
  padding: 2px;
}

.empresa-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 1rem;
  color: #1a1a1a;
  padding-left: 10px;
}

.empresa-header .info {
  flex: 1;
}

.empresa-header .info strong {
  font-size: 1.05rem;
  font-weight: 500;
}

.empresa-header .info small {
  display: block;
  color: #555;
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Colores para estado de la empresa */
.estado-activo {
  color: #2e8b57;
  font-weight: 500;
}

.estado-cancelado {
  color: #a00;
  font-weight: 500;
}

/* Ícono del acordeón */
.empresa-header .icon {
  font-size: 1.2rem;
  color: #888;
  min-width: 28px;
  text-align: center;
  font-weight: bold;
}


/* ==========================================================================
   4. 📄 DISEÑO DEL DETALLE (ACORDEÓN DESPLEGABLE)
   -------------------------------------------------------------------------- 
   - Transición suave al abrir/cerrar
   - Formato de detalle tipo tabla con grid
   - Etiquetas y valores bien alineados
   ========================================================================== */
.empresa-body {
  padding: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
}

.empresa-body.open {
  max-height: 60vh;
  padding: 12px 16px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  background-color: white;
}

.empresa-body {
  background-color: white;
  border: 1px solid transparent;
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
  overflow-y: auto;
  line-height: 1.5;
}
.empresa-body::-webkit-scrollbar{
  width: 8px;
}
.empresa-body::-webkit-scrollbar-track{
  background: #f0f0f0;
  border-radius: 4px;
}


/* Diseño de cada fila de detalle */
.detalle-grid {
  display: grid;
  grid-template-columns: 1fr 2fr; /* Etiqueta | Valor */
  gap: 12px;
  padding: 5px 6px;
}

.label {
  font-size: 0.9rem;
  font-weight: 500;
  color: #555;
  padding: 5px 0;
}

.value {
  font-size: 0.95rem;
  color: #222;
  padding: 6px 0;
}

.value span.estado-activo {
  color: #2e8b57;
  font-weight: 500;
}


/* ==========================================================================
   5. 📈 PAGINACIÓN (opcional)
   -------------------------------------------------------------------------- 
   - Estilos para botones de página anterior/siguiente
   ========================================================================== */
.paginacion {
  margin: 20px 0;
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 0.9rem;
}

.paginacion button {
  padding: 6px 12px;
  border: 1px solid #ccc;
  background: white;
  border-radius: 4px;
  cursor: pointer;
}

.paginacion button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/*
estilo para boton de exportar a excel
*/
.export-container {
  text-align: center;
  margin: 15px 0;
}

#exportExcel {
  padding: 10px 20px;
  font-size: 1rem;
  background-color: #1d6f42;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

#exportExcel:hover {
  background-color: #165c34;
}

#exportExcel:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}