/* Theme-aware tokens — inherit from block theme / Elementor / generic WP */
.ctm-inventory-page {
  --ctm-color-primary: #2a3c46;
  --ctm-color-secondary: var(--wp--preset--color--secondary, var(--e-global-color-secondary, var(--color-secondary, currentColor)));
  --ctm-color-accent: #da251c;
  --ctm-color-text: inherit;
  --ctm-color-heading: #2a3c46;
  --ctm-color-muted: color-mix(in srgb, currentColor 60%, transparent);
  --ctm-color-border: color-mix(in srgb, currentColor 18%, transparent);
  --ctm-color-surface: #f0f0f0;
  --ctm-color-surface-raised: #f7f7f7;
  --ctm-color-card: #ffffff;
  --ctm-radius: var(--wp--custom--border-radius, 8px);
  --ctm-font: "Oswald", Oswald;

  padding: 1.5rem 1rem 3rem;
  color: var(--ctm-color-text);
  font-family: var(--ctm-font);
  background: var(--ctm-color-surface);
  box-sizing: border-box;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
}

.ctm-inventory-page *,
.ctm-inventory-page *::before,
.ctm-inventory-page *::after {
  box-sizing: border-box;
}

.ctm-container {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

/* Full-width layout — break out of theme containers (GeneratePress, etc.) */
body.ctm-inventory-full-width .site-content,
body.ctm-inventory-full-width #content,
body.ctm-inventory-full-width .content-area,
body.ctm-inventory-full-width .site-main,
body.ctm-inventory-full-width .entry-content {
  max-width: none;
  width: 100%;
}

body.ctm-inventory-full-width .grid-container.container,
body.ctm-inventory-full-width .site.grid-container {
  max-width: none;
  width: 100%;
  padding-left: 0;
  padding-right: 0;
}

body.ctm-inventory-full-width .ctm-inventory-page {
  width: 100%;
  max-width: 100%;
}

body.ctm-inventory-full-width .ctm-container {
  max-width: 1100px;
  width: 100%;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.ctm-listing-banner {
  align-items: center;
  background-blend-mode: normal;
  background-image: url(https://ctmtrucks.com/wp-content/uploads/2026/03/isuzu-mountain-10-opacity.webp);
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  display: block;
  text-align: center;
  margin: 0 0 1rem;
  padding: 4rem 1rem 1.875rem;
  width: 100%;
}

.ctm-inventory-archive {
  padding-top: 0;
}

.ctm-listing-title {
  margin: 0;
  font-size: 2.8rem;
  font-weight: 700;
  color: #2a3c46;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
  padding-bottom: 0.625rem;
}

@media (max-width: 775px) {
  .ctm-listing-banner {
    padding-top: 3.5rem;
  }

  .ctm-listing-title {
    font-size: 2.2rem;
  }
}

/* Live-page frame: top CTA → results → filters bottom */
.ctm-inventory-layout {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.ctm-inventory-top {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}

.ctm-filter-jump {
  display: inline-block;
  background: var(--ctm-color-accent);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.35s ease;
  border-radius: 9999px;
  padding: 0.75rem 1.25rem;
  border: none;
  box-shadow: 0 3px 5px 2px rgba(0, 0, 0, 0.32);
}

.ctm-filter-jump:hover {
  background: #909eab;
  color: #fff;
  box-shadow: 0 3px 5px 2px rgba(0, 0, 0, 0.5);
}

.ctm-inventory-results {
  min-width: 0;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

/* Filters at bottom — card style like live page */
.ctm-filter-box {
  width: 100%;
  max-width: 960px;
  margin: 0.5rem auto 0;
  scroll-margin-top: 5rem;
}

.ctm-filters {
  background: var(--ctm-color-card);
  border: 1px solid var(--ctm-color-border);
  border-radius: var(--ctm-radius);
  padding: 1.25rem 1.5rem 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ctm-filters-title {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--ctm-color-heading);
  text-align: left;
}

.ctm-filters-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 0.875rem 1rem;
  align-items: end;
}

.ctm-filter-search {
  grid-column: 1 / -1;
}

.ctm-filter-price {
  grid-column: span 2;
}

.ctm-filter-field span {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--ctm-color-heading);
}

.ctm-filters input,
.ctm-filters select {
  width: 100%;
  max-width: 100%;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--ctm-color-border);
  border-radius: calc(var(--ctm-radius) - 2px);
  background: #fff;
  color: inherit;
  font: inherit;
}

.ctm-filter-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-self: end;
}

.ctm-filter-actions .ctm-btn {
  width: 100%;
}

@media (max-width: 900px) {
  .ctm-filters-grid {
    grid-template-columns: 1fr 1fr;
  }

  .ctm-filter-search,
  .ctm-filter-price {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .ctm-filters-grid {
    grid-template-columns: 1fr;
  }
}

.ctm-btn {
  display: block;
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: calc(var(--ctm-radius) - 2px);
  text-align: center;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity 0.2s ease;
}

.ctm-btn:hover {
  opacity: 0.88;
}

.ctm-btn-primary {
  background: var(--ctm-color-primary);
  color: #fff;
  border-color: var(--ctm-color-primary);
}

.ctm-btn-secondary {
  background: transparent;
  color: var(--ctm-color-primary);
  border-color: var(--ctm-color-border);
}

/* Listing grid — tighter cards like live page */
.ctm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
}

@media (min-width: 900px) {
  .ctm-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .ctm-grid {
    grid-template-columns: 1fr;
  }
}

.ctm-card {
  border: 1px solid var(--ctm-color-primary);
  border-radius: 0.25rem;
  overflow: hidden;
  background: var(--ctm-color-card);
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
}

.ctm-card-image-link {
  display: block;
  color: inherit;
  text-decoration: none;
  max-width: 100%;
}

.ctm-card img {
  width: 100%;
  max-width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
}

.ctm-card-placeholder {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ctm-color-surface-raised);
  color: var(--ctm-color-muted);
}

.ctm-card-body {
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.ctm-card-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  text-align: center;
  word-wrap: break-word;
}

.ctm-card-title a {
  color: var(--ctm-color-heading);
  text-decoration: none;
}

.ctm-card-title a:hover {
  color: var(--ctm-color-primary);
}

.ctm-card-stats {
  display: flex;
  align-items: stretch;
  justify-content: center;
  border: 1px solid #b7b7b7;
  margin-bottom: 0.75rem;
}

.ctm-card-stat {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 0.75rem 0.5rem;
}

.ctm-card-stat-divider {
  border-left: 1px solid var(--ctm-color-primary);
}

.ctm-card-stat-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ctm-color-muted);
  margin-bottom: 0.25rem;
}

.ctm-card-stat-value {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ctm-color-heading);
}

.ctm-card-body-style {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  color: var(--ctm-color-heading);
}

.ctm-card-fuel {
  margin: 0 0 0.75rem;
  text-align: center;
  font-size: 0.9rem;
  color: var(--ctm-color-heading);
  padding-bottom: 0.75rem;
  border-bottom: 1px solid color-mix(in srgb, var(--ctm-color-primary) 32%, transparent);
}

.ctm-card-stock {
  color: var(--ctm-color-muted);
  font-size: 0.875rem;
  margin: 0 0 1rem;
  text-align: center;
}

.ctm-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
}

.ctm-card-action {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-width: 3.25rem;
  padding: 0.5rem 0.4rem;
  border: 1px solid color-mix(in srgb, var(--ctm-color-primary) 32%, transparent);
  border-radius: 4px;
  background: var(--ctm-color-primary);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 3px 4px -2px rgba(0, 0, 0, 0.07);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ctm-card-action:hover {
  background: #909eab;
  color: var(--ctm-color-primary);
}

.ctm-card-action-details {
  flex: 1;
  min-width: 5.5rem;
  padding-left: 0.6rem;
  padding-right: 0.6rem;
}

.ctm-icon {
  width: 1rem;
  height: 1rem;
  display: block;
}

/* Listing inquiry modal */
body.ctm-modal-open {
  overflow: hidden;
}

.ctm-inquiry-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ctm-inquiry-modal[hidden] {
  display: none;
}

.ctm-inquiry-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.ctm-inquiry-modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: var(--ctm-radius);
  padding: 1.5rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.ctm-inquiry-modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  border: none;
  background: none;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ctm-color-muted);
}

.ctm-inquiry-modal-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  padding-right: 2rem;
}

.ctm-inquiry-modal-subtitle {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--ctm-color-muted);
}

.ctm-inquiry-modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ctm-inquiry-modal-actions .ctm-btn {
  width: auto;
  min-width: 7rem;
}

.ctm-inventory-results .nav-links,
.ctm-inventory-results .pagination {
  margin-top: 1.5rem;
}

.ctm-no-results {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ctm-color-muted);
}

/* ========== Single vehicle ========== */
.ctm-inventory-single .ctm-container {
  max-width: 1100px;
}

.ctm-single-header {
  min-width: 0;
}

.ctm-single-header h1 {
  word-wrap: break-word;
  overflow-wrap: anywhere;
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 4vw, 2rem);
}

.ctm-subtitle {
  word-wrap: break-word;
}

.ctm-single-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 768px) {
  .ctm-inventory-page {
    padding: 1rem 0.75rem 2rem;
  }

  .ctm-inventory-single .ctm-container,
  body.ctm-inventory-full-width .ctm-inventory-single .ctm-container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .ctm-single-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* Detail page gallery carousel */
.ctm-single-gallery {
  outline: none;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.ctm-gallery-main {
  position: relative;
  border-radius: var(--ctm-radius);
  overflow: hidden;
  background: var(--ctm-color-surface-raised);
  border: 1px solid var(--ctm-color-border);
  max-width: 100%;
}

.ctm-main-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  display: block;
}

.ctm-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: color-mix(in srgb, #fff 88%, currentColor 12%);
  color: var(--ctm-color-heading);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease;
  padding: 0;
}

.ctm-gallery-nav:hover {
  opacity: 0.9;
}

.ctm-gallery-prev {
  left: 0.5rem;
}

.ctm-gallery-next {
  right: 0.5rem;
}

.ctm-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
  padding-bottom: 4px;
  max-width: 100%;
  scrollbar-width: thin;
}

.ctm-thumb {
  flex: 0 0 auto;
  padding: 0;
  border: 2px solid transparent;
  border-radius: calc(var(--ctm-radius) - 4px);
  background: none;
  cursor: pointer;
  overflow: hidden;
  opacity: 0.72;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

.ctm-thumb:hover,
.ctm-thumb.is-active {
  opacity: 1;
}

.ctm-thumb.is-active {
  border-color: var(--ctm-color-primary);
}

.ctm-thumb img {
  width: 80px;
  height: 60px;
  object-fit: contain;
  display: block;
  max-width: none;
}

.ctm-price-box {
  border: 1px solid var(--ctm-color-border);
  border-radius: var(--ctm-radius);
  padding: 1.5rem;
  text-align: center;
  background: var(--ctm-color-card);
}

.ctm-price {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
  color: var(--ctm-color-heading);
}

.ctm-specs,
.ctm-seller-notes,
.ctm-options {
  min-width: 0;
  max-width: 100%;
}

.ctm-spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 12px;
  width: 100%;
}

.ctm-spec-grid dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--ctm-color-muted);
}

.ctm-spec-grid dd {
  margin: 0 0 12px;
  font-weight: 600;
  color: var(--ctm-color-heading);
  word-break: break-word;
}

.ctm-description {
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.ctm-back a {
  color: var(--ctm-color-primary);
}

/* Single vehicle sidebar + contact form */
.ctm-single-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  max-width: 100%;
}

.ctm-contact-form-wrap {
  background: var(--ctm-color-card);
  border: 1px solid var(--ctm-color-border);
  border-radius: var(--ctm-radius);
  padding: 1.25rem;
  max-width: 100%;
  overflow: hidden;
}

.ctm-contact-form-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ctm-color-heading);
}

.ctm-contact-form-subtitle {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: var(--ctm-color-muted);
  line-height: 1.4;
  word-wrap: break-word;
}

.ctm-contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
}

.ctm-contact-form input,
.ctm-contact-form textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--ctm-color-border);
  border-radius: calc(var(--ctm-radius) - 2px);
  background: #fff;
  color: inherit;
  font: inherit;
}

.ctm-contact-form textarea {
  resize: vertical;
  min-height: 100px;
}

.ctm-honeypot {
  position: absolute;
  left: -9999px;
  height: 0;
  overflow: hidden;
}

.ctm-notice {
  padding: 0.75rem 1rem;
  border-radius: var(--ctm-radius);
  margin-bottom: 1rem;
  border: 1px solid var(--ctm-color-border);
}

.ctm-notice-success {
  background: color-mix(in srgb, #46b450 15%, Canvas);
  border-color: color-mix(in srgb, #46b450 40%, transparent);
}

.ctm-notice-error {
  background: color-mix(in srgb, #dc3232 12%, Canvas);
  border-color: color-mix(in srgb, #dc3232 35%, transparent);
}

/* Homepage: body-style category cards */
.ctm-body-styles-wrap,
.ctm-featured-wrap {
  background: transparent;
  padding: 1rem 0 2rem;
}

.ctm-body-styles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

@media (max-width: 1024px) {
  .ctm-body-styles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .ctm-body-styles {
    grid-template-columns: 1fr;
  }
}

.ctm-body-style-card {
  text-align: center;
}

.ctm-body-style-inner {
  position: relative;
  overflow: hidden;
  border-radius: 0.25rem;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--ctm-color-primary) 25%, transparent);
}

.ctm-body-style-inner img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  display: block;
}

.ctm-body-style-title {
  margin: 0.75rem 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ctm-color-heading);
  padding: 0 0.75rem;
}

.ctm-body-style-count {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--ctm-color-muted);
  padding: 0 0.75rem;
}

.ctm-body-style-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  text-decoration: none;
}

.ctm-body-style-inner:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

/* Homepage: featured cheapest-per-style grid */
.ctm-featured-wrap .ctm-container {
  max-width: 1100px;
}

.ctm-featured-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
}

@media (max-width: 900px) {
  .ctm-featured-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .ctm-featured-grid {
    grid-template-columns: 1fr;
  }
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal !important;
}

/*
 * Prevent desktop→mobile flash while theme / LiteSpeed CSS is still loading.
 * Homepage shortcodes reuse these class names.
 */
@media (max-width: 767.98px) {
  .filtered-inventroy-container .row {
    display: flex;
    flex-wrap: wrap;
  }

  .filtered-inventroy-container .filtered-inventroy-card-container,
  .filtered-inventroy-container .card-col {
    flex: 0 0 100%;
    max-width: 100%;
    width: 100%;
  }

  #vehicles-container > [class*="col-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }
}
