/* ----------------------------------------------------------------------------------- */
/* --- ESTILOS GENERALES Y CABECERA --- */
/* ----------------------------------------------------------------------------------- */

body {
  background: linear-gradient(180deg, #d9dde3 0%, #f4f6f9 100%);
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
}

/* Franja azul superior fija */
.header-band {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 70px;
  background: linear-gradient(90deg, #09477e 0%, #0d6efd 100%);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  z-index: 10;
}

/* Contenedor del logo y título */
.header-content-v2 {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  position: fixed;       /* ahora está fija */
  top: 0;
  left: 20px;
  z-index: 20;
  height: 70px;          /* misma altura que la barra azul */
  padding-right: 20px;
}

.app-container-start {
  margin-top: 130px;     /* deja espacio debajo del header fijo */
}

/* Logo con borde redondeado, sombra y borde blanco */
.banner-logo {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  background: transparent;
  padding: 5px;
  box-shadow: none;
  margin-right: 15px;
  object-fit: contain;
}

/* Título */
.app-title-v2 {
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

/* Contenedor principal con margen para la barra fija */
.app-container-start {
  margin-top: 110px;
  padding-bottom: 40px;
}

/* ----------------------------------------------------------------------------------- */
/* --- PESTAÑAS (NAV-TABS) CON EFECTO SOLAPA --- */
/* ----------------------------------------------------------------------------------- */

.nav-tabs {
  border-bottom: none;
  margin-bottom: 0;
  gap: 4px;
  padding-left: 2px;
}

/* Pestañas individuales */
.nav-tabs .nav-link {
  border-radius: 10px 10px 0 0;
  padding: 10px 20px;
  background-color: #f2f4f7;
  border: 1px solid #d0d4da;
  border-bottom: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
  font-weight: 500;
  transition: all 0.2s ease;
}

/* Hover sutil */
.nav-tabs .nav-link:hover:not(.active) {
  background-color: #ffffff;
  color: #0d6efd;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Pestaña activa */
.nav-tabs .nav-link.active {
  background-color: #ffffff;
  color: #0d6efd;
  font-weight: 600;
  border: 1px solid #d0d4da;
  border-bottom: none;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.05);
  z-index: 2;
}

/* Contenedor del contenido */
.tab-content {
  background: #ffffff;
  border: 1px solid #d0d4da;
  border-radius: 0 10px 10px 10px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
  padding: 25px;
  margin-top: -1px; /* une visualmente con la pestaña activa */
}

/* ----------------------------------------------------------------------------------- */
/* --- TARJETA DE BÚSQUEDA --- */
/* ----------------------------------------------------------------------------------- */

#buscar {
  background-color: #ffffff;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

#search {
  border-radius: 10px;
  padding-left: 40px;
  height: 45px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%23999' stroke-width='2' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 20px;
  background-position: 10px center;
}

#resultCount {
  font-size: 0.95rem;
  color: #495057;
  font-weight: 500;
  margin-top: 5px;
}

/* ----------------------------------------------------------------------------------- */
/* --- CARDS DE RESULTADOS --- */
/* ----------------------------------------------------------------------------------- */

.card {
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: box-shadow 0.3s, transform 0.3s;
  margin-bottom: 15px;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.card-title {
  font-size: 0.95rem;
  font-weight: 400;
  color: #333;
  line-height: 1.5;
  padding-bottom: 5px;
}

.card-title b {
  font-size: 0.95rem; 
  font-weight: 600; 
  color: #1a1a1a;
}

.card-subtitle {
  font-size: 0.85rem;
  color: #6c757d;
  border-bottom: 1px solid #f0f0f0;
  padding-bottom: 10px;
  margin-bottom: 15px !important;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

.card-subtitle .btn-outline-secondary {
  border-color: #ced4da;
  color: #6c757d;
}

/* ----------------------------------------------------------------------------------- */
/* --- FORMULARIOS Y UTILIDADES --- */
/* ----------------------------------------------------------------------------------- */

.form-control,
.form-select {
  border-radius: 8px;
  height: 45px;
}

.btn-group .btn {
  border-radius: 8px;
}

/* Contador de coincidencias */
#resultCount {
  font-size: 0.95rem;
  color: #495057;
  font-weight: 500;
  margin-top: 5px;
}

/* ----------------------------------------------------------------------------------- */
/* --- SELECT Y OPTGROUP --- */
/* ----------------------------------------------------------------------------------- */

optgroup {
  font-weight: bold; 
  font-size: 1.1em;
  color: #212529; 
  background-color: #e9ecef;
  padding-top: 5px;
  padding-bottom: 3px;
  font-style: normal; 
  pointer-events: none; 
}

.form-select option {
  background-color: #ffffff;
  color: #212529;
}

/* ----------------------------------------------------------------------------------- */
/* --- CORRECCIÓN DEL ESPACIO ENTRE SOLAPAS Y PANEL --- */
/* ----------------------------------------------------------------------------------- */

/* Elimina hueco visual entre pestañas y contenido */
.nav-tabs {
  margin-bottom: -5px; /* une las pestañas al panel */
}

/* Compensa la sombra superior del panel para una unión limpia */
.tab-content {
  margin-top: 0;
  position: relative;
  top: -6px; /* sube el panel hasta tocar las pestañas */
  border-top-left-radius: 0;
}

/* Asegura que la pestaña activa tape cualquier línea intermedia */
.nav-tabs .nav-link.active {
  margin-bottom: -1px;
  z-index: 3;
}


/* ----------------------------------------------------------------------------------- */
/* --- BOTÓN LIMPIAR --- */
/* ----------------------------------------------------------------------------------- */

#dataForm .btn-outline-secondary {
  border-radius: 8px;
  font-weight: 500;
}

/* ----------------------------------------------------------------------------------- */
/* --- CORRECCIÓN DEL RESALTADO DE BÚSQUEDA --- */
/* ----------------------------------------------------------------------------------- */

mark {
  background-color: #ffe08a; /* color más suave */
  padding: 0;               /* elimina el espacio extra */
  border-radius: 3px;       /* bordes redondeados finos */
  color: inherit;           /* mantiene el color del texto original */
  letter-spacing: normal;   /* evita separación entre letras */
}

/* Fuerza color del placeholder */
input::placeholder,
textarea::placeholder {
  color: rgba(0, 0, 0, 0.25) !important;  /* rojo translúcido */
  opacity: 1 !important;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
  color: rgba(0, 0, 0, 0.25) !important;
}

input::-moz-placeholder,
textarea::-moz-placeholder {
  color: rgba(0, 0, 0, 0.25) !important;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder {
  color: rgba(0, 0, 0, 0.25) !important;
}


/* ----------------------------------------------------------------------------------- */
/* --- SECCIÓN ADMINISTRAR (ACORDEÓN AGRUPADO) --- */
/* ----------------------------------------------------------------------------------- */

.accordion-button {
  background-color: #ffffff !important;
  color: #2b3e50 !important;
  font-weight: 500 !important;
  font-size: 1.05rem !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  border: 1px solid #e0e3e7 !important;
  padding: 10px 16px !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.accordion-button:hover {
  background-color: #f8fafc !important;
}

.accordion-button::after {
  filter: brightness(0.3); /* ícono gris más tenue */
}

/* Contador de registros — texto elegante, no badge */
.accordion-button .badge.bg-secondary {
  background: none !important;
  color: #6c757d !important;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  border: none !important;
  padding: 0 !important;
}

.accordion-button .badge.bg-secondary::before {
  content: "Registros: " !important;
  color: #6c757d !important;
  font-weight: 400 !important;
}

.accordion-item {
  border: none !important;
  margin-bottom: 8px;
}

/* ----------------------------------------------------------------------------------- */
/* --- PLACEHOLDER GRIS PARA <select> (opción "Seleccionar...") --- */
/* ----------------------------------------------------------------------------------- */

/* Opción deshabilitada o vacía */
select:invalid,
select option[value=""],
select option[disabled] {
  color: rgba(0, 0, 0, 0.35); /* gris claro */
}

/* Cuando se selecciona una opción válida */
select option:not([value=""]) {
  color: #212529;
}

/* Asegura mismo tono inicial al cargar */
.form-select:has(option[value=""]:checked) {
  color: rgba(0, 0, 0, 0.35);
}

/* --- BOTONES CORPORATIVOS (Editar / Eliminar) --- */
.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: all 0.2s ease-in-out;
  padding: 6px 14px;
}

.btn-action i {
  font-size: 1rem;
}

/* Editar */
.btn-edit {
  background-color: #f5f8ff;
  color: #0d6efd;
  border: 1px solid #b7d1ff;
}
.btn-edit:hover {
  background-color: #e7f0ff;
  border-color: #94baff;
  color: #084298;
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.2);
}

/* Eliminar */
.btn-delete {
  background-color: #fff5f5;
  color: #d63333;
  border: 1px solid #f0c2c2;
}
.btn-delete:hover {
  background-color: #ffe0e0;
  border-color: #f19999;
  color: #a12222;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.2);
}

/* -------------------- RESPONSIVE -------------------- */

/* Logo y título se apilan en móviles */
@media (max-width: 768px) {
  .header-content-v2 {
    flex-direction: column;
    align-items: flex-start;
    padding-left: 70px; /* deja espacio para el logo */
  }

  .banner-logo {
    width: 45px;
    height: 45px;
    margin-bottom: 6px;
  }

  .app-title-v2 {
    font-size: 1.1rem;
  }

  .tab-content {
    padding: 15px;
  }

  .nav-tabs .nav-link {
    padding: 8px 12px;
    font-size: 0.9rem;
  }

  form .form-control,
  form .form-select {
    height: auto;
    font-size: 0.9rem;
  }

  .btn {
    font-size: 0.9rem;
    padding: 6px 12px;
  }
}

/* Reduce márgenes en pantallas pequeñas */
@media (max-width: 576px) {
  .app-container-start {
    margin-top: 100px;
    padding: 10px;
  }

  .card-title {
    font-size: 0.85rem;
  }
}

/* Espaciado lateral del cuerpo principal */
.app-container-start {
  max-width: 1200px;   /* ancho máximo */
  margin: 110px auto 40px auto; /* centrado automático */
  padding: 0 30px;     /* espacio interno lateral */
}


/* ----------------------------------------------------------------------------------- */
/* --- COLOR PERSONALIZADO BOTONES PRINCIPALES --- */
/* ----------------------------------------------------------------------------------- */

.modal-header.bg-primary {
  background-color: #2f6dbe !important; /* azul más suave */
}

/* Botones principales (Guardar, Aceptar) */
.btn-primary {
  background-color: #2f6dbe !important;
  border-color: #2f6dbe !important;
}

/* Hover más oscuro */
.btn-primary:hover {
  background-color: #265ba0 !important;
  border-color: #265ba0 !important;
}

/* Botón activo o foco */
.btn-primary:active,
.btn-primary:focus {
  background-color: #234f8e !important;
  border-color: #234f8e !important;
  box-shadow: 0 0 0 0.2rem rgba(47, 109, 190, 0.3) !important;
}

/* ----------------------------------------------------------------------------------- */
/* --- COLOR PERSONALIZADO BOTONES OUTLINE (Agregar columna) --- */
/* ----------------------------------------------------------------------------------- */

/* Estado normal */
.btn-outline-primary {
  color: #2f6dbe !important;
  border-color: #2f6dbe !important;
  background-color: transparent !important;
}

/* Hover o activo */
.btn-outline-primary:hover,
.btn-outline-primary:active,
.btn-outline-primary:focus {
  color: #fff !important;
  background-color: #2f6dbe !important;
  border-color: #2f6dbe !important;
  box-shadow: 0 0 0 0.2rem rgba(47, 109, 190, 0.25) !important;
}

/* ----------------------------------------------------------------------------------- */
/* --- COLOR PERSONALIZADO PARA LAS SOLAPAS --- */
/* ----------------------------------------------------------------------------------- */

/* Pestaña activa */
.nav-tabs .nav-link.active {
  color: #2f6dbe !important;
  border-color: #d0d4da #d0d4da #fff;
  background-color: #ffffff;
  font-weight: 600;
  box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.05);
}

/* Hover */
.nav-tabs .nav-link:hover:not(.active) {
  color: #2f6dbe !important;
  border-color: #cfd3d9;
  background-color: #f9f9f9;
}

/* Icono dentro de la pestaña activa */
.nav-tabs .nav-link.active i {
  color: #2f6dbe !important;
}


/* ----------------------------------------------------------------------------------- */
/* --- ESTILO DEL CHECK INPUT --- */
/* ----------------------------------------------------------------------------------- */


.form-switch .form-check-input {
  width: 2.6em;
  height: 1.4em;
  cursor: pointer;
  border: 1px solid #b0b0b0;
  background-color: #ccc;
}

.form-switch .form-check-input:checked {
  background-color: #2f6dbe;
  border-color: #2f6dbe;
}

/* ----------------------------------------------------------------------------------- */
/* --- ESTILO DEL BOTON EDIT CARD --- */
/* ----------------------------------------------------------------------------------- */

.btn-edit-icon {
  background: transparent !important;
  border: none !important;
  color: #2f6dbe;
  box-shadow: none !important;
  transition: color 0.2s ease, transform 0.2s ease;
}
.btn-edit-icon:hover {
  color: #084298;
  transform: scale(1.1);
}


/* ----------------------------------------------------------------------------------- */
/* --- SOLUCIÓN  PARA EL BOTÓN COPIAR (Problema de Visibilidad en Hover) --- */
/* ----------------------------------------------------------------------------------- */

/* 1. Aplica color blanco al botón de Copiar en hover */
.card-subtitle .btn-outline-secondary:hover {
    color: #ffffff !important; /* Asegura el color del texto principal del botón */
}

/* 2. Aplica color blanco a CUALQUIER elemento dentro del botón (el icono <i> y el texto) */
/* Este selector es más agresivo y resuelve conflictos de iconos */
.card-subtitle .btn-outline-secondary:hover * {
    color: #ffffff !important;
}

/* ----------------------------------------------------------------------------------- */

