:root {
  --bg: #0c1116;
  --bg-soft: #131b23;
  --card: #18222c;
  --card-hover: #1e2a36;
  --border: #26333f;
  --text: #e8eef3;
  --text-dim: #93a4b3;
  --teal: #00b3a4;
  --teal-bright: #1ee0cf;
  --accent: #ffcb05;
  --promo: #ff5c5c;
  --promo-soft: rgba(255, 92, 92, 0.14);
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --radius: 16px;
}

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

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #14323a 0%, transparent 55%), var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-bright); }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(12, 17, 22, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--teal), var(--teal-bright));
  color: #04201d;
  font-weight: 800;
  font-size: 26px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(30, 224, 207, 0.35);
}
.brand h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.brand h1 span { color: var(--teal-bright); }
.brand-sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

.btn-refresh {
  background: linear-gradient(135deg, var(--teal), var(--teal-bright));
  color: #04201d;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  transition: transform .12s ease, box-shadow .12s ease, opacity .2s;
  white-space: nowrap;
}
.btn-refresh:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(30,224,207,.35); }
.btn-refresh:disabled { opacity: .6; cursor: not-allowed; }
.refresh-icon { display: inline-block; font-size: 16px; }
.btn-refresh.spinning .refresh-icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 28px 24px 60px; }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 26px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-card.promo { border-color: rgba(255,92,92,.4); background: linear-gradient(160deg, var(--promo-soft), var(--card)); }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.stat-value.small { font-size: 15px; font-weight: 600; }
.stat-card.promo .stat-value { color: var(--promo); }
.stat-card.performance .stat-value { color: var(--teal-bright); }
.stat-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; }

/* ---------- Controls ---------- */
.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.search-wrap { position: relative; flex: 1; min-width: 240px; }
.search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-dim); font-size: 18px;
}
#searchInput {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px 12px 40px;
  border-radius: 11px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
#searchInput:focus { border-color: var(--teal); }

.select {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 11px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

.toggle { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; user-select: none; }
.toggle input { display: none; }
.toggle-track {
  width: 42px; height: 24px; border-radius: 20px;
  background: var(--border); position: relative; transition: background .2s;
}
.toggle-track::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; transition: transform .2s;
}
.toggle input:checked + .toggle-track { background: var(--promo); }
.toggle.performance input:checked + .toggle-track { background: var(--teal); }
.toggle input:checked + .toggle-track::after { transform: translateX(18px); }

.result-count { color: var(--text-dim); font-size: 13px; margin-left: auto; }

/* ---------- AdSense ---------- */
.ad-slot {
  margin-bottom: 22px;
  min-height: 90px;
  overflow: hidden;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px dashed var(--border);
}
.ad-slot.hidden { display: none; }

/* ---------- Banner ---------- */
.banner {
  background: rgba(30,224,207,.12);
  border: 1px solid rgba(30,224,207,.4);
  color: var(--teal-bright);
  padding: 12px 16px; border-radius: 12px;
  margin-bottom: 20px; font-size: 14px;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 28px 0 8px;
  flex-wrap: wrap;
}
.page-btn,
.page-num {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.page-btn:hover:not(:disabled),
.page-num:hover:not(.active) {
  border-color: var(--teal);
  background: var(--card);
}
.page-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.page-numbers {
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-num {
  min-width: 40px;
  padding: 10px 12px;
}
.page-num.active {
  background: linear-gradient(135deg, var(--teal), var(--teal-bright));
  color: #04201d;
  border-color: transparent;
}
.page-ellipsis {
  color: var(--text-dim);
  padding: 0 4px;
  user-select: none;
}

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
  position: relative;
}
.card:hover { transform: translateY(-4px); border-color: var(--teal); box-shadow: var(--shadow); }

.card-img {
  aspect-ratio: 1 / 1;
  background: #fff;
  display: grid; place-items: center;
  overflow: hidden;
}
.card-img img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }

.promo-badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--promo); color: #fff;
  font-weight: 800; font-size: 13px;
  padding: 5px 9px; border-radius: 8px;
  box-shadow: 0 3px 10px rgba(255,92,92,.45);
}
.unavail-badge {
  position: absolute; top: 10px; right: 10px;
  background: rgba(0,0,0,.7); color: #cdd; font-size: 11px;
  padding: 4px 8px; border-radius: 7px;
}

.card-body { padding: 13px 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-cat { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title { font-size: 14px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 38px; }
.card-rating { font-size: 12px; color: var(--accent); }
.card-rating .dim { color: var(--text-dim); }
.card-price-row { margin-top: auto; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price-old { font-size: 14px; color: var(--text-dim); text-decoration: line-through; }
.price-now { font-size: 19px; font-weight: 800; }
.price-now.promo { color: var(--promo); }
.price-old { font-size: 13px; color: var(--text-dim); text-decoration: line-through; }

.empty { text-align: center; color: var(--text-dim); padding: 60px 0; font-size: 15px; }

.skeleton { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); height: 320px;
  animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: .5; } 50% { opacity: .9; } }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(4,8,11,.75); backdrop-filter: blur(4px); }
.modal-card {
  position: relative; background: var(--card); border: 1px solid var(--border);
  border-radius: 20px; width: min(760px, 100%); max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute; top: 14px; right: 16px; z-index: 2;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--text);
  width: 34px; height: 34px; border-radius: 50%; font-size: 22px; cursor: pointer; line-height: 1;
}
.modal-close:hover { border-color: var(--teal); }
.modal-body { padding: 26px; }
.modal-head { display: flex; gap: 20px; margin-bottom: 22px; }
.modal-img { width: 140px; height: 140px; background: #fff; border-radius: 14px; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden; }
.modal-img img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.modal-title { font-size: 20px; font-weight: 800; line-height: 1.3; margin-bottom: 8px; }
.modal-cat { font-size: 12px; color: var(--text-dim); margin-bottom: 14px; }
.modal-price { display: flex; align-items: baseline; gap: 12px; margin-bottom: 6px; }
.modal-price .now { font-size: 30px; font-weight: 800; }
.modal-price .now.promo { color: var(--promo); }
.modal-price .old { font-size: 16px; color: var(--text-dim); text-decoration: line-through; }
.modal-price .pct { background: var(--promo); color: #fff; font-weight: 800; font-size: 13px; padding: 3px 8px; border-radius: 7px; }

.promo-note { color: var(--promo); font-size: 13px; font-weight: 600; margin-top: 4px; }

.chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.chip { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; }
.chip .k { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .4px; }
.chip .v { font-size: 15px; font-weight: 700; }
.chip .v.min { color: var(--teal-bright); }
.chip .v.max { color: var(--accent); }

.chart-wrap { margin-top: 12px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; padding: 16px; }
.chart-wrap h3 { font-size: 14px; margin-bottom: 4px; }
.chart-hint { font-size: 12px; color: var(--text-dim); margin-bottom: 12px; }

.modal-link {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 20px;
  background: linear-gradient(135deg, var(--teal), var(--teal-bright)); color: #04201d;
  text-decoration: none; font-weight: 700; padding: 11px 18px; border-radius: 10px; font-size: 14px;
}

.footer { border-top: 1px solid var(--border); padding: 24px; text-align: center; color: var(--text-dim); font-size: 13px; }

.footer-links { margin-top: 10px; }
.footer-links a { color: var(--text-dim); text-decoration: none; transition: color 0.15s ease; }
.footer-links a:hover { color: var(--teal-bright); }
.footer-sep { color: var(--border); margin: 0 8px; }

/* ---------- Privacy policy ---------- */
.modal-body.privacy { max-height: 78vh; overflow-y: auto; text-align: left; }
.modal-body.privacy h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.3px; margin-bottom: 4px; }
.modal-body.privacy .privacy-updated { font-size: 12px; color: var(--text-dim); margin-bottom: 22px; }
.modal-body.privacy h3 { font-size: 15px; font-weight: 700; color: var(--teal-bright); margin: 18px 0 6px; }
.modal-body.privacy p { font-size: 14px; line-height: 1.65; color: var(--text-dim); }
.modal-body.privacy a { color: var(--teal-bright); }
.modal-body.privacy strong { color: var(--text); }

.hidden { display: none !important; }

/* ---------- Cookie consent (vanilla-cookieconsent) — akcenty motywu ---------- */
#cc-main {
  --cc-btn-primary-bg: var(--teal);
  --cc-btn-primary-hover-bg: var(--teal-bright);
  --cc-btn-primary-color: #04201d;
  --cc-btn-primary-hover-color: #04201d;
}

@media (max-width: 880px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat-card.wide { grid-column: span 2; }
  .modal-head { flex-direction: column; }
}
