/* giftdrop product catalogue — mobile-first stylesheet
   v1.2 — TemuDash dark theme + desktop polish + V2 label-form readiness
*/

:root {
  --bg: #0f1a2e;
  --surface: #162035;
  --surface-raised: #1a2744;
  --border: #1e2d4a;
  --border-subtle: rgba(30, 45, 74, 0.5);
  --text: #f0f2f8;
  --text-secondary: #a0aec0;
  --muted: #64748b;
  --accent: #00b4a6;
  --accent-dim: #009b8e;
  --accent-soft: rgba(0, 180, 166, 0.12);
  --green: #34d399;
  --red: #f87171;
  --yellow: #fbbf24;
  --blue: #60a5fa;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --gap: 12px;
  --max: 1280px;
  --header-h: 76px;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.02) inset, 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-elevated: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(0, 180, 166, 0.15);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body { min-height: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(0, 180, 166, 0.08), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
h3 { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

input, select, textarea {
  font-family: var(--font);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder, textarea::placeholder {
  color: var(--muted);
  font-weight: 400;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

button, .btn {
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  transition: all 0.15s;
  display: inline-block;
  min-height: 44px;
}

button:active:not([disabled]), .btn:active:not([disabled]) { transform: scale(0.98); }

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

.btn--ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 500;
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn--label {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(0, 180, 166, 0.3);
  font-weight: 600;
}
.btn--label:hover:not([disabled]) { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--label[disabled] {
  background: var(--surface-raised);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: not-allowed;
}

/* ── Header ── */
.site-header {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 32, 53, 0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.brand:hover { opacity: 0.85; }

.brand__logo {
  height: 32px;
  width: auto;
  display: block;
}

/* ── Search ── */
.search-form { position: relative; width: 100%; }

.search-form input[type=search] {
  width: 100%;
  padding: 11px 14px;
  font-size: 16px;
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  list-style: none;
  padding: 4px;
  max-height: 60vh;
  overflow: auto;
  box-shadow: var(--shadow-elevated);
  z-index: 20;
}

.suggestions li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--text);
}

.suggestions li:hover,
.suggestions li.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.suggestions img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--surface);
}

/* ── Layout ── */
main {
  padding: 20px 16px 56px;
  max-width: var(--max);
  margin: 0 auto;
}

/* ── Back link ── */
.back-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 16px;
  transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }

/* ── Hero ── */
.hero {
  margin-bottom: 24px;
}
.hero h1 {
  font-size: 26px;
}

/* ── Product grid ── */
.grid--products {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(2, 1fr);
}

/* ── Product card ── */
.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
  pointer-events: none;
  z-index: 1;
}

.card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-card);
}
.card:active { transform: scale(0.98); }

.card img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  background: var(--surface-raised);
}

.card__name {
  display: block;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  text-align: center;
  position: relative;
  z-index: 2;
}

/* ── Product detail page ── */
.product {
  display: grid;
  gap: 20px;
}

.product__media {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}
.product__media::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
  pointer-events: none;
}

.product__img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: var(--surface);
}

.product__meta { display: grid; gap: 24px; align-content: start; }

.product__header h1 {
  margin: 0;
  font-size: 28px;
  text-align: center;
}

.product__filename {
  margin-top: 8px;
  text-align: center;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.product__actions {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  gap: 12px;
}

.product__actions .btn {
  width: 100%;
}

.product__hint {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.product__hint--muted {
  color: var(--muted);
  font-style: italic;
}

/* ── Results page ── */
.results h1 {
  font-size: 24px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.results h1::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
}

.results > p {
  color: var(--text-secondary);
  font-size: 15px;
  padding: 32px 0;
  text-align: center;
}

/* ── Admin page ── */
.admin h1 { font-size: 28px; margin-bottom: 24px; }

.admin .stats {
  list-style: none;
  padding: 20px;
  display: grid;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 20px;
  max-width: 480px;
}

.admin .stats li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  color: var(--text-secondary);
}

.admin .stats strong {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

#rescan-output {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 16px;
  max-width: 480px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Error page ── */
.error { text-align: center; padding: 64px 0; }
.error h1 { font-size: 32px; margin-bottom: 12px; }
.error p { color: var(--text-secondary); margin-bottom: 16px; }
.error a { color: var(--accent); font-weight: 600; }
.error a:hover { color: var(--accent-dim); }

/* ── Tablet (>= 600px) ── */
@media (min-width: 600px) {
  .site-header {
    flex-direction: row;
    align-items: center;
    gap: 24px;
    padding: 16px 24px;
  }

  .search-form { flex: 1; max-width: 520px; }

  .brand__logo { height: 36px; }

  main { padding: 28px 24px 64px; }

  .grid--products {
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
  }

  .hero h1 { font-size: 32px; }
}

/* ── Desktop (>= 900px) ── */
@media (min-width: 900px) {
  main { padding: 36px 32px 80px; }

  .hero {
    margin-bottom: 36px;
    padding: 8px 0 4px;
  }
  .hero h1 { font-size: 36px; }

  .grid--products {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }

  .card__name {
    padding: 14px 14px 16px;
    font-size: 15px;
  }

  .card:hover { transform: translateY(-2px); }

  /* Product detail — sticky image + meta panel */
  .product {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 40px;
    align-items: start;
  }

  .product__media {
    position: sticky;
    top: calc(var(--header-h) + 24px);
  }

  .product__img { aspect-ratio: 1 / 1; }

  .product__header h1 { font-size: 36px; text-align: left; }
  .product__filename { text-align: left; }

  .product__actions { padding: 24px; }
  .product__actions .btn { width: auto; align-self: start; }
}

/* ── Wide desktop (>= 1200px) ── */
@media (min-width: 1200px) {
  .grid--products { grid-template-columns: repeat(5, 1fr); }
}
