:root {
  --bg: #05010d;
  --panel: rgba(10, 5, 30, 0.88);
  --pink: #ff4fd8;
  --blue: #4fdfff;
  --text: #e5e7eb;
  --safe-top: env(safe-area-inset-top, 0px);
}

/* RESET */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: radial-gradient(circle at top, #1b0c3f, #05010d);
  color: var(--text);
  padding-top: 120px;
  padding-bottom: 80px;
}

/* =========================
   🔝 TOP BAR
   ========================= */
.topbar {
  position: fixed;
  padding-bottom: 20px;
  margin-top:-10px;
  top: 0;
  width: 100%;
  height: 110px;
  background: linear-gradient(
    180deg,
    rgba(10, 4, 48, 0.9),
    rgba(5, 1, 13, 0.95)
  );
  overflow: hidden;
  z-index: 100;
  box-shadow: 0 0 40px rgba(255, 79, 216, 0.4);
  
}


.logo-bg {
  position:absolute;
  margin-top: 40px;
  margin-bottom:20px;
  inset: -30px;
  background: url("assets/logo.png") center / contain no-repeat;
  opacity: 1;
  filter:
    drop-shadow(0 0 12px rgba(255, 79, 216, 0.8))
    drop-shadow(0 0 24px rgba(79, 223, 255, 0.6));
  animation: logoGlow 5s ease-in-out infinite;
}

@keyframes logoGlow {
  0%, 100% {
    filter:
      drop-shadow(0 0 10px rgba(255, 79, 216, 0.7))
      drop-shadow(0 0 22px rgba(79, 223, 255, 0.5));
  }
  50% {
    filter:
      drop-shadow(0 0 18px rgba(255, 79, 216, 1))
      drop-shadow(0 0 36px rgba(79, 223, 255, 0.9));
  }
}

/* =========================
   🧠 MAIN / VIEWS
   ========================= */
main {
  padding: 16px;
}

.view {
  display: none;
  background: var(--panel);
  padding: 18px;
  border-radius: 16px;
  box-shadow: 0 0 30px rgba(79, 223, 255, 0.25);
}

.view.active {
  display: block;
}

h2 {
  margin-top: 0;
  margin-bottom: 12px;
  color: var(--blue);
  text-shadow: 0 0 10px var(--blue);
}

pre {
  background: #020012;
  padding: 12px;
  border-radius: 10px;
  overflow-x: auto;
}

.muted {
  opacity: 0.7;
}

/* =========================
   🔎 FILTERS
   ========================= */
.filters {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 16px;
  box-shadow: inset 0 0 20px rgba(255, 79, 216, 0.15);
}

.filters-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filters select,
.filters input {
  background: #140022;
  color: white;
  border: 1px solid rgba(255, 79, 216, 0.4);
  padding: 8px 10px;
  border-radius: 10px;
}

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

.sources label {
  margin-right: 14px;
  cursor: pointer;
}

/* =========================
   🧾 OFFERS LIST
   ========================= */
.offers {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* =========================
   🧩 OFFER TILE
   ========================= */
.offer {
  display: flex;
  gap: 14px;
  background: linear-gradient(
    135deg,
    rgba(79, 223, 255, 0.18),
    rgba(255, 79, 216, 0.18)
  );
  padding: 14px;
  border-radius: 18px;
  cursor: pointer;
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.offer:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 32px rgba(255, 79, 216, 0.7);
}

.offer img {
  width: 100px;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
}

.offer-body {
  flex: 1;
  position: relative;
}

.offer-title {
  font-weight: 700;
  font-size: 1.05em;
  margin-bottom: 6px;
}

.offer-price {
  margin-bottom: 6px;
  opacity: 0.9;
}

.offer-date {
  position: absolute;
  bottom: 0;
  right: 0;
  font-size: 0.75em;
  opacity: 0.6;
}

/* =========================
   🏷 SOURCE BADGES
   ========================= */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75em;
  margin-bottom: 6px;
  font-weight: 600;
}

.badge.olx {
  background: #0bbcd6;
  color: black;
}

.badge.allegro {
  background: #ff5a00;
  color: white;
}

.badge.vinted {
  background: #00b3a4;
  color: black;
}

/* =========================
   🔻 BOTTOM NAV (SAFE AREA)
   ========================= */

/* 👉 regulacja wysokości / pozycji */
:root {
  --bottom-nav-height: 70px;
  --bottom-nav-shift: -14px; /* im bardziej na minus, tym wyżej */
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;

  /* ⬇️ uwzględnia home indicator */
  bottom: calc(env(safe-area-inset-bottom, 0px) + var(--bottom-nav-shift));

  height: var(--bottom-nav-height);

  background: linear-gradient(
    180deg,
    rgba(5, 1, 13, 0.95),
    rgba(10, 4, 48, 0.95)
  );

  display: flex;
  justify-content: space-around;
  align-items: center;

  z-index: 1000;
  box-shadow: 0 -6px 30px rgba(255, 79, 216, 0.4);
}

/* 👉 DOPEŁNIENIE TŁA DO SAMEJ KRAWĘDZI */
.bottom-nav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;

  bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
  height: env(safe-area-inset-bottom, 0px);

  background: inherit;
}

/* PRZYCISKI */
.bottom-nav button {
  background: none;
  border: none;
  color: var(--pink);
  font-weight: bold;
  text-shadow: 0 0 6px var(--pink);
  cursor: pointer;
  transition: all 0.2s ease;
}

.bottom-nav button:hover {
  color: #fff;
  text-shadow:
    0 0 8px var(--pink),
    0 0 16px var(--blue);
  transform: translateY(-2px);
}


/* =========================
   ✨ HIGHLIGHTS
   ========================= */

/* Gigantos: świecąca jasnoniebieska ramka */
.offer.offer-gigantos {
  border: 2px solid rgba(79, 223, 255, 0.95);
  box-shadow:
    0 0 18px rgba(79, 223, 255, 0.45),
    0 0 40px rgba(79, 223, 255, 0.20);
}

/* Wybrane numery: zielona ramka */
.offer.offer-highlight {
  border: 2px solid rgba(0, 255, 140, 0.95);
  box-shadow:
    0 0 18px rgba(0, 255, 140, 0.35),
    0 0 40px rgba(0, 255, 140, 0.15);
}

/* Tagi w kafelku */
.giga-tag,
.hl-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.70em;
  font-weight: 800;
  letter-spacing: 0.3px;
  vertical-align: middle;
}

.giga-tag {
  background: rgba(79, 223, 255, 0.18);
  border: 1px solid rgba(79, 223, 255, 0.55);
}

.hl-tag {
  background: rgba(0, 255, 140, 0.14);
  border: 1px solid rgba(0, 255, 140, 0.50);
}

/* =========================
   🔢 SETTINGS NUMBERS UI
   ========================= */

.sep {
  border: none;
  height: 1px;
  background: rgba(255, 79, 216, 0.25);
  margin: 16px 0;
}

#settingsView h3 {
  margin: 10px 0 8px;
  color: var(--pink);
  text-shadow: 0 0 10px rgba(255, 79, 216, 0.6);
}

.numbers-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 520px) {
  .numbers-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

.num-pill {
  user-select: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #140022;
  border: 1px solid rgba(255, 79, 216, 0.35);
  border-radius: 12px;
  padding: 8px 0;
  font-weight: 800;
  text-shadow: 0 0 8px rgba(255, 79, 216, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.num-pill input {
  display: none;
}

.num-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(255, 79, 216, 0.25);
}

.num-pill:has(input:checked) {
  border-color: rgba(0, 255, 140, 0.75);
  box-shadow:
    0 0 14px rgba(0, 255, 140, 0.25),
    inset 0 0 14px rgba(0, 255, 140, 0.10);
}

/* =========================
   📊 STATS DASHBOARD
   ========================= */

.stats-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.stats-tab {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  background: #140022;
  border: 1px solid rgba(255,79,216,.4);
  color: var(--pink);
  font-weight: bold;
  cursor: pointer;
}

.stats-tab.active {
  background: linear-gradient(135deg, #ff4fd8, #4fdfff);
  color: black;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 14px;
  border-radius: 16px;
  box-shadow: 0 0 20px rgba(0,0,0,.6);
}

.stat-title {
  font-size: .85em;
  opacity: .8;
}

.stat-value {
  font-size: 1.8em;
  font-weight: 900;
}

.delta {
  margin-top: 6px;
  font-size: .8em;
}

.delta.up { color: #00ff9c; }
.delta.down { color: #ff4f4f; }

.stat-card.green { box-shadow: 0 0 25px rgba(0,255,140,.6); }
.stat-card.red { box-shadow: 0 0 25px rgba(255,80,80,.6); }
.stat-card.orange { box-shadow: 0 0 25px rgba(255,180,0,.6); }
.stat-card.cyan { box-shadow: 0 0 25px rgba(79,223,255,.6); }
.stat-card.pink { box-shadow: 0 0 25px rgba(255,79,216,.6); }
.stat-card.blue { box-shadow: 0 0 25px rgba(79,223,255,.4); }

/* =========================
   📊 SOURCE BARS
   ========================= */
.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar {
  display: grid;
  grid-template-columns: 60px 1fr 40px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  background: #020012;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 10px;
  background: linear-gradient(90deg, #ff4fd8, #4fdfff);
}

.push-btn {
  width: 100%;
  margin-top: 10px;
  padding: 14px;
  font-size: 1rem;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #4fdfff, #ff4fd8);
  color: black;
  font-weight: 700;
  box-shadow: 0 0 20px rgba(79, 223, 255, 0.6);
}

.push-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.offer-from-push {
  border: 2px solid #ffd700;
  box-shadow: 0 0 18px rgba(255, 215, 0, 0.9);
  animation: pushPulse 1.5s ease-in-out infinite;
}

@keyframes pushPulse {
  0%, 100% { box-shadow: 0 0 10px rgba(255,215,0,.6); }
  50% { box-shadow: 0 0 22px rgba(255,215,0,1); }
}

.push-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7em;
  font-weight: bold;
  background: gold;
  color: black;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  background: inherit;
  z-index: -1;
}

/* =========================
   ❤️ HEALTH BAR
   ========================= */
.health-bar {
  position: fixed;
  margin-top: -10px;
  left: 0;
  right: 0;

  display: flex;
  align-items: center;
  gap: 8px;

  padding:
    8px
    calc(16px + env(safe-area-inset-left))
    8px
    calc(16px + env(safe-area-inset-right));

  font-size: 12px;
  color: #cfd9ff;

  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);

  border-radius: 0 0 14px 14px;
  z-index: 1000;
}


.health-bar .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.dot.online {
  background: #00ff9c;
  box-shadow: 0 0 6px #00ff9c;
}

.dot.offline {
  background: #ff4d6d;
}

/* =========================
   🔒 PWA LOCK MODE (GLOBAL)
   ========================= */

/* Sztywne ramy aplikacji */
html,
body {
  width: 100%;
  height: 100%;
              /* brak globalnego scrolla */
  overscroll-behavior: none;        /* brak bounce (Android) */
  -webkit-overflow-scrolling: auto; /* iOS – bez gumy */
  touch-action: manipulation;       /* blok pinch / zoom */
}

/* Zapobiega zaznaczaniu / zoomowaniu elementów */
* {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

/* INPUTY nadal używalne */
input,
textarea,
select,
button {
  user-select: auto;
  touch-action: manipulation;
}

/* =========================
   📜 CONTROLLED SCROLL AREAS
   ========================= */

/* Jedyny dozwolony scroll (np. main / view) */
main,
.view {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* =========================
   🧠 iOS SAFETY FIXES
   ========================= */

/* iOS – zapobiega przypadkowemu zoomowi tekstu */
html {
  -webkit-text-size-adjust: 100%;
}

/* Zapobiega rozjechaniu layoutu przy rotate */
body {
  inset: 0;
}

/* =========================
   🔒 PWA – ZOOM LOCK (SAFE)
   ========================= */

/* NIE blokuje scrolla */
html {
  touch-action: manipulation;   /* blok pinch */
  -webkit-text-size-adjust: 100%;
}

/* Usuwa double-tap zoom, NIE scroll */
body {
  overscroll-behavior-y: contain;
}

/* Elementy interaktywne nadal OK */
a,
button,
input,
textarea,
select {
  touch-action: manipulation;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  overscroll-behavior-y: contain;
}

/* =========================
   ✅ FIX: DOMKNIĘCIE + KOLORY + KLIKALNOŚĆ NAV
   (Wklej na sam KONIEC style.css)
   ========================= */

/* 1) Upewnij się, że poprzednie reguły są domknięte */
main::-webkit-scrollbar { display: none; }  /* <- pełna reguła, domknięta */

/* 2) Przywróć kolory (bo łatwo się nadpisują) */
body {
  background: radial-gradient(circle at top, #1b0c3f, #05010d);
  color: var(--text);
}

/* 3) Klucz: main ma być POD paskami, a paski mają być klikalne */
.topbar,
.bottom-nav,
.health-bar {
  z-index: 1000;
}

/* pseudo-elementy potrafią blokować tapy */
.topbar::before,
.bottom-nav::after {
  pointer-events: none;
}

/* main ma niżej niż fixed bary */
main {
  z-index: 1;
}

/* 4) Jeśli coś nadal blokuje klik w nav – wymuś priorytet nav */
.bottom-nav {
  z-index: 2000;
}

/* 5) Layout środkowego contentu dopasowany do Twojego HTML:
      topbar + healthbar + bottom-nav */
:root {
  --topbar-height: 130px;
  --topbar-shift: -18px;

  --healthbar-height: 32px;      /* dopasuj jeśli masz wyższy health-bar */
  --bottom-nav-height: 70px;
  --bottom-nav-shift: -14px;
}

/* trzymamy scroll tylko w main (jak native) */
html,
body {
  height: 100%;
  overflow: hidden;
}

/* main jako “viewport container” */
main {
  position: fixed;
  left: 0;
  right: 0;

  top: calc(
    env(safe-area-inset-top, 0px)
    + var(--topbar-height)
    + var(--topbar-shift)
    + var(--healthbar-height)
  );

  bottom: calc(
    env(safe-area-inset-bottom, 0px)
    + var(--bottom-nav-height)
    + var(--bottom-nav-shift)
  );

  overflow-y: auto;
  -webkit-overflow-scrolling: touch;

  padding: 16px;
  box-sizing: border-box;
}

/* 6) Bez tego czasem “wszystko na jednej stronie” wygląda jakby nie przełączało widoków,
      gdy gdzieś zniknęły reguły .view */
.view { display: none; }
.view.active { display: block; }

/* =========================
   📱 NOTCH FILL – TOP SAFE AREA
   ========================= */

/* tło strony pod notchem */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  height: env(safe-area-inset-top, 0px);
  background: linear-gradient(
    180deg,
    rgba(10, 4, 48, 0.95),
    rgba(5, 1, 13, 0.95)
  );

  z-index: 999;
  pointer-events: none;
}

/* =========================
   🔝 TOPBAR – FULL SAFE AREA
   ========================= */

:root {
  --topbar-height: 130px; /* wysokość WIDOCZNEJ części */
}

.topbar {
  position: fixed;
  left: 0;
  right: 0;

  /* 🔥 zaczyna się OD SAMEJ KRAWĘDZI TELEFONU */
  top: 0;

  /* 🔥 REALNA wysokość = content + notch */
  height: calc(
    var(--topbar-height)
    + env(safe-area-inset-top, 0px)
  );

  /* 👇 content topbara schodzi pod notch */
  padding-top: env(safe-area-inset-top, 0px);

  background: linear-gradient(
    180deg,
    rgba(10, 4, 48, 0.95),
    rgba(5, 1, 13, 0.95)
  );

  overflow: hidden;
  z-index: 1000;
  box-shadow: 0 0 40px rgba(255, 79, 216, 0.4);
}

/* =========================
   🔒 LOGIN OVERLAY
   ========================= */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(circle at top, #1b0c3f, #05010d);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-overlay.hidden {
  display: none;
}

.login-box {
  background: rgba(10, 5, 30, 0.95);
  border-radius: 20px;
  padding: 28px;
  width: 90%;
  max-width: 360px;
  box-shadow:
    0 0 40px rgba(255, 79, 216, 0.6),
    0 0 80px rgba(79, 223, 255, 0.4);
  text-align: center;
}

.login-box h1 {
  margin-bottom: 20px;
  color: var(--blue);
  text-shadow: 0 0 12px var(--blue);
}

.login-box input {
  width: 100%;
  padding: 14px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,79,216,.4);
  background: #140022;
  color: white;
  font-size: 1rem;
}

.login-box button {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-weight: 800;
  background: linear-gradient(135deg, #4fdfff, #ff4fd8);
  color: black;
  box-shadow: 0 0 20px rgba(79, 223, 255, 0.6);
}

.login-error {
  margin-top: 12px;
  color: #ff4d6d;
  font-size: 0.85rem;
}

/* =========================
   🧾 APP FOOTER
   ========================= */
.app-footer {
  position: fixed;
  left: 0;
  right: 0;

  bottom: calc(
    env(safe-area-inset-bottom, 0px)
    + var(--bottom-nav-height)
    + var(--bottom-nav-shift)
  );

  padding: 8px 12px;
  text-align: center;

  font-size: 11px;
  opacity: 0.55;

  color: var(--text);
  background: linear-gradient(
    180deg,
    rgba(5, 1, 13, 0.85),
    rgba(5, 1, 13, 0.95)
  );

  z-index: 900;
  pointer-events: none;
}

/* =========================
   ⏱ INTERVAL CONTROL
   ========================= */
.interval-box {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.interval-box input {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,79,216,.4);
  background: #140022;
  color: white;
  font-weight: 700;
}

.interval-save {
  padding: 14px 18px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-weight: 900;

  background: linear-gradient(135deg, #ff4fd8, #4fdfff);
  color: black;

  box-shadow:
    0 0 18px rgba(255,79,216,.5),
    0 0 28px rgba(79,223,255,.4);
}

.interval-save:active {
  transform: scale(0.97);
}
