/* ============================================================
   Surf.Deals — Stylesheet
   Light ocean theme · Mobile-first · Zero dependencies
   ============================================================ */

/* ─── Custom Properties ─────────────────────────────────────── */
:root {
  --bg-page:    #f0f9ff;
  --bg-card:    #ffffff;
  --bg-input:   #f8fafc;
  --bg-pill:    #f1f5f9;
  --bg-active:  #e0f2fe;
  --border:     #e2e8f0;
  --border-2:   #bae6fd;
  --text:       #0f172a;
  --text-dim:   #475569;
  --text-muted: #94a3b8;
  --blue:       #0284c7;
  --blue-dim:   rgba(2, 132, 199, 0.1);
  --blue-glow:  rgba(2, 132, 199, 0.2);
  --sky:        #0ea5e9;
  --sky-hover:  #0284c7;
  --green:      #059669;
  --orange:     #ea580c;
  --font:       -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --r-sm:       8px;
  --r-md:       12px;
  --r-lg:       16px;
  --shadow:     0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg:  0 4px 24px rgba(0, 0, 0, 0.12);
  --nav-h:      60px;
  --filter-h:   88px;
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--blue); text-decoration: none; }
button { font-family: var(--font); }

/* ─── Layout ─────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ─── Nav ────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}
.logo__dot { color: var(--blue); }

.forecast-pill {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  background: var(--blue-dim);
  border: 1px solid var(--blue-glow);
  padding: 5px 13px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  background-image: url('https://images.unsplash.com/photo-1730286855206-3ff94c2fd211?fm=jpg&q=80&w=2400&auto=format&fit=crop');
  background-size: cover;
  background-position: center 40%;
  padding: 80px 0 70px;
  border-bottom: 1px solid var(--border);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 20, 50, 0.40) 0%,
    rgba(0, 20, 50, 0.28) 50%,
    rgba(0, 20, 50, 0.55) 100%
  );
  pointer-events: none;
}

.hero__inner { position: relative; z-index: 1; }
.hero__inner { text-align: center; }

.hero__title {
  font-size: clamp(1.6rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 14px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.hero__title-br { display: none; }

.hero__sub {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.85);
  margin-bottom: 36px;
}

/* Search */
.search-wrap {
  max-width: 580px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.97);
  border: 1.5px solid rgba(255,255,255,0.6);
  border-radius: var(--r-lg);
  padding: 0 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}

.search-box:focus-within {
  border-color: var(--sky);
  box-shadow: 0 4px 20px rgba(0,0,0,0.18), 0 0 0 3px var(--blue-dim);
}

.search-box__icon {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-right: 11px;
}

.search-box__input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
  padding: 16px 0;
  font-family: var(--font);
}

.search-box__input::placeholder { color: var(--text-muted); }

.search-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, color 0.15s;
}
.search-clear--visible { opacity: 1; pointer-events: all; }
.search-clear:hover { color: var(--text); }

/* ─── Filters ────────────────────────────────────────────────── */
.filters {
  position: sticky;
  top: var(--nav-h);
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.filters__row {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filters__row:last-child { margin-bottom: 0; }

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-group--grow {
  flex: 1;
  min-width: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.filters__row--selects {
  gap: 10px;
  flex-wrap: nowrap;
}

.filter-select--full {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.filter-group--stock {
  flex-shrink: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-left: auto;
}

.stock-toggle {
  background: var(--bg-pill);
  border: 1.5px solid var(--border);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font);
  padding: 6px 13px;
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.stock-toggle:hover { color: var(--text); border-color: var(--border-2); }
.stock-toggle[aria-pressed="true"] {
  background: rgba(5, 150, 105, 0.1);
  border-color: var(--green);
  color: var(--green);
}

.filter-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Tab group */
.tab-group {
  display: flex;
  gap: 3px;
  background: var(--bg-pill);
  padding: 3px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

.tab {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 5px 13px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.tab:hover { color: var(--text); background: rgba(0,0,0,0.04); }
.tab--active {
  background: var(--bg-card);
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  font-weight: 600;
}

/* Select */
.filter-select {
  background: var(--bg-pill);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.82rem;
  font-family: var(--font);
  padding: 6px 28px 6px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color 0.15s;
}
.filter-select:focus { border-color: var(--blue); }

/* Brand pills */
.brand-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-pill);
  border: 1.5px solid var(--border);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.pill:hover { color: var(--text); border-color: var(--border-2); background: var(--bg-active); }

.pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cat-pill.pill--active {
  background: var(--blue-dim);
  border-color: var(--blue);
  color: var(--blue);
}

.pill--dim {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

/* ─── Dimension range selects ────────────────────────────────── */
.filters__row--dims {
  gap: 20px;
  flex-wrap: wrap;
}

.range-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-sep {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ─── Results section ────────────────────────────────────────── */
.results {
  padding: 32px 0 80px;
}

.results__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.results__header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-pill);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.view-btn:hover { color: var(--text); }

.view-btn--active {
  background: var(--bg-card);
  color: var(--blue);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.results__count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* ─── Product Card ───────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  min-width: 0;
  box-shadow: var(--shadow);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-2);
}

.card__img-wrap {
  width: calc(100% + 36px);
  margin: -18px -18px 0 -18px;
  height: 180px;
  overflow: hidden;
  border-radius: var(--r-md) var(--r-md) 0 0;
  background: var(--bg-page);
  flex-shrink: 0;
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  transition: transform 0.3s ease;
}

.card:hover .card__img {
  transform: scale(1.04);
}

.card__img-wrap--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-page);
}

.card__img-placeholder {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.18);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card__brand-badge {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 10px;
  border-radius: 5px;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}

.card__tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tag {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--bg-page);
  color: var(--text-dim);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.tag--used {
  background: rgba(234, 88, 12, 0.08);
  color: var(--orange);
  border-color: rgba(234, 88, 12, 0.25);
}

.card__title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  color: var(--text);
}

.card__desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.card__listings {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.listings__show-more {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}
.listings__show-more:hover { color: var(--text-dim); }

/* ─── Listing rows ───────────────────────────────────────────── */
.listing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--r-sm);
}

.listing--best {
  background: #f0f9ff;
  border: 1.5px solid rgba(2, 132, 199, 0.22);
}

.listing--other {
  background: var(--bg-page);
  border: 1px solid var(--border);
}

.listing--oos {
  background: var(--bg-page);
  border: 1px solid var(--border);
  opacity: 0.55;
}

.listing__left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.listing__badge {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
}

.listing__retailer {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.listing__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.listing__price {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  white-space: nowrap;
}

.listing__price--secondary {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

.listing__price--oos {
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: line-through;
  font-weight: 500;
}

.listing__diff {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--orange);
  white-space: nowrap;
}

.listing__oos-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
  border: none;
  cursor: pointer;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn--primary {
  background: var(--sky);
  color: #fff;
}
.btn--primary:hover { background: var(--sky-hover); color: #fff; }

.btn--secondary {
  background: var(--bg-pill);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.btn--secondary:hover { color: var(--text); border-color: var(--border-2); }

/* ─── List view ──────────────────────────────────────────────── */
.results__grid--list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.results__grid--list .card {
  flex-direction: row;
  align-items: center;
  padding: 10px 14px;
  gap: 14px;
}

.results__grid--list .card__img-wrap {
  width: 64px;
  height: 64px;
  min-width: 64px;
  border-radius: var(--r-sm);
  margin: 0;
  flex-shrink: 0;
}

.results__grid--list .card__img-wrap--empty {
  border-radius: var(--r-sm);
}

.results__grid--list .card__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.results__grid--list .card__header {
  margin: 0;
  flex-wrap: wrap;
  gap: 6px;
}

.results__grid--list .card__title {
  font-size: 0.95rem;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.results__grid--list .card__listings {
  width: 420px;
  max-width: 420px;
  flex-shrink: 0;
  gap: 4px;
}

.results__grid--list .listing__retailer {
  overflow: visible;
  text-overflow: unset;
}

.results__grid--list .listing--best,
.results__grid--list .listing--other,
.results__grid--list .listing--oos {
  padding: 5px 8px;
}

/* ─── No results ─────────────────────────────────────────────── */
.no-results {
  text-align: center;
  padding: 80px 20px;
}

.no-results__msg {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.btn--reset {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  color: var(--text-dim);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 10px;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.15s, border-color 0.15s;
}
.btn--reset:hover { color: var(--text); border-color: var(--border-2); }

/* ─── Footer ─────────────────────────────────────────────────── */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 40px 0;
}

.footer__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}

.footer__logo { font-size: 1.2rem; }

.footer__disclaimer {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 400px;
  margin-top: 8px;
  line-height: 1.55;
}

.footer__links {
  display: flex;
  gap: 20px;
  padding-top: 3px;
  flex-wrap: wrap;
}

.footer__links a {
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: color 0.15s;
}
.footer__links a:hover { color: var(--text); }

/* ─── Brand toggle (mobile only) ────────────────────────────── */
.brand-toggle {
  display: none;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (min-width: 600px) {
  .hero__title-br { display: inline; }
}

@media (max-width: 700px) {
  .hero { padding: 48px 0 40px; }

  .results__grid {
    grid-template-columns: 1fr;
  }

  .results__grid--list .card {
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }

  .results__grid--list .card__img-wrap {
    width: 52px;
    height: 52px;
    min-width: 52px;
  }

  .results__grid--list .card__body {
    flex: 1;
    min-width: 0;
  }

  .results__grid--list .card__listings {
    width: 100%;
    min-width: 0;
  }

  .filters__row {
    gap: 12px;
  }

  .listing {
    flex-wrap: wrap;
  }
  .listing__right {
    margin-left: auto;
  }

  .brand-label-desktop { display: none; }

  .brand-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-pill);
    border: 1.5px solid var(--border);
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 5px 13px;
    border-radius: 20px;
    cursor: pointer;
    font-family: var(--font);
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .brand-toggle:hover { color: var(--text); border-color: var(--border-2); }

  .brand-toggle--active {
    background: var(--blue-dim);
    border-color: var(--blue);
    color: var(--blue);
  }

  .brand-toggle__label {
    font-weight: 700;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-toggle__arrow {
    font-size: 0.65rem;
    transition: transform 0.2s;
  }
  .brand-toggle[aria-expanded="true"] .brand-toggle__arrow {
    transform: rotate(180deg);
  }

  .filters__row--brands {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
  }

  #brand-filter {
    display: none;
    width: 100%;
  }

  #brand-filter.brand-row--open {
    display: flex;
  }
}

@media (max-width: 480px) {
  .hero__title { font-size: 1.5rem; }
  .hero__sub   { font-size: 0.95rem; }
  .forecast-pill { display: none; }
  .container { padding: 0 14px; }
  .card { padding: 14px; }

  .listing__price { font-size: 1.1rem; }
  .btn { padding: 6px 11px; font-size: 0.75rem; }
}
