/* Styles scoped to the publicaciones/lista page to avoid global conflicts */

/* Hide mobile elements on desktop */
.search-bar-mobile {
  display: none;
}

.filter-toggle-btn,
.sort-toggle-btn {
  display: none;
}

.vehicles-page .filter-box {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
  overflow: hidden;
  margin-bottom: 18px;
}

.vehicles-page .filter-box summary,
.vehicles-page .filter-body {
  background: #ffffff;
  color: #111827;
}

.vehicles-page .filter-box summary {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 700;
  border-bottom: 1px solid #eef2f7;
}

.vehicles-page .filter-box .filter-body {
  padding: 16px 18px 20px;
}

.vehicles-page .type-pill-row {
  display: grid !important;
  gap: 10px !important;
  grid-auto-flow: row;
}

.vehicles-page .type-pill-row.type-pill-row--three {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.vehicles-page .type-pill-row.type-pill-row--two {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.vehicles-page .type-pill-row .type-pill {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  visibility: visible !important;
  opacity: 1 !important;
  padding: 8px 12px !important;
  height: 40px !important;
  white-space: nowrap !important;
}

/* Ensure pill groups have inner padding like details .filter-body */
.vehicles-page .filter-box > .type-pill-row {
  padding: 12px 18px 18px;
}

/* Add a minimum height so the box doesn't collapse and hide pills */
.vehicles-page .filter-box {
  min-height: 64px;
}

/* Make sure individual form groups inside filter-body keep bottom spacing */
.vehicles-page .filter-body .form-group {
  margin-bottom: 12px;
}

.vehicles-page .filter-body .form-group--checkbox,
.vehicles-page .filter-box--identidad .form-group--checkbox {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
  row-gap: 4px;
}

.vehicles-page .filter-box--identidad {
  min-height: 0;
}

.vehicles-page .filter-box--identidad .form-group--checkbox {
  margin-bottom: 0;
  padding: 0 20px 18px;
}

.vehicles-page .form-group--checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #16a34a;
  cursor: pointer;
}

.vehicles-page .form-group--checkbox label {
  margin: 0;
  cursor: pointer;
  font-weight: 600;
  color: #0f172a;
}

.vehicles-page .form-group--checkbox small {
  grid-column: 2;
  color: #475569;
  font-size: 12px;
  line-height: 1.4;
}

/* make sure pill groups visually separated from bottom border like .filter-body */
.vehicles-page .filter-box > .type-pill-row {
  border-top: 1px solid transparent;
  margin-bottom: 0;
}

.vehicles-page .search-form .form-row.stacked-row {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 16px !important;
}

.vehicles-page .type-pill,
.vehicles-page .category-pill {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
}

/* Active state for pills (higher specificity than global .type-pill.active) */
.vehicles-page .type-pill.active,
.vehicles-page .category-pill.active,
.vehicles-page button.category-pill.active,
.vehicles-page button.category-pill.active:hover {
  background: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
}

/* Ensure vehicle cards column keeps its spacing and visual separation */
.vehicles-page .results-area {
  padding-top: 4px;
}

/* Make sure filters are visually above background */
.vehicles-page .sidebar .filter-box {
  position: relative;
  z-index: 2;
}

/* Small responsive tweaks */
@media (max-width: 980px) {
  .vehicles-page .filter-box {
    box-shadow: none;
    border-radius: 12px;
  }
}

/* Grid for vehicle cards */
.vehicles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  align-items: start;
}

.vehicle-card {
  background: #fff;
  border: 1px solid #e6e7ea;
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: none;
}
.vehicle-card:hover { 
  /* Animaciones manejadas por anime.js en listado.js */
}

.vehicle-image-container { width:100%; height:180px; overflow:hidden; background:#f8fafc; }
.vehicle-image { width:100%; height:100%; object-fit:cover; display:block; }

.vehicle-info { padding:12px 14px; display:flex; flex-direction:column; gap:8px; flex:1 1 auto; }
.vehicle-price-year { display:flex; justify-content:space-between; align-items:center; gap:8px; }
.vehicle-price { font-weight:800; color:#0f172a; }
.vehicle-title { font-weight:700; color:#0f172a; }
.vehicle-details { color:#64748b; font-size:0.95rem; }
.vehicle-link { margin-top:auto; color:#2563eb; font-weight:700; }

@media (max-width: 980px) {
  .vehicle-image-container { height:160px; }
}
@media (max-width: 640px) {
  .vehicle-image-container { height:140px; }
}

/* Detail page gallery */
.detail-gallery { display:grid; grid-template-columns: 1fr 360px; gap:18px; align-items:start; }
.detail-main { border:1px solid #eee; border-radius:12px; background:#fff; overflow:hidden; }
.detail-main-image { width:100%; height:420px; object-fit:cover; display:block; }
.detail-thumbs { display:flex; gap:10px; overflow-x:auto; padding:12px; border-top:1px solid #eee; }
.detail-thumb { width:100px; height:72px; object-fit:cover; border-radius:8px; border:1px solid #eee; cursor:pointer; flex:0 0 auto; }

@media (max-width: 980px) {
  .detail-gallery { grid-template-columns: 1fr; }
  .detail-main-image { height:360px; }
  .detail-thumbs { justify-content:flex-start; }
}

/* Lightbox */
.lightbox-overlay { position:fixed; inset:0; background:rgba(0,0,0,0.75); display:none; align-items:center; justify-content:center; z-index:99999; }
.lightbox-overlay.open { display:flex; }
.lightbox-img { max-width:95%; max-height:95%; border-radius:8px; box-shadow:0 20px 60px rgba(0,0,0,0.5); }

/* Lightbox nav buttons */
.lightbox-nav { position:absolute; top:50%; transform:translateY(-50%); background:rgba(255,255,255,0.08); border:none; color:#fff; font-size:22px; padding:12px 14px; border-radius:8px; cursor:pointer; backdrop-filter:blur(4px); }
.lightbox-prev { left:24px; }
.lightbox-next { right:24px; }
.lightbox-nav:hover { background:rgba(255,255,255,0.12); }

/* Results header responsive */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .results-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .results-header > div:last-child {
    width: 100%;
  }

  .results-header > div:last-child select {
    width: 100%;
  }

  /* Search bar móvil - VISIBLE EN MÓVIL */
  .search-bar-mobile {
    width: 100%;
    margin-bottom: 16px;
    display: block;
  }

  .search-input-mobile {
    width: 100%;
    max-width: 100%;
    padding: 14px 18px;
    text-align: center;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    font-size: 1rem;
    background: #ffffff;
    color: #0f172a;
    font-family: inherit;
    box-sizing: border-box;
    display: block;
  }

  .search-input-mobile::placeholder {
    color: #94a3b8;
  }

  .search-input-mobile:focus {
    outline: none;
    background: #ffffff;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  }

  /* Botón FILTRAR - azul oscuro */
  .filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #3b82f6;
    color: white;
    border-radius: 10px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
  }

  .filter-toggle-btn:hover {
    background: #2563eb;
  }

  .filter-toggle-btn:active {
    background: #1d4ed8;
  }

  /* Botón ORDENAR - azul claro */
  .sort-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #60a5fa;
    color: white;
    border-radius: 10px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: none;
  }

  .sort-toggle-btn:hover {
    background: #3b82f6;
  }

  .sort-toggle-btn:active {
    background: #2563eb;
  }

  /* Panel de ordenamiento para móvil */
  .sort-panel {
    position: fixed;
    top: 70px;
    right: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    z-index: 1001;
    border-bottom: 1px solid #e2e8f0;
    animation: slideDown 0.3s ease;
    overflow-y: auto;
    max-height: calc(100vh - 70px);
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .sort-panel .panel-card {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
    padding: 16px;
    background: #ffffff;
  }

  .sort-panel .panel-card__header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
  }

  .sort-panel .panel-card__header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
  }

  .sort-options-list {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .sort-option {
    padding: 14px 16px;
    border: none;
    background: #ffffff;
    text-align: left;
    color: #0f172a;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.15s ease;
    border-bottom: 1px solid #f1f5f9;
    margin: 0;
  }

  .sort-option:last-child {
    border-bottom: none;
  }

  .sort-option:hover {
    background: #f8fafc;
  }

  .sort-option:active {
    background: #f1f5f9;
  }

  /* Sidebar y otros elementos móvil */
  .vehicles-page .sidebar .panel-card {
    padding: 12px;
  }

  .results-count {
    font-size: 0.9rem;
  }

  .sort-select {
    font-size: 0.9rem;
    padding: 8px 12px;
  }

  .results-header > div:nth-child(1) {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
}

/* ============ MEJORAS DE FILTROS Y CHECKBOXES ============ */

/* Checkboxes y radios en filtros */
.filter-box input[type="checkbox"],
.filter-box input[type="radio"] {
  accent-color: #16a34a;
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.filter-box input[type="checkbox"]:checked,
.filter-box input[type="radio"]:checked {
  accent-color: #16a34a;
}

/* Labels de filtros - mejorar visual */
.filter-box label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 0.15s ease;
  margin-bottom: 8px;
}

.filter-box label:hover {
  background-color: rgba(22, 163, 74, 0.05);
}

.filter-box input[type="checkbox"]:checked + label,
.filter-box label:has(input[type="checkbox"]:checked),
.filter-box input[type="radio"]:checked + label,
.filter-box label:has(input[type="radio"]:checked) {
  background-color: rgba(22, 163, 74, 0.08);
  font-weight: 600;
  color: #16a34a;
}

/* Mejorar selectores personalizados también */
.custom-select__item:checked,
.custom-select__item[aria-selected="true"] {
  background: rgba(22, 163, 74, 0.1);
  color: #16a34a;
  font-weight: 600;
}
