/* Estilos para el buscador de carreras - Filtros */
.filtros-sidebar {
  background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
  border: 1px solid #e1e5e9;
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 2rem;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.filtros-sidebar form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Campo de búsqueda principal */
.campo-busqueda-siempre-visible {
  margin-bottom: 1rem;
}

.campo-busqueda-siempre-visible .filtro {
  position: relative;
}

.campo-busqueda-siempre-visible input[type="text"] {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid #e1e5e9;
  border-radius: 10px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background: #fafbfc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.campo-busqueda-siempre-visible input[type="text"]:focus {
  outline: none;
  border-color: #193A63;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(25, 58, 99, 0.1);
}

.campo-busqueda-siempre-visible input[type="text"]::placeholder {
  color: #6b7280;
}

/* Estilos generales de los filtros */
.filtro {
  border: none;
  padding: 0;
  margin: 0;
}

.filtro legend {
  font-weight: 600;
  font-size: 0.9rem;
  color: #374151;
  margin-bottom: 0.75rem;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filtro .contenido {
  padding-left: 0;
}

/* Checkboxes personalizados */
.filtro label {
  display: flex;
  align-items: center;
  margin: 0.75rem 0;
  cursor: pointer;
  font-size: 0.9rem;
  color: #4b5563;
  transition: all 0.2s ease;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid transparent;
}

.filtro label:hover {
  color: #193A63;
  background: rgba(25, 58, 99, 0.05);
  border-color: rgba(25, 58, 99, 0.1);
}

.filtro label:hover {
  color: #193A63;
}

.filtro input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  margin-right: 0.75rem;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
}

.filtro input[type="checkbox"]:checked {
  background: #193A63;
  border-color: #193A63;
}

.filtro input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

.filtro input[type="checkbox"]:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 58, 99, 0.1);
}

/* Slider de duración */
.filtro.duracion .contenido {
  padding: 0.5rem 0;
}

#duracion-slider {
  margin: 1rem 0;
}

.noUi-target {
  border: 1px solid #d1d5db;
  border-radius: 3px;
  background: #f9fafb;
}

.noUi-connects {
  background: #e5e7eb;
}

.noUi-connect {
  background: #193A63;
}

.noUi-horizontal .noUi-handle {
  width: 20px;
  height: 20px;
  right: -10px;
  top: -8px;
  border: 2px solid #193A63;
  background: #ffffff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.noUi-handle:before,
.noUi-handle:after {
  display: none;
}

.noUi-tooltip {
  background: #193A63;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  padding: 0.25rem 0.5rem;
}

.filtro.duracion p {
  text-align: center;
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0.5rem 0 0 0;
}

/* Botón de búsqueda */
.filtro.submit button {
  width: 100%;
  padding: 0.875rem 1rem;
  background: #193A63;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.filtro.submit button:hover {
  background: #005fa3;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 58, 99, 0.3);
}

.filtro.submit button:active {
  transform: translateY(0);
}

/* Botón toggle para filtros (móvil y desktop) */
.boton-toggle-filtros {
  display: block;
  width: 100%;
  padding: 1.2rem 1.5rem;
  background: linear-gradient(135deg, #193A63, #005fa3);
  color: white;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 16px rgba(25, 58, 99, 0.2);
  position: relative;
  overflow: hidden;
}

.boton-toggle-filtros::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.boton-toggle-filtros:hover {
  background: linear-gradient(135deg, #005fa3, #193A63);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(25, 58, 99, 0.3);
}

.boton-toggle-filtros:hover::before {
  left: 100%;
}

.boton-toggle-filtros:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(25, 58, 99, 0.1);
}

.boton-toggle-filtros {
  font-weight: 600;
  text-align: center;
}

.boton-toggle-filtros.activo {
  background: linear-gradient(135deg, #005fa3, #193A63);
  box-shadow: 0 8px 24px rgba(25, 58, 99, 0.3);
  transform: translateY(-1px);
}

/* Indicador de filtros disponibles */
.boton-toggle-filtros::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  border: 2px solid white;
  opacity: 0.8;
}

/* Contador de resultados */
.contador-resultados {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  text-align: center;
  font-size: 0.9rem;
  color: #6b7280;
}

.contador-resultados strong {
  color: #193A63;
  font-weight: 600;
}

/* Estados de carga */
.filtros-sidebar.loading {
  opacity: 0.7;
  pointer-events: none;
}

.filtros-sidebar.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #193A63;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Estados de filtros (móvil y desktop) */
#bloque-filtros {
  /* Estado por defecto: oculto */
  display: none;
}

/* Clase para mostrar filtros */
#bloque-filtros.visible {
  display: block !important;
}

/* Asegurar que cuando se muestre, tenga el estilo correcto */
#bloque-filtros[style*="display: block"] {
  display: block !important;
}

/* Responsive */
@media (max-width: 768px) {
  .filtros-sidebar {
    position: static;
    margin: 1rem 0;
    border-radius: 6px;
  }

  .filtro label {
    font-size: 1rem;
  }

  .filtro input[type="checkbox"] {
    width: 20px;
    height: 20px;
  }
}

/* Desktop: mantener comportamiento de colapso */
@media (min-width: 769px) {
  .filtros-sidebar {
    position: sticky;
    top: 2rem;
  }
  
  .boton-toggle-filtros {
    margin-bottom: 1.5rem;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
    max-height: 0;
  }
  to {
    opacity: 1;
    transform: translateY(0);
    max-height: 2000px;
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Mejoras de accesibilidad */
.filtro label:focus-within {
  color: #193A63;
}

.filtro input[type="checkbox"]:focus-visible {
  outline: 2px solid #193A63;
  outline-offset: 2px;
}

/* Estados de hover mejorados */
.filtro label:hover input[type="checkbox"] {
  border-color: #193A63;
}

.filtro label:hover input[type="checkbox"]:checked {
  background: #005fa3;
  border-color: #005fa3;
}

/* Estilos para el botón limpiar filtros */
.boton-limpiar-filtros {
  background: linear-gradient(135deg, #6b7280, #4b5563);
  color: white;
  border: none;
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(107, 114, 128, 0.2);
  margin-left: 0.5rem;
}

.boton-limpiar-filtros:hover {
  background: linear-gradient(135deg, #4b5563, #374151);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.boton-limpiar-filtros:active {
  transform: translateY(0);
}

.boton-limpiar-filtros:disabled {
  background: linear-gradient(135deg, #d1d5db, #9ca3af);
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 2px 8px rgba(156, 163, 175, 0.2);
}

.boton-limpiar-filtros:disabled:hover {
  background: linear-gradient(135deg, #d1d5db, #9ca3af);
  transform: none;
  box-shadow: 0 2px 8px rgba(156, 163, 175, 0.2);
}

/* Responsive para botón limpiar */
@media (max-width: 768px) {
  .boton-limpiar-filtros {
    margin-left: 0;
    margin-top: 0.5rem;
  }
}

/* Estilos para la sección de acciones */
.filtro.acciones {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: stretch;
}

.filtro.acciones button {
  flex: 1;
  min-width: 140px;
}

/* Botón de búsqueda principal */
.filtro.acciones .boton-buscar {
  flex: 2;
  min-width: 180px;
}
