/* ===========================
   ESTOQUE PAGE STYLES
   =========================== */

/* Removido overflow global que quebrava a navbar sticky */
/* A proteção agora fica no .estoque-wrapper */

.estoque-wrapper {
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

/* Page Header */
.page-header {
  background: #fff;
  padding: 48px 0 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
  max-width: 100%;
  border-bottom: 1px solid #f1f5f9;
}

.page-header::before {
  content: '';
  position: absolute;
  top: -40%;
  right: 0;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(201, 168, 76, 0.05) 0%, transparent 70%);
  border-radius: 50%;
  transform: translateX(30%); /* Posicionamento mais seguro que right negativo */
  pointer-events: none;
}

.page-header-content {
  position: relative;
  z-index: 1;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--primary);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Layout Principal de Estoque (Grid) */
.estoque-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  /* Removido align-items: start para permitir que a sidebar estique ate o final do grid */
}

/* Sidebar e Formulário de Filtro Vertical */
.estoque-sidebar {
  position: relative;
  /* Pai agora apenas um container flexivel no grid */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-close-sidebar {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 27, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

.mobile-filter-trigger-wrapper {
  display: none;
  margin-bottom: 24px;
}

.btn-mobile-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border: 2px solid var(--accent);
  color: var(--primary);
  padding: 14px 24px;
  min-height: 48px;
  border-radius: var(--radius-md);
  font-weight: 700;
  width: 100%;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-mobile-filter:active {
  transform: scale(0.98);
}

.sticky-filters {
  position: sticky;
  top: 100px;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 25px;
  padding-right: 15px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(201, 168, 76, 0.2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.06);
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #d1d5db transparent;
}

/* Quick Filter Pills (Carrossel Horizontal Touch) */
.quick-filters-container {
  margin-bottom: 24px;
}

.quick-filter-pills {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.quick-filter-pills::-webkit-scrollbar {
  display: none;
}

.quick-filter-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  min-height: 44px;
  background: #ffffff;
  border: 1.5px solid var(--light-gray);
  border-radius: 100px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.quick-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(201, 168, 76, 0.15);
}

.quick-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.quick-pill.active i {
  color: var(--accent);
}

/* Skeleton Shimmer Loading */
.skeleton-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  height: 380px;
  position: relative;
}

.skeleton-shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #fafaf8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Customização fina do scrollbar para não quebrar o visual arredondado */
.sticky-filters::-webkit-scrollbar {
  width: 6px;
}

.sticky-filters::-webkit-scrollbar-track {
  background: transparent;
  margin: 10px 0;
  /* Afasta o scroll das quinas arredondadas */
}

.sticky-filters::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 10px;
  border: 2px solid var(--white);
  /* Efeito flutuante */
}

.sticky-filters::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.filters-form-vertical {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-group-v {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-row-v {
  display: flex;
  gap: 15px;
}

.filter-group-v.half {
  flex: 1;
}

.filter-group-v label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.filter-group-v select,
.filter-group-v input {
  width: 100%;
  padding: 12px 14px;
  background: var(--white);
  border: 2px solid var(--light-gray);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.9rem;
  transition: all var(--transition);
  box-sizing: border-box;
}

.filter-group-v select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c757d' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.filter-group-v select:focus,
.filter-group-v input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.15);
}

.btn-filter-v {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  background: var(--accent);
  color: var(--primary);
  padding: 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
}

/* --- Category Toggle --- */
.category-toggle-container {
  margin-bottom: 25px;
}

.cat-pill {
  display: flex;
  background: #f1f3f5;
  padding: 4px;
  border-radius: 50px;
  gap: 4px;
}

.cat-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: none;
  border-radius: 50px;
  background: transparent;
  color: #6c757d;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.3s ease;
  cursor: pointer;
  white-space: nowrap;
}

.cat-btn i {
  font-size: 1rem;
}

.cat-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cat-btn:hover:not(.active) {
  background: rgba(0, 0, 0, 0.03);
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--white);
  border: 1px solid var(--light-gray);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 4px;
  display: none;
}

.autocomplete-dropdown.active {
  display: block;
}

.auto-section-title {
  padding: 12px 14px 4px;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.auto-item {
  padding: 10px 14px;
  font-size: 0.95rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s ease;
}

.auto-item:hover {
  background: #f3f4f6;
}

.auto-item strong {
  font-weight: 800;
}

.btn-filter-v:hover {
  background: var(--accent-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(201, 168, 76, 0.35);
}

.btn-filter-v:active {
  transform: translateY(0);
}

.clear-filters:hover {
  transform: scale(1.1);
}


/* Results Header */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 16px 0;
  flex-wrap: wrap;
  gap: 12px;
}

.results-count {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

.results-count strong {
  color: var(--primary);
}

.results-sort {
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-sort label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  font-weight: 600;
}

.results-sort select {
  padding: 8px 32px 8px 12px;
  border: 2px solid var(--light-gray);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--text-primary);
  background: var(--white);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c757d' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color var(--transition);
}

.results-sort select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Car Grid on Estoque */
.section-cars-estoque {
  padding: 0 0 80px;
}

.section-cars-estoque .cars-grid {
  gap: 24px;
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 900px) {
  .page-header {
    padding: 32px 0 40px;
  }

  .page-header h1 {
    font-size: 1.8rem;
  }

  .mobile-filter-trigger-wrapper {
    display: block;
  }

  .btn-close-sidebar {
    display: block;
  }

  .estoque-layout {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .estoque-sidebar {
    position: fixed !important;
    top: 0;
    left: -100%; 
    width: 280px;
    max-width: 80%;
    height: 100vh;
    z-index: 9999; 
    background: var(--white);
    padding: 0;
    border-radius: 0;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    transition: left 0.3s ease;
    visibility: hidden;
  }

  .estoque-sidebar.active {
    left: 0;
    visibility: visible;
    display: block;
  }

  .sticky-filters {
    position: static !important;
    box-shadow: none !important;
    border: none !important;
    padding: 20px 25px;
    max-height: none !important;
    overflow-y: visible !important;
  }

  .btn-close-sidebar {
    display: block;
    padding: 10px;
  }
}

@media (min-width: 901px) and (max-width: 1024px) {
  .estoque-layout {
    grid-template-columns: 240px 1fr;
    gap: 20px;
  }
}

/* ===========================
   ESTILOS DE FILTROS LIMPOS
   =========================== */
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.sidebar-header h3 {
  font-size: 1.1rem;
  color: var(--primary);
  margin: 0;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar-header-actions {
  display: flex;
  gap: 15px;
  align-items: center;
}

.clear-filters {
  color: #ef4444;
  text-decoration: none;
  transition: all 0.3s;
}

.clear-filters:hover {
  color: #dc2626;
}