/* ==========================================================
   Limka Knitters - School page styles
   (loads after style.css, which provides the header, footer,
    buttons and colour variables)
   ========================================================== */

/* ---------- School banner ---------- */
.school-banner {
  background:
    radial-gradient(circle at 90% 0%, rgba(242, 169, 0, 0.18), transparent 45%),
    linear-gradient(135deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff;
  padding: 22px 0 30px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 18px;
}
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span:last-child { color: #fff; font-weight: 500; }

.school-banner-main {
  display: flex;
  align-items: center;
  gap: 18px;
}
.school-banner-badge {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.18);
  border: 3px solid rgba(255, 255, 255, 0.55);
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
}
.school-banner-badge.has-logo { background: #fff; padding: 4px; overflow: hidden; }
.school-banner-badge.has-logo img { width: 100%; height: 100%; object-fit: contain; display: block; border-radius: 50%; }
.school-banner h1 {
  font-size: clamp(1.4rem, 3.5vw, 2.1rem);
  line-height: 1.2;
}
.school-banner p {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
}

/* ---------- Layout ---------- */
.shop {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 28px;
  align-items: start;
  padding-top: 28px;
  padding-bottom: 60px;
}
.shop[data-empty="true"] { grid-template-columns: 1fr; }

/* ---------- Filters ---------- */
.filters {
  position: sticky;
  top: 90px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.filter-group { margin-bottom: 22px; }
.filter-group h2 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 10px;
}
.filters select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.9rem;
  background: #fff;
  color: var(--text);
  outline: none;
}
.filters select:focus { border-color: var(--brand); }
.filter-hint { margin-top: 8px; font-size: 0.78rem; color: var(--muted); line-height: 1.45; }

.filter-list { display: grid; gap: 4px; }
.line-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.line-btn small { color: var(--muted); font-size: 0.78rem; }
.line-btn:hover { background: var(--bg-alt); }
.line-btn.active { background: var(--brand-light); color: var(--brand); font-weight: 600; }

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  cursor: pointer;
}
.check-row input { width: 18px; height: 18px; accent-color: var(--brand); }

.btn-reset {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--brand);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.btn-reset:hover { border-color: var(--brand); background: var(--brand-light); }

/* ---------- Results bar ---------- */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}
.results-bar p { font-weight: 600; color: var(--text); }
.results-tools { display: flex; align-items: center; gap: 12px; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 0.86rem; color: var(--muted); }
.sort select {
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 999px;
  font: inherit;
  font-size: 0.86rem;
  background: #fff;
  color: var(--text);
  outline: none;
}
.sort select:focus { border-color: var(--brand); }
.filter-toggle {
  display: none;
  padding: 8px 18px;
  border: 2px solid var(--brand);
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  font: inherit;
  font-weight: 600;
  font-size: 0.86rem;
  cursor: pointer;
}

/* ---------- Product grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 18px;
}

.product-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.product-card:not(.skeleton):hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-color: var(--brand);
}
.product-card.sold-out .product-img { filter: grayscale(0.8); opacity: 0.7; }

.product-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-alt);
  overflow: hidden;
}
.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #fff;
}
.img-fallback svg { width: 46%; height: 46%; opacity: 0.9; }

.tag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #1b1b1b;
  font-size: 0.7rem;
  font-weight: 600;
}
.tag.out { background: #444; color: #fff; }

.product-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 14px 16px;
}
.product-line {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--brand);
  margin-bottom: 4px;
}
.product-name {
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}
.product-desc {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  margin-top: 10px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}
.product-note {
  min-height: 1.3em;
  margin-top: 2px;
  font-size: 0.76rem;
  color: var(--muted);
}
.product-note.low { color: #b5472f; font-weight: 500; }
.product-note.bulk { color: var(--brand); }

.size-label {
  margin: 10px 0 6px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted);
}
.sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.size-chip {
  min-width: 38px;
  padding: 5px 9px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.size-chip:hover:not(:disabled) { border-color: var(--brand); }
.size-chip.selected { border-color: var(--brand); background: var(--brand); color: #fff; }
.size-chip:disabled {
  color: #aab2ad;
  background: var(--bg-alt);
  text-decoration: line-through;
  cursor: not-allowed;
}

.add-btn {
  margin-top: auto;
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #1b1b1b;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}
.product-body .sizes + .add-btn,
.product-body .product-note + .size-label + .sizes + .add-btn { margin-top: 14px; }
.add-btn:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
.add-btn:disabled { background: #e3e8e5; color: #8b958f; cursor: not-allowed; }
.add-btn.added { background: var(--brand); color: #fff; }

/* How the item is supplied (made to order / from Nairobi) */
.source {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}
.source-tailored { background: #efe5fb; color: #6a3d9a; }
.source-nairobi { background: #e3eefc; color: #1a5fb4; }

/* ---------- Loading skeleton ---------- */
.product-card.skeleton {
  min-height: 380px;
  background: linear-gradient(100deg, #eef2f0 30%, #f8faf9 50%, #eef2f0 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  border-color: transparent;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Empty / error box ---------- */
.state-box {
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 50px 24px;
}
.state-box h2 { font-size: 1.2rem; color: var(--brand); margin-bottom: 8px; }
.state-box p { color: var(--muted); max-width: 460px; margin: 0 auto 20px; }

/* ---------- Toast ---------- */
.toast-box {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: grid;
  gap: 10px;
  z-index: 300;
  max-width: calc(100vw - 40px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--brand-dark);
  color: #fff;
  font-size: 0.88rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  animation: toast-in 0.25s ease;
}
.toast a { color: var(--accent); font-weight: 600; white-space: nowrap; }
.toast.error { background: #c0392b; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

[hidden] { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shop { grid-template-columns: 1fr; gap: 18px; }
  .filters { position: static; }
  .filter-toggle { display: inline-block; }
  .filters:not(.open) { display: none; }
}

@media (max-width: 600px) {
  .school-banner { padding: 16px 0 22px; }
  .school-banner-badge { width: 54px; height: 54px; font-size: 1.15rem; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-body { padding: 10px 10px 12px; }
  .product-name { font-size: 0.88rem; }
  .product-price { font-size: 1rem; }
  .size-chip { min-width: 34px; padding: 4px 7px; font-size: 0.76rem; }
  .sort span { display: none; }
  .results-bar { flex-direction: column; align-items: flex-start; }
  .results-tools { width: 100%; justify-content: space-between; }
}

/* ---------- School switcher ---------- */
.tabs-wrap { background: #fff; border-bottom: 1px solid var(--border); }
.school-tabs { display: flex; gap: 8px; overflow-x: auto; padding-top: 12px; padding-bottom: 12px; scrollbar-width: thin; }
.school-tab {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  padding: 8px 16px; border-radius: 999px; border: 2px solid var(--border);
  font-size: 0.86rem; font-weight: 500; color: var(--text); white-space: nowrap; transition: border-color 0.2s, background 0.2s;
}
.school-tab:hover { border-color: var(--brand); }
.school-tab.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px #fff; }

/* ---------- All-schools view ---------- */
.group-head {
  grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px;
  margin-top: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--border);
  font-size: 1.15rem; color: var(--brand);
}
.group-head:first-child { margin-top: 0; }
.group-head a:hover { text-decoration: underline; }
.group-head small { font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.group-dot { width: 12px; height: 12px; border-radius: 50%; align-self: center; }
.product-school { font-size: 0.74rem; font-weight: 700; margin-bottom: 2px; }
.product-school:hover { text-decoration: underline; }
