/* =============================================================
   Induction Portal — Basket + View Modes
   -------------------------------------------------------------
   Self-contained: relies only on the catalogue's existing
   `--brand`, `--accent`, etc. tokens. No risk of clashing with
   other pages.
   ============================================================= */

/* --- View toggle (Grid · List · Compact) ------------------- */

.viewToggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 99px;
  background: #fff;
  margin-left: auto;
  flex-shrink: 0;
}
.viewToggle button {
  background: none;
  border: 0;
  width: 38px;
  height: 38px;
  border-radius: 99px;
  cursor: pointer;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
  padding: 0;
}
.viewToggle button:hover { color: #0b3d91; background: #eef3fb; }
.viewToggle button.active {
  background: linear-gradient(135deg, #0b3d91, #1d4ed8);
  color: #fff;
}
.viewToggle button svg { width: 18px; height: 18px; }

/* --- Card "Add to basket" button -------------------------- */

.basketAdd {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff;
  border: 1.5px solid var(--accent, #f5a623);
  color: var(--accent, #f5a623);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, background .15s, color .15s;
  font-size: 1rem;
  padding: 0;
}
.basketAdd:hover { background: var(--accent, #f5a623); color: #1f2937; transform: translateY(-1px); }
.basketAdd.is-in {
  background: linear-gradient(135deg, #10803a, #22c55e);
  color: #fff;
  border-color: transparent;
}
.basketAdd.is-in:hover { background: #b91c1c; }
.basketAdd.is-in::before { content: "✓"; font-weight: 800; }
.basketAdd:not(.is-in)::before { content: "🛒"; }
.basketAdd.is-in:hover::before { content: "×"; font-size: 1.3rem; }

@keyframes basketPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}
.basketAdd.justAdded { animation: basketPop .35s ease-out; }

/* --- Floating basket button ------------------------------- */

.basketFab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 75;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand, #0b3d91), #1d4ed8);
  color: #fff;
  border: 0;
  box-shadow: 0 12px 30px rgba(11, 61, 145, .40), 0 4px 10px rgba(0,0,0,.18);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s, box-shadow .15s, filter .15s;
}
.basketFab:hover { transform: translateY(-2px); filter: brightness(1.08); }
.basketFab:active { transform: translateY(1px); }
.basketFab svg { width: 26px; height: 26px; }
.basketFab .count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--accent, #f5a623);
  color: #1f2937;
  font-weight: 800;
  font-size: .75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.basketFab.empty .count { display: none; }
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}
.basketFab .count.pulse { animation: badgePulse .4s ease-out; }

@media (max-width: 768px) {
  .basketFab { right: 14px; bottom: 14px; width: 54px; height: 54px; }
  .basketFab svg { width: 22px; height: 22px; }
}

/* --- Basket drawer --------------------------------------- */

.basketDrawerBg {
  position: fixed;
  inset: 0;
  background: rgba(7,23,46,.50);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  animation: fadeBg .2s ease-out;
}
@keyframes fadeBg { from { opacity: 0; } to { opacity: 1; } }
.basketDrawerBg.open { display: block; }

.basketDrawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 92vw);
  background: #fff;
  z-index: 201;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 30px rgba(11,30,58,.18);
  transform: translateX(100%);
  transition: transform .28s cubic-bezier(.2,.7,.2,1);
}
.basketDrawerBg.open .basketDrawer { transform: translateX(0); }

.basketDrawer header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line, #e5e7eb);
  flex-shrink: 0;
}
.basketDrawer h2 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--brand, #0b3d91);
}
.basketDrawer h2 .num { color: #6b7280; font-weight: 600; font-size: .92rem; margin-left: 4px; }
.basketDrawer .close {
  background: none;
  border: 0;
  font-size: 1.6rem;
  cursor: pointer;
  color: #6b7280;
  width: 40px;
  height: 40px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.basketDrawer .close:hover { background: #eef3fb; color: var(--brand, #0b3d91); }

.basketItems {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
}
.basketItems .empty {
  text-align: center;
  padding: 50px 20px;
  color: #6b7280;
}
.basketItems .empty .ico { font-size: 3rem; opacity: .5; margin-bottom: 10px; }
.basketItems .empty h3 { color: #374151; margin: 0 0 6px; font-size: 1.05rem; }
.basketItems .empty p { margin: 0 0 18px; font-size: .9rem; line-height: 1.5; }
.basketItems .empty a {
  display: inline-block;
  background: var(--brand, #0b3d91);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: .9rem;
}

.basketRow {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 10px;
  border-radius: 10px;
  margin: 4px 0;
  transition: background .12s;
}
.basketRow:hover { background: #f9fafb; }
.basketRow .thumb {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0b3d91, #14b8a6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  flex-shrink: 0;
}
.basketRow .info { min-width: 0; }
.basketRow .info h4 { margin: 0 0 2px; font-size: .92rem; color: #1f2937; line-height: 1.25; }
.basketRow .info .meta { font-size: .76rem; color: #6b7280; }
.basketRow .info .meta .pricePill {
  display: inline-block;
  background: #eef3fb;
  color: var(--brand, #0b3d91);
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 700;
  font-size: .72rem;
  margin-right: 4px;
}
.basketRow .info .meta .freePill { background: #e9f6ee; color: #0a5e2b; }
.basketRow .info .meta .trialPill { background: #fff7d6; color: #5a3300; }
.basketRow .del {
  background: none;
  border: 0;
  color: #6b7280;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.basketRow .del:hover { background: #fdecec; color: #b91c1c; }

.basketDrawer footer {
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line, #e5e7eb);
  background: #fff;
  flex-shrink: 0;
}
.basketDrawer .totalRow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: .9rem;
  color: #6b7280;
}
.basketDrawer .grandTotal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  font-size: 1.1rem;
  color: #0b3d91;
  font-weight: 800;
}
.basketDrawer .grandTotal .val { color: var(--accent, #f5a623); font-size: 1.6rem; }
.basketDrawer .checkout {
  display: block;
  width: 100%;
  background: linear-gradient(135deg, #f5a623, #e89512);
  color: #1f2937;
  text-decoration: none;
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 1rem;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  box-shadow: 0 6px 18px rgba(245,166,35,.3);
  transition: transform .12s, filter .15s;
}
.basketDrawer .checkout:hover { transform: translateY(-1px); filter: brightness(1.05); }
.basketDrawer .checkout:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.basketDrawer .clearAll {
  display: inline-block;
  margin-top: 10px;
  background: none;
  border: 0;
  color: #6b7280;
  font-size: .82rem;
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
}
.basketDrawer .note {
  font-size: .76rem;
  color: #6b7280;
  text-align: center;
  margin: 10px 0 0;
  line-height: 1.4;
}
.basketDrawer .note a { color: var(--brand, #0b3d91); font-weight: 700; }

/* --- View mode: LIST ------------------------------------- */

body.view-list .grid {
  grid-template-columns: 1fr !important;
  gap: 12px !important;
}
body.view-list .card {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 0;
  align-items: stretch;
  border-radius: 14px;
  overflow: hidden;
}
body.view-list .card .cover {
  height: auto !important;
  min-height: 140px;
  width: 140px;
}
body.view-list .card .cover svg { width: 100%; height: 100%; object-fit: cover; }
body.view-list .card .cover .ribbon {
  top: 8px; left: 8px;
  padding: 3px 8px;
  font-size: .65rem;
}
body.view-list .card .body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}
body.view-list .card .body h3 { margin: 4px 0 2px; font-size: 1.02rem; }
body.view-list .card .body .desc { margin: 0 0 6px; font-size: .88rem; }
body.view-list .card .body .actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
body.view-list .card .body .actions button {
  padding: 9px 16px;
  font-size: .85rem;
}

@media (max-width: 640px) {
  body.view-list .card { grid-template-columns: 88px 1fr; }
  body.view-list .card .cover { width: 88px; min-height: 100px; }
  body.view-list .card .body { padding: 12px; }
  body.view-list .card .body .actions { flex-wrap: wrap; }
}

/* --- View mode: COMPACT ---------------------------------- */

body.view-compact .grid {
  grid-template-columns: 1fr !important;
  gap: 4px !important;
}
body.view-compact .card {
  display: grid;
  grid-template-columns: 36px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line, #e5e7eb);
  overflow: hidden;
}
body.view-compact .card:hover { background: #f9fafb; }
body.view-compact .card .cover {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  position: relative;
  flex-shrink: 0;
}
body.view-compact .card .cover svg { width: 100%; height: 100%; border-radius: 6px; }
body.view-compact .card .cover .ribbon {
  position: static;
  display: none;
}
body.view-compact .card .body {
  padding: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
}
body.view-compact .card .body .tagrow,
body.view-compact .card .body .desc,
body.view-compact .card .body .meta { display: none; }
body.view-compact .card .body h3 {
  margin: 0;
  font-size: .92rem;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.view-compact .card .body .actions {
  display: flex;
  gap: 6px;
  margin: 0;
}
body.view-compact .card .body .actions button {
  padding: 6px 12px;
  font-size: .8rem;
  min-height: 36px;
}
body.view-compact .basketAdd {
  width: 36px;
  height: 36px;
  font-size: .9rem;
}

@media (max-width: 640px) {
  body.view-compact .card { grid-template-columns: 32px 1fr auto; padding: 8px 10px; gap: 10px; }
  body.view-compact .card .cover { width: 32px; height: 32px; }
  body.view-compact .card .body .actions button:not(.primary) { display: none; }
}

/* --- Empty/no-match in alternate views ------------------- */

body.view-list .grid > div:not(.card),
body.view-compact .grid > div:not(.card) {
  grid-column: 1 / -1;
}

/* =============================================================
   Grid card title alignment so cards line up neatly
   ============================================================= */
body.view-grid .card h3 {
  min-height: 2.6em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 4px 0 6px;
  line-height: 1.3;
}
body.view-grid .card .desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 4em;
}
body.view-grid .card .meta {
  margin-top: auto; /* push meta + actions to the card bottom */
}
body.view-grid .card .actions {
  margin-top: 8px;
}
/* Ensure cards in a row stretch to same height */
body.view-grid .grid { align-items: stretch; }
body.view-grid .card { display: flex; flex-direction: column; }
body.view-grid .card .body { flex: 1; display: flex; flex-direction: column; }
