/* ============================================================
   KarmaOman Responsive — layered on design-system.css + style.css
   Breakpoints (Mobile First + RTL friendly):
     xs: <576
     sm: ≥576
     md: ≥768
     lg: ≥992
     xl: ≥1200
     xxl: ≥1600
   Design: Premium Automotive — Minimal — Modern
   ============================================================ */

/* ---------- XXL / Large Desktop ---------- */
@media (min-width: 1600px) {
  :root { --k-container-max: 1440px; }
  .container, .container-lg, .container-md, .container-sm, .container-xl {
    max-width: 1440px;
  }
  .k-home-hero-row { min-height: 580px; }
}

/* ---------- XL / Desktop (≤1199.98) ---------- */
@media (max-width: 1199.98px) {
  :root {
    --k-header-h: 68px;
    --k-space-4xl: 4rem;
  }
  .site-header .navbar .container {
    padding-left: var(--k-space-md);
    padding-right: var(--k-space-md);
  }
  .site-header .navbar-nav {
    margin-top: var(--k-space-xs);
    padding-bottom: var(--k-space-xs);
    gap: 2px;
  }
  .site-header .navbar-nav .nav-link {
    padding: 0.7rem 0.85rem;
  }
  .site-header .navbar-nav .nav-link.active::after { display: none; }
  .d-lg-none-block { display: block !important; }

  .k-home-hero,
  .hero-section { padding: var(--k-space-4xl) 0; }
  .k-home-hero-row { min-height: 480px; }

  /* Admin layout collapse */
  body.admin-page { flex-direction: column; }
  .admin-sidebar { display: none; }
  .admin-topbar { padding-right: var(--k-space-sm); padding-left: var(--k-space-sm); }

  .k-hero-badge-float {
    position: relative !important;
    inset: auto !important;
    width: auto !important;
    margin-top: var(--k-space-lg);
    transform: none !important;
  }

  /* Filter bar compact */
  .filter-bar { padding: var(--k-space-md); }
  .filter-bar .fb-title { font-size: 1rem; }
}

/* ---------- LG / Laptop Tablet-Landscape (≤991.98) ---------- */
@media (max-width: 991.98px) {
  :root {
    --k-space-3xl: 3.25rem;
    --k-space-4xl: 3.5rem;
  }
  .k-section { padding: var(--k-space-3xl) 0; }
  .k-section-head .k-section-title { font-size: var(--k-fs-h3); letter-spacing: -.012em; }
  .k-section-head .k-eyebrow { font-size: .7rem; }

  .hero-section {
    padding: var(--k-space-3xl) 0;
    border-bottom-left-radius: var(--k-radius-lg);
    border-bottom-right-radius: var(--k-radius-lg);
  }
  .k-home-hero { padding: 3.25rem 0 3.75rem; }
  .k-home-hero .h-title { font-size: clamp(1.75rem, 4vw, 2.5rem); line-height: 1.25; }
  .k-home-hero-row { min-height: auto; }

  .section { padding: var(--k-space-3xl) 0; }
  .section-title { font-size: var(--k-fs-h3); }

  /* Stack cols that used to be side-by-side */
  .k-home-paths .row.g-4 > [class*=col] + [class*=col],
  .k-home-adv .row.g-4 > [class*=col] + [class*=col],
  .k-home-featured .row.g-4 > [class*=col] + [class*=col] {
    margin-top: var(--k-space-lg);
  }

  /* Vehicle detail sticky sidebar disabled */
  .sticky-top-lg { position: static !important; }

  /* K-drop-mega no shadow-lg on touch */
  .k-dropdown-mega { box-shadow: var(--k-shadow-md) !important; }
}

/* ---------- MD / Tablet (≤767.98) ---------- */
@media (max-width: 767.98px) {
  :root {
    --k-radius-xl: 18px;
    --k-radius-lg: 14px;
    --k-space-2xl: 2rem;
    --k-space-3xl: 2.5rem;
  }

  /* Full-width CTAs */
  .hero-cta .btn,
  .k-hero-cta .btn {
    width: 100%;
    margin-bottom: var(--k-space-xs);
  }
  .hero-cta,
  .k-hero-cta { flex-direction: column; gap: var(--k-space-xs); align-items: stretch !important; }

  /* Gallery thumbs grid */
  .gallery-thumbs { grid-template-columns: repeat(4, 1fr); gap: 0.4rem; }

  /* Page title */
  .page-title { font-size: var(--k-fs-h3); }

  /* Section headers full width */
  .section-header { align-items: stretch; }
  .section-header > * { width: 100%; }

  /* Admin table & cards compact */
  .admin-table-card .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: var(--k-space-sm);
  }
  .search-input-group { max-width: 100%; }

  .table-responsive-mobile {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Stat cards */
  .stat-card .stat-value { font-size: 1.35rem; }

  /* Footer center align on tablet */
  .site-footer [class*="col-"]:not(:first-child) { text-align: right; }
  .site-footer .newsletter-form { justify-content: flex-start; }
  .site-footer h5, .site-footer h6 { margin-top: var(--k-space-sm); }

  /* Home feature spacing */
  .k-home-parts .row { row-gap: var(--k-space-md); }
  .k-home-cta .row { row-gap: var(--k-space-md); }
  .k-home-cta { padding: 1.75rem !important; }
  .k-home-cta .k-cta-actions { flex-direction: column; align-items: stretch !important; }
  .k-home-cta .k-cta-actions .btn { width: 100%; }

  /* Filter bar full width actions */
  .filter-bar .fb-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-bar .fb-actions > * { width: 100%; }

  /* Pagination compact */
  .k-pagination .page-link { min-width: 38px; padding: .5rem .7rem; font-size: .85rem; }

  /* Breadcrumb wrap */
  .breadcrumb { padding: .6rem .75rem; font-size: .82rem; }

  /* Admin cards body padding */
  .kar-card .kc-header,
  .kar-card .kc-footer { padding-inline: var(--k-space-md); }
  .ka-table thead th { padding-inline: 14px; }
  .ka-table tbody td { padding-inline: 14px; }
}

/* ---------- SM / Mobile-Landscape (≤575.98) ---------- */
@media (max-width: 575.98px) {
  :root {
    --k-space-2xl: 1.75rem;
    --k-space-3xl: 2rem;
    --k-space-4xl: 2.5rem;
    --k-space-xl: 1.25rem;
    --k-space-lg: 1rem;
    --k-radius-lg: 12px;
    --k-radius-xl: 16px;
    --k-fs-h2: 1.6rem;
    --k-fs-h3: 1.35rem;
  }

  .site-main { padding-top: var(--k-space-sm); padding-bottom: var(--k-space-3xl); }
  .card-img-top { height: 200px; object-fit: cover; }
  .gallery-thumbs { grid-template-columns: repeat(4, 1fr); gap: 0.35rem; }

  .btn { padding: var(--k-space-sm) var(--k-space-lg); font-size: .9rem; }
  .btn-xl { padding: .85rem 1.25rem; font-size: 1rem; }
  .btn-sm { padding: .45rem .9rem; font-size: .82rem; }

  .form-control, .form-select, .k-input {
    padding: var(--k-space-sm) 0.75rem;
    font-size: .93rem;
  }

  .k-home-hero { padding: 2.25rem 0 2.75rem; }
  .k-home-hero .h-title {
    font-size: clamp(1.55rem, 7.2vw, 1.95rem);
    line-height: 1.32;
    letter-spacing: -.01em;
  }
  .k-home-hero p.lead { font-size: .98rem; line-height: 1.8; }

  .section, .k-section { padding: var(--k-space-2xl) 0; }

  /* Hero stats 3-col compact */
  .k-hero-stats { grid-template-columns: repeat(3, 1fr); gap: var(--k-space-xs); }
  .k-hero-stats .h-stat-num { font-size: 1.05rem; font-weight: 800; }
  .k-hero-stats .h-stat-lbl { font-size: var(--k-fs-xs); }

  /* Admin content padding */
  .admin-content { padding: var(--k-space-md); }
  .admin-form-card { padding: var(--k-space-md); }
  .kar-stat-card { padding: 18px; }
  .kar-stat-card .sc-value { font-size: 22px; }

  /* Page title bar compact */
  .page-title-bar {
    padding: var(--k-space-2xl) 0 var(--k-space-md);
    margin-bottom: var(--k-space-xl);
  }
  .page-title-bar .page-title { font-size: 1.45rem; }

  /* Vehicle card specs 2-col on mobile */
  .k-vehicle-card .vc-specs { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .k-vehicle-card .vc-cta { flex-direction: column; }
  .k-vehicle-card .vc-cta .btn { width: 100%; }

  /* Blog cards 1-col compact */
  .k-blog-card .body { padding: 16px 18px 18px; }
  .k-blog-card h3 { font-size: 1.05rem; }
  .k-blog-card .excerpt { font-size: .88rem; }

  /* Footer full center on small mobile */
  .site-footer [class*="col-"] { text-align: center; }
  .site-footer .footer-brand-card { text-align: center; }
  .site-footer .d-flex.align-items-center.gap-2 { justify-content: center; }
  .site-footer .footer-stats { max-width: 320px; margin-inline: auto; }
  .site-footer ul { padding: 0; }
  .site-footer .footer-link { text-align: center; }
  .site-footer .newsletter-form { justify-content: center; }

  /* Brand mark compact */
  .k-brand-mark { width: 40px; height: 40px; font-size: 1.1rem; }
  .k-brand-text { font-size: 1.15rem; }
  .k-brand-sub { display: none; }

  /* Social + search full-width */
  .site-header .d-flex.gap-2 { width: 100%; }
  .site-header .d-flex.gap-2 .btn { flex: 1; }

  /* Empty state compact */
  .k-empty-state { padding: var(--k-space-2xl) var(--k-space-md); }
  .k-empty-state .es-icon { width: 64px; height: 64px; font-size: 1.8rem; }
  .k-empty-state .es-title { font-size: 1.1rem; }
  .k-empty-state .es-actions .btn { width: 100%; margin-bottom: var(--k-space-xs); }

  /* Table td compact */
  .ka-table thead th { padding: 10px 12px; font-size: 11px; }
  .ka-table tbody td { padding: 12px; font-size: 12.5px; }
  .ka-table .req-avatar { width: 30px; height: 30px; font-size: 11.5px; }

  /* Pagination mobile: hide some pages */
  .k-pagination li.page-item:not(.active):not(.first):not(.last):not(.prev):not(.next) {
    display: none;
  }
  .k-pagination li.page-item.first + li + li.page-item,
  .k-pagination li.page-item.last { display: inline-flex; }

  /* Filter bar: inputs 100% */
  .filter-bar .row > [class*=col] + [class*=col] { margin-top: var(--k-space-xs); }
}

/* ---------- XS / Very Small Mobile ---------- */
@media (max-width: 379.98px) {
  :root { --k-radius-md: 8px; }
  .h-hero-stat strong { font-size: 1.02rem; }
  .btn, .btn-k-accent, .btn-k-primary { font-size: .85rem; padding: .55rem .85rem; }
  .k-home-hero .h-title { font-size: 1.4rem; }
  .ka-table .req-customer { flex-direction: column; align-items: flex-start; }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .admin-topbar, .admin-sidebar,
  .kar-topbar, .kar-sidebar, .no-print, .sticky-top,
  .flash-wrap, .fb-actions, .es-actions, .k-cta-actions, .vc-cta {
    display: none !important;
  }
  body { background: #fff !important; color: #000 !important; }
  .k-card, .kar-card, .k-vehicle-card, .card,
  .kar-stat-card, .k-blog-card, .profile-card {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
    break-inside: avoid;
  }
  .k-footer { background: #fff !important; color: #000 !important; }
  .k-footer .footer-link, .k-footer p, .text-footer-muted { color: #333 !important; }
  a { text-decoration: underline; }
  .container { max-width: 100% !important; width: 100% !important; }
}
