/* ============================================================
   SPIFFY — Global Responsive CSS
   Covers: admin-sidebar · vsidebar · dash-sidebar · buyer-sidenav
   Desktop (≥992px): all sidebars static and visible
   Mobile (<992px):  all sidebars slide-in drawer
   ============================================================ */

/* ── 1. SIDEBAR — Desktop: always visible & static ────────────── */
.admin-sidebar,
.vsidebar,
.dash-sidebar,
.buyer-sidenav {
  flex-shrink: 0;
  overflow-y: auto;
}

/* Force dark background on all admin/vendor sidebars */
.admin-sidebar,
.vsidebar {
  background: var(--teal-dk, #1e4f5c) !important;
  min-height: calc(100vh - 57px);
}

/* Buyer sidebar light */
.dash-sidebar,
.buyer-sidenav {
  background: #fff;
  border-right: 1px solid var(--border, #e5e7eb);
  min-height: calc(100vh - 57px);
}

/* ── 2. SIDEBAR — Mobile: slide-in drawer ─────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1054;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.open { display: block; }

/* FAB toggle button */
.sidebar-mobile-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 1060;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--teal, #2B6777);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.25);
  font-size: 1.2rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

/* Mobile bar (page title + hamburger) */
.portal-mobile-bar {
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--teal-dk, #1e4f5c);
  color: #fff;
  position: sticky;
  top: 57px;
  z-index: 100;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.portal-mobile-bar .pmb-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  flex: 1;
}
.pmb-toggle {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
}

@media (max-width: 991px) {
  .sidebar-mobile-toggle { display: flex; }
  .portal-mobile-bar { display: flex; }

  /* All sidebars become fixed drawers on mobile */
  .admin-sidebar,
  .vsidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    z-index: 1055;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    width: 240px !important;
    min-height: 100vh !important;
    overflow-y: auto;
  }
  .admin-sidebar.open,
  .vsidebar.open { transform: translateX(0) !important; }

  .dash-sidebar,
  .buyer-sidenav {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    z-index: 1055;
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.4,0,.2,1);
    width: 260px !important;
    min-height: 100vh !important;
    overflow-y: auto;
    padding: 16px !important;
    box-shadow: 4px 0 24px rgba(0,0,0,.12);
  }
  .dash-sidebar.open,
  .buyer-sidenav.open { transform: translateX(0) !important; }

  /* Main content full width on mobile */
  .flex-grow-1.min-w-0,
  .flex-grow-1.overflow-auto { width: 100% !important; padding: 12px !important; }
}

/* ── 3. TABLES — horizontal scroll ────────────────────────────── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 767px) {
  table { font-size: .75rem !important; }
  table th, table td { padding: 6px 8px !important; white-space: nowrap; }
  .hide-mobile { display: none !important; }
}

/* ── 4. FORMS ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .form-control, .form-select { font-size: .9rem !important; min-height: 44px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px !important; }
}

/* ── 5. CARDS & GRIDS ─────────────────────────────────────────── */
@media (max-width: 575px) {
  .spiffy-card.p-4 { padding: 16px !important; }
  .spiffy-card.p-5 { padding: 20px !important; }
  .section-heading { font-size: 1.6rem !important; }
  .row.g-3 > .col-xl-2,
  .row.g-3 > .col-md-3 { flex: 0 0 50%; max-width: 50%; }
}

/* ── 6. NAV (index design) ────────────────────────────────────── */
@media (max-width: 991px) {
  .spiffy-nav .navbar-collapse {
    background: #fff;
    border-top: 1px solid var(--ice, #C8D8E4);
    padding: 12px 0;
    border-radius: 0 0 14px 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,.1);
    max-height: 80vh;
    overflow-y: auto;
  }
  .spiffy-nav .navbar-nav { flex-direction: column !important; padding: 0 12px; }
  .spiffy-nav .navbar-nav .nav-link { padding: 10px 12px !important; border-radius: 8px; }
  .spiffy-nav .d-flex.align-items-center.gap-2 {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 12px;
    gap: 8px !important;
  }
  .btn-builder, .btn-login, .btn-vendor, .nav-dashboard {
    width: 100% !important;
    justify-content: center;
  }
}

/* ── 7. HOMEPAGE VERTICAL SECTIONS ───────────────────────────── */
@media (max-width: 767px) {
  .ls-inner, .vs-inner { gap: 24px !important; padding: 40px 0 !important; }
  .ls-headline, .vs-headline { font-size: 1.7rem !important; }
  .vs-inner, .ls-inner { grid-template-columns: 1fr !important; }
  .vs-prod-grid, .ls-prod-grid { grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
  .vs-prod-img, .ls-prod-img { height: 80px !important; font-size: 2rem !important; }
  .vspot, .leather-spotlight { padding: 48px 0 !important; }
}

/* ── 8. KIT BUILDERS ──────────────────────────────────────────── */
@media (max-width: 767px) {
  .builder-layout { flex-direction: column !important; }
  .builder-sidebar { width: 100% !important; max-height: 200px; overflow-y: auto; }
  canvas { max-width: 100% !important; touch-action: none; }
}

/* ── 9. FOOTER ────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .site-footer { padding: 40px 0 20px !important; }
  .footer-bottom { text-align: center; }
  .footer-bottom .d-flex { flex-direction: column !important; gap: 8px !important; }
}

/* ── 10. MODALS ───────────────────────────────────────────────── */
@media (max-width: 575px) {
  .modal-dialog { margin: 8px !important; }
  .modal-body { padding: 16px !important; }
}

/* ── 11. PRINT (export-quote.php) ─────────────────────────────── */
@media print {
  .spiffy-nav, footer, .sidebar-mobile-toggle,
  .portal-mobile-bar, .admin-sidebar, .vsidebar,
  .dash-sidebar, .buyer-sidenav { display: none !important; }
  body { padding: 0 !important; }
  .spiffy-card { box-shadow: none !important; border: 1px solid #ccc !important; }
}

/* ── 12. TOUCH TARGETS ────────────────────────────────────────── */
@media (max-width: 991px) {
  a, button, .btn, [role="button"] {
    -webkit-tap-highlight-color: rgba(43,103,119,.15);
  }
}

/* ── 13. UTILITY ──────────────────────────────────────────────── */
.min-w-0 { min-width: 0; }
@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
  .text-center-mobile { text-align: center !important; }
  .w-100-mobile { width: 100% !important; }
}
