/* instant-quote.css - complete stylesheet for Instant Quote UI
   - Fixed 4-column desktop grid (3/2/1 at breakpoints)
   - 1em gap between cards
   - Cards centered in grid cells, limited max-width so they don't stretch full width
   - Top categories bar positioned ~5em from top
   - Bottom floating bar constrained to max 8em with three zones: total (left), chosen items (center), actions (right)
   - Qty controls, selection state, accessibility helpers, and responsive tweaks
*/

:root{
  --bg: #f7f9fb;
  --card: #ffffff;
  --muted: #6b7b8a;
  --accent: #ff7f32;
  --accent-dark: #072B5A;
  --radius: 12px;
  --gap: 1em;          /* 1em gap between cards */
  --max-width: 1200px;
}

/* Root and content container */
#qp-instant-quote-root {
  font-family: Inter, system-ui, Roboto, Arial, sans-serif;
  color: #0a2e3b;
  background: var(--bg);
  padding: 18px;
  box-sizing: border-box;
  max-width: var(--max-width);
  margin: 0 auto;
}
#qp-content-container { max-width: var(--max-width); margin: 0 auto; }

/* Top fixed category bar */
#qp-top-cats {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 5em !important;            /* moved down ~5em */
  width: calc(100% - 32px);
  max-width: var(--max-width);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  z-index: 13000;
  padding: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
#qp-top-cats .qp-cats-wrapper {
  display:flex;
  gap:12px;
  width:100%;
  align-items:stretch;
  overflow-x:auto;
  padding: 4px 8px;
}
#qp-top-cats .qp-cat-btn {
  flex: 1 1 0;
  min-width: 110px;
  text-align:center;
  padding: 10px 12px;
  border-radius:8px;
  cursor:pointer;
  color:#fff;
  font-weight:700;
  border:2px solid transparent;
  background:var(--accent-dark);
  white-space:nowrap;
  transition: background .14s ease, transform .08s ease, color .14s ease;
}
#qp-top-cats .qp-cat-btn:hover { background: var(--accent); transform: translateY(-2px); }
#qp-top-cats .qp-cat-btn.active { background: var(--accent); box-shadow: 0 6px 18px rgba(7,43,90,0.06); }
#qp-top-cats .qp-cat-btn[data-cat="uncategorized"] { display:none; }

/* Spacer so content isn't hidden under the fixed top bar */
#qp-top-spacer { height: calc(5.5em + 8px); width: 100%; }

/* Grid: fixed 4 columns on desktop, with 1em gap and centered cards */
.qp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* 4 columns desktop */
  gap: var(--gap);                        /* 1em gap between cards */
  align-items: stretch;
  grid-auto-rows: 1fr;                    /* equal-height rows */
  justify-items: center;                  /* center cards in their grid cell */
  width: 100%;
  box-sizing: border-box;
}

/* Breakpoints: 3 / 2 / 1 columns */
@media (max-width: 1000px) {
  .qp-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 800px) {
  .qp-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .qp-grid { grid-template-columns: 1fr; }
}

/* Card: narrower, centered, fills grid row height so footers align */
.qp-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px;
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:stretch;
  box-shadow: 0 0 0 2px var(--accent-dark), 0 6px 18px rgba(7,43,90,0.04);
  box-sizing: border-box;
  width: auto;            /* don't stretch to full cell width */
  max-width: 280px;       /* card max width — adjust to taste (220-320px) */
  height: 100%;           /* fill the grid row height so footers align */
  margin: 0;              /* grid centers the card */
}

/* Media token (image token inside card) */
.qp-media {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  background-size: cover;
  background-position: center;
  border-radius: 12px;
  border: 2px solid var(--accent-dark);
  flex: 0 0 auto;
  box-sizing: border-box;
  overflow: hidden;
}
.qp-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}
@media (max-width: 480px) {
  .qp-media { width: 72px; height: 72px; border-width: 2px; }
}

/* Name */
.qp-name {
  font-weight:700;
  margin-top:6px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-height:3.2rem;
  text-align:center;
}

/* Card footer with qty controls (pinned to bottom) */
.qp-card-footer {
  margin-top: auto; /* pushes footer to bottom */
  display:flex;
  flex-direction:column;
  gap:8px;
  align-items:center;
  padding-top: 8px;
  width:100%;
}
.qp-price {
  color:var(--muted);
  font-size:.95rem;
  text-align:center;
  margin-bottom:4px;
  width:100%;
}

/* Qty controls */
.qp-qty {
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:center;
}
.qp-btn {
  background:#fff;
  border:1px solid rgba(0,0,0,0.06);
  padding:8px 12px;
  border-radius:8px;
  cursor:pointer;
  transition: background .12s ease, color .12s ease;
  color:#0a2e3b;
  min-width:36px;
  text-align:center;
}
.qp-btn:hover { background: var(--accent); color:#fff; }
.qp-qty-btn { padding:6px 10px; font-size:1.05rem; line-height:1; }
.qp-qty-input {
  width:56px;
  text-align:center;
  padding:6px 8px;
  border-radius:8px;
  border:1px solid rgba(0,0,0,0.06);
}

/* Selection highlight */
.qp-card.qp-selected { outline: 3px solid rgba(255,127,50,0.18); transform: translateY(-4px); }

/* Floating bottom summary bar (three zones) */
#qp-floating {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 1.25em;
  width: calc(100% - 32px);
  max-width: var(--max-width);
  background: rgba(255,255,255,0.98);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);
  padding: 8px 12px;
  display:flex;
  align-items:center;
  gap:12px;
  z-index:12000;
  max-height: 8em;
  box-sizing:border-box;
}

/* Left: total */
#qp-floating .qp-floating-left {
  flex: 0 0 auto;
  display:flex;
  align-items:center;
  gap:8px;
  min-width: 8rem;
}
#qp-total { font-weight:800; font-size:1.05rem; }

/* Center: chosen items */
#qp-floating .qp-floating-center {
  flex: 1 1 0;
  display:flex;
  justify-content:center;
  align-items:center;
  overflow:hidden;
}
.qp-chosen-list {
  display:flex;
  gap:8px;
  align-items:center;
  overflow-x:auto;
  max-height: calc(8em - 56px);
  padding:4px;
  justify-content:center;
}
.qp-chosen-item {
  background:#f1f5f9;
  padding:6px 8px;
  border-radius:8px;
  font-size:.95rem;
  display:flex;
  gap:8px;
  align-items:center;
}

/* Right: actions */
#qp-floating .qp-floating-right {
  flex: 0 0 auto;
  display:flex;
  gap:8px;
  align-items:center;
}

/* Full-load badge (adjacent to total) */
#qp-fullloads-badge { font-size:0.9rem; color:#0a2e3b; opacity:0.9; margin-left:8px; }

/* Buttons */
.qp-btn-primary { background: var(--accent); color: #fff; border: 0; padding: 10px 14px; border-radius: 10px; cursor: pointer; font-weight:700; }
.qp-btn-secondary { background: transparent; color: var(--muted); border: 1px solid rgba(0,0,0,0.06); padding: 8px 12px; border-radius: 10px; }

/* Empty state */
.qp-empty { padding:28px; text-align:center; color:var(--muted); }

/* Responsive tweaks */
@media (max-width: 1000px) {
  #qp-top-cats { top: 4.5em !important; }
  #qp-top-spacer { height: calc(4.8em + 8px); }
}
@media (max-width: 640px) {
  #qp-top-cats { top: 3.5em !important; }
  #qp-top-spacer { height: calc(3.8em + 6px); }
  #qp-floating { padding:8px; max-height:7.2em; }
  .qp-chosen-list { max-height: calc(7.2em - 48px); }
  #qp-floating .qp-floating-center { padding: 0 6px; }
  #qp-floating .qp-floating-left { min-width: 6.5rem; }
  .qp-card { max-width: 260px; }
}
@media (max-width: 480px) {
  .qp-grid { grid-template-columns: 1fr; }
  #qp-top-cats .qp-cat-btn { min-width: 90px !important; padding: 8px 10px !important; font-size: 0.92rem; }
  .qp-media { width:72px; height:72px; }
  .qp-btn-primary, .qp-btn-secondary { padding: 8px 10px; font-size: .95rem; }
  .qp-card { max-width: 100%; width: 100%; }
}

/* Accessibility helper: visually-hidden */
.visually-hidden { position:absolute !important; height:1px; width:1px; overflow:hidden; clip:rect(1px,1px,1px,1px); white-space:nowrap; border:0; padding:0; margin:-1px; }