/* ===============================================
    Mobile Filters System
    - Botón flotante
    - Modal/Drawer responsive
    - Animaciones modernas
------------------------*/

/* ============================================
   BOTÓN FLOTANTE (Solo Mobile)
============================================ */
.floating-filter-btn {
  display: none;
  /* Oculto por defecto en desktop */
  max-width: 130px;
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: linear-gradient(135deg, #004ECC 0%, #0066ff 100%);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 15px 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0, 78, 204, 0.4);
  z-index: 999;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInUp 0.5s ease;
}

.floating-filter-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0, 78, 204, 0.5);
}

.floating-filter-btn:active {
  transform: translateY(-1px);
}

.floating-filter-btn i {
  font-size: 18px;
}

.floating-filter-btn .btn-text {
  font-size: 15px;
  letter-spacing: 0.5px;
}

/* Badge de contador */
.filter-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff4444;
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  border: 2px solid #fff;
  animation: pulse-badge 2s infinite;
}

.filter-badge.hidden {
  display: none;
}

@keyframes pulse-badge {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

@keyframes slideInUp {
  from {
    transform: translateY(100px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ============================================
   OVERLAY
============================================ */
.filters-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.filters-overlay.active {
  display: block;
  opacity: 1;
}

/* ============================================
   DRAWER/MODAL
============================================ */
.filters-drawer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-height: 85vh;
  background: #fff;
  border-radius: 20px 20px 0 0;
  z-index: 1001;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 -5px 30px rgba(0, 0, 0, 0.2);
}

.filters-drawer.active {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
}

/* Header del drawer */
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 15px;
  border-bottom: 2px solid #e8e8e8;
  background: #f9f9f9;
  border-radius: 20px 20px 0 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.drawer-title {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.drawer-title i {
  color: #004ECC;
  font-size: 22px;
}

.drawer-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 23px;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.drawer-close:hover {
  background: #f44336;
  color: #fff;
  transform: rotate(90deg);
}

/* Contenido del drawer */
.drawer-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

/* Secciones de filtros */
.filter-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e8e8e8;
}

.filter-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.filter-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin: 0 0 15px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-section-title i {
  color: #004ECC;
  font-size: 18px;
}

/* Lista de filtros */
.filter-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.filter-item {
  display: block;
  padding: 12px 15px;
  margin-bottom: 8px;
  background: #f9f9f9;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  color: #333;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
}

.filter-item:hover,
.filter-item.active {
  background: #004ECC;
  border-color: #004ECC;
  color: #fff;
  transform: translateX(5px);
}

.filter-item.active::after {
  content: '\f00c';
  font-family: 'FontAwesome';
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
}

/* Selects de filtros */
.filter-select {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  font-size: 15px;
  color: #333;
  background: #f9f9f9;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 500;
}

.filter-select:focus {
  outline: none;
  border-color: #004ECC;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 78, 204, 0.1);
}

/* Footer del drawer */
.drawer-footer {
  display: flex;
  gap: 10px;
  padding: 15px 20px;
  border-top: 2px solid #e8e8e8;
  background: #f9f9f9;
  position: sticky;
  bottom: 0;
  z-index: 10;
}

.btn-clear-filters,
.btn-apply-filters {
  flex: 1;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-clear-filters {
  background: #fff;
  color: #666;
  border: 2px solid #e8e8e8;
}

.btn-clear-filters:hover {
  background: #f44336;
  color: #fff;
  border-color: #f44336;
}

.btn-apply-filters {
  background: linear-gradient(135deg, #004ECC 0%, #0066ff 100%);
  color: #fff;
  box-shadow: 0 4px 15px rgba(0, 78, 204, 0.3);
}

.btn-apply-filters:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 78, 204, 0.4);
}

.btn-apply-filters:active {
  transform: translateY(0);
}

/* ============================================
   RESPONSIVE
============================================ */

/* Mostrar botón flotante solo en mobile/tablet */
@media (max-width: 991px) {
  .floating-filter-btn {
    display: flex;
  }

  /* Ocultar sidebar en mobile */
  .sidebar-left {
    display: none;
  }
}

/* Ajustes para pantallas muy pequeñas */
@media (max-width: 576px) {
  .floating-filter-btn {
    bottom: 15px;
    left: 15px;
    padding: 12px 20px;
    font-size: 14px;
  }

  .floating-filter-btn .btn-text {
    font-size: 14px;
  }

  .drawer-header {
    padding: 15px;
  }

  .drawer-title {
    font-size: 18px;
  }

  .drawer-content {
    padding: 15px;
  }

  .filter-section-title {
    font-size: 14px;
  }

  .filter-item {
    padding: 10px 12px;
    font-size: 14px;
  }

  .filter-select {
    padding: 10px 12px;
    font-size: 14px;
  }

  .drawer-footer {
    padding: 12px 15px;
    gap: 8px;
  }

  .btn-clear-filters,
  .btn-apply-filters {
    padding: 12px 16px;
    font-size: 13px;
  }

  .filters-drawer {
    max-height: 90vh;
  }
}

/* Desktop - mantener todo normal */
@media (min-width: 992px) {

  .floating-filter-btn,
  .filters-overlay,
  .filters-drawer {
    display: none !important;
  }
}

/* ============================================
   ANIMACIONES ADICIONALES
============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

/* Prevenir scroll del body cuando el modal está abierto */
body.filters-open {
  overflow: hidden;
}

/* ============================================
   CHIPS DE FILTROS ACTIVOS (Tagcloud)
============================================ */
#activeFiltersTagcloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tag-cloud-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0f5ff !important;
  border: 1px solid #004ECC !important;
  color: #004ECC !important;
  border-radius: 20px;
  padding: 8px 12px !important;
  font-size: 13px !important;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
}

.tag-cloud-link:hover {
  background: #004ECC !important;
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(0, 78, 204, 0.3);
}

.tag-cloud-link i {
  font-size: 12px;
  opacity: 0.8;
}

.no-filters-text {
  font-style: italic;
}

/* Responsive para chips */
@media (max-width: 767px) {
  #activeFiltersTagcloud {
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 5px;
  }

  #activeFiltersTagcloud::-webkit-scrollbar {
    display: none;
  }

  .tag-cloud-link {
    flex-shrink: 0;
    font-size: 12px !important;
    padding: 6px 10px !important;
  }
}

/* ============================================
   SIDEBAR FILTERS (Desktop)
============================================ */
.sidebar-filter-item {
  display: block;
  padding: 10px 15px;
  color: #333;
  text-decoration: none;
  transition: all 0.3s ease;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-filter-item:hover {
  background: #f0f5ff;
  color: #004ECC;
  border-left-color: #004ECC;
  padding-left: 20px;
}

.sidebar-filter-item.active {
  background: #f0f5ff;
  color: #004ECC;
  font-weight: 700;
  border-left-color: #004ECC;
  padding-left: 20px;
}

.sidebar-filter-item.active::after {
  content: '\f00c';
  font-family: 'FontAwesome';
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: #004ECC;
  font-size: 14px;
}

.sidebar-filter-select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e8e8e8;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  background: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}

.sidebar-filter-select:focus {
  outline: none;
  border-color: #004ECC;
  box-shadow: 0 0 0 3px rgba(0, 78, 204, 0.1);
}

.sidebar-filter-select option[value=""]:disabled {
  color: #999;
}

#clearSidebarFiltersBtn {
  margin-top: 15px;
  width: 100%;
}