/* Stock page — mobile-only layout (max-width: 768px) */

@media (max-width: 768px) {
  body.stock-page .stk {
    max-width: 100%;
    overflow-x: clip;
  }

  body.stock-page .container {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* ── Hero ─────────────────────────────────────────────────── */
  body.stock-page .stock-hero {
    padding: 18px 0 28px;
    overflow-x: clip;
  }

  body.stock-page .stock-hero .container {
    min-width: 0;
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }

  body.stock-page .stock-hero-inner {
    display: grid;
    grid-template-columns: 1fr !important;
    gap: 20px;
    align-items: stretch;
    min-width: 0;
    width: 100%;
  }

  .stk-breadcrumb {
    margin-bottom: 14px;
    font-size: 0.76rem;
  }

  body.stock-page .stock-hero-copy {
    min-width: 0;
    max-width: 100%;
  }

  body.stock-page .stock-hero-copy h1 {
    font-size: 1.55rem;
    margin-bottom: 10px;
  }

  body.stock-page .stock-hero-copy p {
    font-size: 0.88rem;
    line-height: 1.55;
    margin-bottom: 14px;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
  }

  body.stock-page .stock-hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
  }

  body.stock-page .stock-hero-meta span {
    font-size: 0.72rem;
    padding: 6px 10px;
    max-width: 100%;
  }

  /* Popular makes — wrapped chips, fully contained */
  body.stock-page .stock-hero-quick {
    min-width: 0;
    max-width: 100%;
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    overflow: visible;
    box-sizing: border-box;
  }

  body.stock-page .stock-hero-quick-label {
    margin-bottom: 12px;
    font-size: 0.68rem;
    letter-spacing: 1px;
  }

  body.stock-page .stock-quick-makes {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 118px), 1fr));
    gap: 8px;
    overflow: visible;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  body.stock-page .stock-quick-make {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    font-size: 0.75rem;
    line-height: 1.2;
    white-space: nowrap;
    text-align: center;
    box-sizing: border-box;
  }

  /* ── Body type bar — wrapped chips, fully contained ───────── */
  body.stock-page .stk-shapes {
    margin-top: -14px;
    padding-bottom: 16px;
    overflow-x: clip;
  }

  body.stock-page .stk-shapes .container {
    min-width: 0;
    max-width: 100%;
    padding-left: 16px;
    padding-right: 16px;
  }

  body.stock-page .stk-shape-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 14px;
    margin: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    box-sizing: border-box;
  }

  body.stock-page .stk-shape-label {
    font-size: 0.72rem;
  }

  body.stock-page .stk-shape-pills {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 118px), 1fr));
    gap: 8px;
    overflow: visible;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  body.stock-page .stk-shape-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 100%;
    max-width: 100%;
    padding: 8px 10px;
    font-size: 0.75rem;
    line-height: 1.2;
    white-space: nowrap;
    text-align: center;
    box-sizing: border-box;
  }

  /* ── Results toolbar ──────────────────────────────────────── */
  body.stock-page .stock-page {
    padding: 4px 0 48px;
  }

  body.stock-page .stock-toolbar {
    position: static;
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    box-shadow: 0 8px 24px rgba(22, 33, 62, 0.08);
  }

  body.stock-page .stock-toolbar-left,
  body.stock-page .stock-toolbar-right {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  body.stock-page .stk-mobile-filters {
    width: 100%;
    justify-content: center;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.9rem;
    background: var(--primary);
    color: #fff !important;
    border-color: var(--primary) !important;
    box-shadow: 0 6px 16px rgba(192, 57, 43, 0.28);
  }

  body.stock-page .stk-mobile-filters i {
    font-size: 0.88rem;
  }

  body.stock-page .stk-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: #fff;
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 800;
    margin-left: 4px;
  }

  body.stock-page .stock-results-count {
    text-align: center;
    padding: 4px 0;
  }

  body.stock-page .stock-results-count strong {
    font-size: 1.25rem;
  }

  body.stock-page .stock-results-count span,
  body.stock-page .stock-results-count em {
    display: block;
    font-size: 0.8rem;
    margin-top: 2px;
  }

  body.stock-page .stock-toolbar-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  /* Hide list view on mobile — grid only */
  body.stock-page .stock-view-toggle {
    display: none;
  }

  body.stock-page .stock-sort-form {
    grid-column: 1;
    min-width: 0;
  }

  body.stock-page .stock-sort-select {
    width: 100%;
    font-size: 0.86rem;
    padding: 11px 36px 11px 12px;
  }

  body.stock-page .stock-save-search {
    grid-column: 2;
    width: 44px;
    height: 44px;
    padding: 0;
    justify-content: center;
    min-width: 44px;
  }

  body.stock-page .stock-save-search i {
    margin: 0;
  }

  /* ── Active filter chips ──────────────────────────────────── */
  body.stock-page .stock-active-filters {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    margin-bottom: 14px;
    scrollbar-width: none;
  }

  body.stock-page .stock-active-filters::-webkit-scrollbar {
    display: none;
  }

  body.stock-page .stock-filter-chip {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 0.76rem;
  }

  /* ── Results grid ─────────────────────────────────────────── */
  body.stock-page .stock-results-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  body.stock-page .stock-results-grid.list-view .car-card {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
  }

  body.stock-page .stock-results-grid .car-card-img {
    height: 220px;
  }

  body.stock-page .stock-results-grid.list-view .car-card-img {
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 220px;
  }

  body.stock-page .stock-results-grid .car-card-title {
    white-space: normal;
    font-size: 1.02rem;
    line-height: 1.35;
  }

  body.stock-page .stock-results-grid .car-card-footer {
    flex-wrap: wrap;
    gap: 10px;
  }

  body.stock-page .stock-results-grid .car-card-actions {
    width: 100%;
    justify-content: space-between;
  }

  body.stock-page .stock-results-grid .compare-btn,
  body.stock-page .stock-results-grid .car-card-link {
    padding: 8px 12px;
    font-size: 0.82rem;
  }

  /* ── Empty state ──────────────────────────────────────────── */
  body.stock-page .stock-empty {
    padding: 40px 20px;
    border-radius: 14px;
  }

  body.stock-page .stock-empty h3 {
    font-size: 1.2rem;
  }

  body.stock-page .stock-empty p {
    font-size: 0.88rem;
  }

  body.stock-page .stock-empty-actions {
    flex-direction: column;
    gap: 10px;
  }

  body.stock-page .stock-empty-actions .btn {
    width: 100%;
    justify-content: center;
  }

  /* ── Pagination ─────────────────────────────────────────── */
  body.stock-page .stock-pagination {
    margin-top: 28px;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
  }

  body.stock-page .stock-page-btn {
    min-width: 40px;
    height: 40px;
    font-size: 0.84rem;
    border-radius: 10px;
  }

  body.stock-page .stock-page-nav {
    min-width: 44px;
  }

  /* ── Filter drawer ────────────────────────────────────────── */
  body.stock-page .stock-filters {
    width: min(100vw, 400px);
    max-width: 100%;
    display: flex;
    flex-direction: column;
  }

  body.stock-page .stock-filters-head {
    padding: max(16px, env(safe-area-inset-top)) 18px 16px;
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
  }

  body.stock-page .stock-filters-form {
    flex: 1;
    overflow-y: auto;
    padding: 18px 18px 12px;
    -webkit-overflow-scrolling: touch;
  }

  body.stock-page .stock-filter-actions {
    position: sticky;
    bottom: 0;
    margin: 8px -18px 0;
    padding: 14px 18px max(14px, env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--stk-line);
    box-shadow: 0 -8px 20px rgba(22, 33, 62, 0.06);
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  body.stock-page .stock-filter-apply,
  body.stock-page .stock-filter-clear {
    width: 100%;
    justify-content: center;
    padding: 14px 16px;
  }
}

@media (max-width: 480px) {
  body.stock-page .stock-filters {
    width: 100vw;
  }

  body.stock-page .stock-hero-copy h1 {
    font-size: 1.42rem;
  }
}
