/* =============================================================================
   Parta cen — design system
   ============================================================================= */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap');

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ---------- Design tokens ---------- */
:root {
  /* Paleta — papírový bone + černá inspirace + jeden živý akcent */
  --bg: #f4efe7;
  --bg-elevated: #fbf8f2;
  --paper: #fdfaf4;
  --ink: #18171a;
  --ink-soft: #46434a;
  --ink-muted: #7e7a82;
  --rule: #d8d2c5;
  --rule-soft: #ebe4d4;

  /* Akcenty */
  --accent: #d23f24;        /* cihla (slevy, akce) */
  --accent-dark: #9b2e1a;
  --accent-soft: #f7e6e2;
  --gold: #b58737;
  --green: #2f6b3a;

  /* Type */
  --serif: 'Instrument Serif', 'Georgia', serif;
  --sans: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', 'SFMono-Regular', Consolas, monospace;

  /* Layout */
  --max-w: 760px;
  --rad: 6px;
  --rad-lg: 14px;
  --shadow-soft: 0 1px 0 var(--rule), 0 8px 24px -16px rgba(24,23,26,0.12);
}

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(8px);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--serif);
  font-size: 28px;
  letter-spacing: -0.01em;
  font-weight: 400;
  color: var(--ink);
}
.brand em {
  font-style: italic;
  color: var(--accent);
}
.brand__mark {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 6px;
  transform: translateY(-4px);
}
.site-nav {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 14px;
}
.site-nav a {
  color: var(--ink-soft);
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--ink); }
.site-nav__cta {
  background: var(--ink);
  color: var(--paper);
  padding: 8px 16px;
  border-radius: var(--rad);
  font-weight: 500;
}
.site-nav__cta:hover { background: var(--accent); color: var(--paper); }

/* ---------- Hero ---------- */
.hero {
  padding: 60px 0 40px;
  text-align: center;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(40px, 8vw, 64px);
  line-height: 1.02;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: var(--ink);
}
.hero h1 em {
  font-style: italic;
  color: var(--accent);
}
.hero__sub {
  font-size: 17px;
  color: var(--ink-soft);
  max-width: 480px;
  margin: 0 auto 32px;
  line-height: 1.5;
}

/* ---------- Search bar ---------- */
.search {
  position: relative;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 4px 4px 4px 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s;
}
.search:focus-within {
  border-color: var(--accent);
}
.search input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 14px 0;
  font-size: 16px;
  color: var(--ink);
  outline: none;
}
.search input::placeholder { color: var(--ink-muted); }
.search button {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s;
}
.search button:hover { background: var(--accent); }

/* ---------- Stats bar ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 32px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stats__item {
  padding: 16px 12px;
  text-align: center;
  border-right: 1px solid var(--rule);
}
.stats__item:last-child { border-right: none; }
.stats__num {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  display: block;
  line-height: 1;
}
.stats__lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-top: 6px;
  display: block;
}

@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats__item:nth-child(2) { border-right: none; }
  .stats__item:nth-child(1), .stats__item:nth-child(2) { border-bottom: 1px solid var(--rule); }
}

/* ---------- Section heading ---------- */
.section-title {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 48px 0 4px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.section-title em {
  font-style: italic;
  color: var(--accent);
}
.section-sub {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 0 0 20px;
}

/* ---------- Product grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0 -20px;
}
.product {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--rule-soft);
  align-items: center;
  transition: background 0.15s;
}
.product:hover { background: var(--bg-elevated); }
.product:first-child { border-top: 1px solid var(--rule); }
.product:last-child { border-bottom: 1px solid var(--rule); }

.product__img {
  width: 64px;
  height: 64px;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: var(--rad);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product__img img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.product__img--ph {
  font-family: var(--serif);
  font-size: 24px;
  font-style: italic;
  color: var(--ink-muted);
}

.product__body {
  min-width: 0;
}
.product__name {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 4px;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product__meta {
  font-size: 12px;
  color: var(--ink-muted);
  display: flex;
  gap: 8px;
  align-items: center;
}
.product__chain {
  display: inline-block;
  padding: 2px 8px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.product__chain--lidl { background: #0050aa; }
.product__chain--kaufland { background: #d50000; }
.product__chain--tesco { background: #ee1c2e; }
.product__chain--albert { background: #4dae4f; }
.product__chain--billa { background: #f3041d; }
.product__chain--penny { background: #b32116; }
.product__chain--globus { background: #ff8a00; color: var(--ink); }
.product__chain--rohlik { background: #74bd1c; color: var(--ink); }

.product__price {
  text-align: right;
  font-family: var(--mono);
  white-space: nowrap;
}
.product__price-main {
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1;
}
.product__price-unit {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 4px;
}

/* ---------- Validity badge ---------- */
.validity {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  font-family: var(--mono);
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 80px;
  padding: 32px 0;
  border-top: 1px solid var(--rule);
  background: var(--paper);
  font-size: 13px;
  color: var(--ink-muted);
  text-align: center;
}
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--ink-soft); border-bottom: 1px dotted var(--ink-muted); }

/* ---------- Forms ---------- */
.form {
  max-width: 400px;
  margin: 0 auto;
  background: var(--paper);
  padding: 32px;
  border-radius: var(--rad-lg);
  border: 1px solid var(--rule);
}
.form h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  margin: 0 0 4px;
}
.form__sub {
  color: var(--ink-muted);
  font-size: 14px;
  margin: 0 0 24px;
}
.form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form input[type="email"],
.form input[type="password"],
.form input[type="text"],
.form input[type="number"],
.form textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--rule);
  border-radius: var(--rad);
  background: var(--bg-elevated);
  font-size: 15px;
  margin-bottom: 16px;
  transition: border-color 0.15s;
}
.form input:focus, .form textarea:focus {
  outline: none;
  border-color: var(--ink);
}
.form button[type="submit"] {
  width: 100%;
  padding: 14px;
  background: var(--ink);
  color: var(--paper);
  border: none;
  border-radius: var(--rad);
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s;
}
.form button[type="submit"]:hover { background: var(--accent); }
.form__link {
  text-align: center;
  margin-top: 16px;
  font-size: 14px;
  color: var(--ink-muted);
}
.form__link a {
  color: var(--accent);
  border-bottom: 1px dotted var(--accent);
}

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 16px;
  border-radius: var(--rad);
  margin-bottom: 16px;
  font-size: 14px;
  border-left: 3px solid;
}
.alert--error {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}
.alert--success {
  background: #e8f3eb;
  border-color: var(--green);
  color: var(--green);
}
.alert--info {
  background: #eef2f8;
  border-color: #2563eb;
  color: #1e40af;
}

/* ---------- Shopping list ---------- */
.list-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--rad-lg);
  padding: 20px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: border-color 0.15s, transform 0.15s;
}
.list-card:hover { border-color: var(--ink); transform: translateY(-1px); }
.list-card__name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
  margin: 0;
}
.list-card__meta {
  font-size: 12px;
  color: var(--ink-muted);
  font-family: var(--mono);
  margin-top: 4px;
}

.list-items {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
.list-items li {
  padding: 14px 0;
  border-bottom: 1px solid var(--rule-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.list-items li:last-child { border-bottom: 1px solid var(--rule); }
.list-items__name { font-size: 15px; }
.list-items__qty {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
  background: var(--bg);
  padding: 2px 8px;
  border-radius: 3px;
}
.list-items__remove {
  background: transparent;
  border: none;
  color: var(--ink-muted);
  font-size: 16px;
  padding: 4px 8px;
  border-radius: var(--rad);
}
.list-items__remove:hover { color: var(--accent); background: var(--accent-soft); }

/* ---------- Optimization result ---------- */
.best-chain {
  background: linear-gradient(135deg, var(--ink) 0%, #2a282d 100%);
  color: var(--paper);
  padding: 24px;
  border-radius: var(--rad-lg);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.best-chain::before {
  content: '';
  position: absolute;
  top: -40px;
  right: -40px;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
  opacity: 0.35;
}
.best-chain__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--paper);
  opacity: 0.7;
}
.best-chain__name {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 400;
  margin: 8px 0 0;
}
.best-chain__total {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  margin-top: 12px;
}

/* ---------- Tags ---------- */
.tag {
  display: inline-block;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-soft);
  text-decoration: none;
  margin: 0 4px 4px 0;
  transition: all 0.15s;
}
.tag:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-muted);
}
.empty__icon {
  font-family: var(--serif);
  font-style: italic;
  font-size: 72px;
  color: var(--rule);
  line-height: 1;
  margin-bottom: 16px;
}
.empty__msg {
  font-size: 16px;
}

/* ---------- Mobile adjustments ---------- */
@media (max-width: 600px) {
  .container { padding: 0 16px; }
  .hero { padding: 40px 0 28px; }
  .product { grid-template-columns: 56px 1fr auto; padding: 14px 16px; gap: 12px; }
  .product__img { width: 56px; height: 56px; }
  .product__name { font-size: 14px; }
  .product__price-main { font-size: 18px; }
  .product-grid { margin: 0 -16px; }
  .form { padding: 24px; }
  .best-chain__name { font-size: 32px; }
}

/* ---------- Loading state ---------- */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--ink-muted);
  font-family: var(--mono);
  font-size: 14px;
}
.loading::after {
  content: '...';
  animation: dots 1.5s steps(4) infinite;
}
@keyframes dots {
  0%, 25% { content: '.'; }
  50% { content: '..'; }
  75%, 100% { content: '...'; }
}
