/* ==========================================================================
   JoJoRo Studio - styles
   Colours live in the :root block below. To restyle the whole site, change them there.
   ========================================================================== */

:root {
  --brand: #3563b8;          /* buttons, links, prices, active filters (a deeper tone of the logo blue so text stays readable) */
  --brand-dark: #284c93;     /* button hover */
  --accent: #779fe5;         /* the exact blue from the logo: highlights and focus rings */
  --concrete: #767474;       /* header and footer grey (matches the logo background) */
  --bg: #f4f3f2;             /* page background */
  --card: #ffffff;           /* cards and panels */
  --text: #2f2d2d;
  --muted: #666363;
  --line: #dcd9d8;           /* borders */
  --soft: #ecebea;           /* hover and table-header tint */
  --danger: #b00020;
  --success: #1b6e2d;
  --radius: 10px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

h1, h2, h3 {
  line-height: 1.25;
}

a {
  color: var(--brand);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img {
  max-width: 100%;
}

pre {
  background: var(--soft);
  padding: 10px;
  border-radius: 6px;
  max-height: 300px;
  overflow: auto;
}

/* ---------- Header and footer (built by site.js) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--concrete) url("images/header-texture.jpg") repeat;
  border-bottom: 3px solid var(--accent);
  color: #fff;
}

.site-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--text);
}

.logo-img {
  height: 66px;
  width: auto;
  display: block;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.nav-link,
.cart-link {
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.nav-link:hover,
.cart-link:hover {
  color: #d6e4ff;
}

.cart-link {
  padding: 7px 16px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 10px; /* the same rounded-box shape as the logo */
}

.cart-link:hover {
  border-color: var(--accent);
}

.site-footer {
  margin-top: 48px;
  border-top: 3px solid var(--accent);
  background: var(--concrete) url("images/header-texture.jpg") repeat;
  color: #fff;
  font-size: 0.9rem;
}

.site-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.site-footer a,
.admin-link {
  color: #fff;
  opacity: 0.85;
}

/* ---------- Page shell ---------- */
.page,
.shop {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px;
}

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

/* ---------- Shop front page ---------- */
.shop-title {
  margin: 0 0 16px;
  font-size: 1.7rem;
}

.shop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.search-box {
  flex: 1 1 260px;
  min-width: 0;
  padding: 10px 14px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
}

.toolbar-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.toolbar-field select,
.shop-toolbar select {
  padding: 9px 10px;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
}

.filters-toggle {
  display: none; /* shown on small screens */
  padding: 9px 16px;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
}

.shop-layout {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.results {
  flex: 1 1 0;
  min-width: 0; /* lets the grid shrink and grow with the window */
}

.result-count {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Filters ---------- */
.filters {
  flex: 0 0 230px;
  position: sticky;
  top: 86px;
  max-height: calc(100vh - 106px);
  overflow-y: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.filters-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.filters h2 {
  margin: 0;
  font-size: 1.05rem;
}

.filter-group {
  margin-top: 18px;
}

.filter-group h3 {
  margin: 0 0 8px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-list {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-size: 0.93rem;
  text-align: left;
  cursor: pointer;
  color: var(--text);
}

.filter-option:hover {
  background: var(--soft);
}

.filter-option.active {
  background: var(--brand);
  color: #fff;
}

.filter-option .count {
  font-size: 0.8rem;
  opacity: 0.7;
}

.size-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.size-pill {
  min-width: 44px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text);
}

.size-pill:hover {
  border-color: var(--brand);
}

.size-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.link-button {
  border: none;
  background: none;
  padding: 0;
  color: var(--brand);
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- Product grid: fills the window, as many columns as fit ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
}

.product-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.product-card:hover,
.product-card:focus-visible {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.product-card-image {
  aspect-ratio: 1 / 1;
  background: #eee;
}

.product-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-name {
  padding: 12px 14px 0;
  font-weight: 600;
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.2em;
}

.price-tag {
  padding: 4px 14px 14px;
  color: var(--brand);
  font-weight: 700;
}

.empty-state {
  text-align: center;
  padding: 40px 10px;
  color: var(--muted);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin: 28px 0 6px;
}

.pagination button {
  min-width: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--brand);
}

.pagination button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: default;
}

.page-gap {
  color: var(--muted);
  padding: 0 4px;
}

/* ---------- Buttons ---------- */
.button-link,
.save-button {
  display: inline-block;
  padding: 10px 20px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button-link:hover,
.save-button:hover:not(:disabled) {
  background: var(--brand-dark);
}

.button-link.small {
  padding: 4px 10px;
  margin-right: 6px;
  font-size: 0.85rem;
}

.button-link.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.save-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.logout-btn,
.secondary-button {
  padding: 8px 16px;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  color: var(--text);
}

.logout-btn:hover,
.secondary-button:hover:not(:disabled) {
  background: var(--soft);
}

.secondary-button:disabled {
  opacity: 0.6;
  cursor: default;
}

.danger-button {
  margin-left: 12px;
  padding: 10px 20px;
  background: var(--card);
  color: var(--danger);
  border: 1px solid var(--danger);
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
}

/* ---------- Forms ---------- */
.form-row {
  margin: 14px 0;
}

.form-row label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.form-row .inline-label {
  font-weight: normal;
}

.form-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-family: inherit;
  color: var(--text);
}

.qty-input {
  width: 72px;
  padding: 8px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.editor-note {
  color: var(--muted);
  font-size: 0.93rem;
}

.editor-message {
  min-height: 1.4em;
  margin: 8px 0;
  font-weight: 600;
}

.editor-message.ok {
  color: var(--success);
}

.editor-message.error {
  color: var(--danger);
}

.editor-actions {
  margin-top: 24px;
}

/* ---------- Product page ---------- */
.product-container {
  max-width: 1100px;
}

.product-header {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}

.product-media {
  flex: 0 0 min(460px, 46%);
}

.product-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  background: #eee;
  border: 1px solid var(--line);
}

.product-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.product-thumb {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
}

.product-thumb.active {
  border-color: var(--brand);
}

.product-info {
  flex: 1;
  min-width: 0;
}

.product-title {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.product-price {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand);
}

.vat-note {
  margin: 2px 0 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.variant-selectors {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.variant-selectors label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 0.9rem;
}

.variant-selectors select {
  min-width: 150px;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}

.buy-box {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.buy-box label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.cart-feedback {
  flex-basis: 100%;
  color: var(--success);
  font-weight: 600;
}

.product-description {
  margin-top: 24px;
  white-space: pre-line;
}

.section-title {
  margin-top: 40px;
  font-size: 1.15rem;
}

.variant-list {
  columns: 2 260px;
  padding-left: 18px;
  color: var(--muted);
}

/* ---------- Cart and checkout ---------- */
.table-scroll {
  overflow-x: auto;
}

.cart-table td {
  vertical-align: middle;
}

.cart-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 6px;
}

.cart-name {
  font-weight: 600;
}

.cart-variant {
  color: var(--muted);
  font-size: 0.9rem;
}

.cart-problem {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
}

.cart-subtotal {
  font-size: 1.2rem;
  text-align: right;
}

.checkout-grid {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.checkout-form {
  flex: 1 1 380px;
}

.checkout-form h2 {
  margin: 26px 0 6px;
  font-size: 1.15rem;
}

.delivery-options {
  margin: 12px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.delivery-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.delivery-option.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 1px var(--brand);
}

.delivery-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.delivery-name {
  font-weight: 600;
}

.delivery-days {
  color: var(--muted);
  font-size: 0.88rem;
}

.delivery-price {
  font-weight: 700;
  white-space: nowrap;
}

.pay-button {
  width: 100%;
  margin-top: 8px;
}

.order-summary {
  flex: 0 1 320px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.order-summary h2 {
  margin-top: 0;
  font-size: 1.15rem;
}

.order-summary ul {
  padding-left: 18px;
}

.summary-total {
  font-size: 1.15rem;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

/* ---------- Tables (cart, admin) ---------- */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  background: var(--card);
}

.admin-table th,
.admin-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

.admin-table th {
  background: var(--soft);
  font-size: 0.9rem;
}

.admin-table td button {
  margin-right: 6px;
  cursor: pointer;
}

.admin-table input[type="text"],
.admin-table input[type="number"] {
  width: 100%;
  padding: 6px;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.row-alert {
  background: #fff1f1;
}

/* ---------- Admin ---------- */
.admin-container {
  max-width: 1200px;
  margin: 20px auto;
  background: var(--card);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.admin-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-details {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.image-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.image-tile {
  width: 130px;
  text-align: center;
  font-size: 0.85rem;
}

.image-tile img {
  width: 130px;
  height: 130px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.image-tile-actions button {
  margin: 4px 2px 0;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ---------- Admin login ---------- */
.login-box {
  max-width: 380px;
  margin: 80px auto;
  background: var(--card);
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-box h1 {
  margin-top: 0;
  font-size: 1.4rem;
}

.login-box label {
  display: block;
  margin-top: 14px;
  font-weight: 600;
}

.login-box input[type="text"],
.login-box input[type="password"] {
  width: 100%;
  padding: 10px;
  margin-top: 6px;
  font-size: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-box .remember {
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 8px;
}

.login-box button[type="submit"] {
  width: 100%;
  margin-top: 20px;
  padding: 10px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

.login-box button[type="submit"]:disabled {
  opacity: 0.6;
  cursor: default;
}

.login-error {
  margin-top: 14px;
  color: var(--danger);
  min-height: 1.2em;
}

/* ---------- Smaller screens ---------- */
@media (max-width: 860px) {
  .shop-layout {
    flex-direction: column;
    gap: 14px;
  }

  .filters-toggle {
    display: inline-block;
  }

  /* the filter panel opens above the products when you tap "Filters" */
  .filters {
    display: none;
    position: static;
    flex-basis: auto;
    width: 100%;
    max-height: none;
  }

  .filters.open {
    display: block;
  }

  .filter-list {
    max-height: 220px;
  }

  .product-header {
    flex-direction: column;
    gap: 20px;
  }

  .product-media {
    flex-basis: auto;
    width: 100%;
  }

  .form-pair {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (max-width: 520px) {
  .logo-img {
    height: 48px;
  }

  .site-nav {
    gap: 12px;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .toolbar-field span {
    display: none;
  }

  .page,
  .shop {
    padding: 16px 12px;
  }
}

/* ---------------- announcement bar, landing page, About and policy pages ---------------- */
.announce-bar { background: var(--brand); color: #fff; text-align: center; padding: 8px 16px; font-size: 0.95rem; }
.announce-bar a { color: #fff; text-decoration: underline; }

.hero { background: var(--concrete) center / cover no-repeat; color: #fff; text-align: center; padding: 64px 16px; }
.hero-inner { max-width: 760px; margin: 0 auto; }
.hero h1 { margin: 0 0 12px; font-size: clamp(1.8rem, 5vw, 2.8rem); line-height: 1.15; }
.hero p { margin: 0 0 24px; font-size: 1.1rem; }
.hero-button { display: inline-block; background: #fff; color: var(--brand-dark); font-weight: 700; padding: 12px 28px; border-radius: var(--radius); text-decoration: none; }
.hero-button:hover { background: var(--soft); }

.home-section { margin: 32px 0; }
.home-more { text-align: center; margin-top: 20px; }
.offer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.offer-card { display: block; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: var(--radius); padding: 16px; color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
a.offer-card:hover { border-left-color: var(--brand); }
.offer-card h3 { margin: 0 0 6px; color: var(--brand-dark); }
.offer-card p { margin: 0; color: var(--muted); }
.offer-img { width: 100%; height: 140px; object-fit: cover; border-radius: 6px; margin-bottom: 10px; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { display: block; text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 12px; font-weight: 700; color: var(--brand-dark); text-decoration: none; box-shadow: var(--shadow); }
.tile:hover { background: var(--soft); }
.trust { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.trust-item { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; color: var(--muted); font-weight: 600; }

.legal { max-width: 780px; }
.legal h1 { margin-bottom: 4px; }
.legal h2 { margin-top: 28px; font-size: 1.15rem; }
.legal p, .legal li { line-height: 1.6; }
.legal-updated { color: var(--muted); font-size: 0.9rem; margin-top: 0; }
.legal-links a { margin-right: 6px; }
.todo { background: #fff3cd; color: var(--danger); border: 1px dashed var(--danger); border-radius: 4px; padding: 0 4px; font-weight: 700; }

.footer-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.footer-contact a { margin-left: 4px; }
.site-footer-inner { flex-wrap: wrap; gap: 8px 18px; }

.offer-fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 10px 0; padding: 8px 14px; }
.checklist { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; background: var(--card); }
.check-row { display: block; padding: 3px 0; font-weight: normal; }

/* delivery-country picker in the header (shown when the shop delivers to 2+ countries) */
.country-picker-wrap { font-size: 0.85rem; margin-right: 0.9rem; white-space: nowrap; }
.country-picker { font: inherit; padding: 0.15rem 0.3rem; max-width: 11rem; }
@media (max-width: 600px) { .country-picker-wrap span { display: none; } }
