/* Styl zgodny z flipr.pl */

@font-face {
  font-family: 'DM Sans';
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/dm-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4;
}
@font-face {
  font-family: 'DM Sans';
  font-weight: 400 700;
  font-display: swap;
  src: url(/fonts/dm-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}
@font-face {
  font-family: Rajdhani;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/rajdhani-700-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+20A0-20AB, U+20AD-20C4;
}
@font-face {
  font-family: Rajdhani;
  font-weight: 700;
  font-display: swap;
  src: url(/fonts/rajdhani-700-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

:root {
  color-scheme: dark;
  --bg: #131414;
  --bg2: #1a1b1c;
  --white: #f0f0f0;
  --muted: rgb(240 240 240 / .6);
  --teal: #3de8b0;
  --teal2: #00c6a2;
  --teal-dim: rgb(61 232 176 / .12);
  --border: rgb(255 255 255 / .07);
  --field-border: rgb(255 255 255 / .2);
  --error: #ff8f85;
  --gold: #ffc850;
  --heading: Rajdhani, sans-serif;
  --cut: 10px;
  --bevel: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, var(--cut) 100%, 0 calc(100% - var(--cut)));
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0; /* tło jest na html, bo tutaj zakryłoby poświatę na ekranie logowania */
  color: var(--white);
  font: 16px/1.5 'DM Sans', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--heading); font-weight: 700; letter-spacing: .03em; line-height: 1.15; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.25rem; overflow-wrap: anywhere; }

.muted { color: var(--muted); font-size: .875rem; overflow-wrap: anywhere; }
.error { color: var(--error); font-size: .9rem; overflow-wrap: anywhere; }
.error:empty, .muted:empty { display: none; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 10px; align-items: end; }
.row > * { flex: 1; min-width: 0; }
.empty { padding: 56px 16px; text-align: center; color: var(--muted); }

/* Przyciski: ścięte rogi. Zwykły przycisk ma ramkę z tła, a środek rysuje ::before,
   dzięki czemu linia biegnie też po ściętych rogach. */
button {
  position: relative;
  isolation: isolate;
  min-height: 48px;
  padding: 8px 20px;
  border: 0;
  border-radius: 0;
  background: var(--edge);
  color: var(--teal);
  clip-path: var(--bevel);
  font: 700 1rem/1.2 var(--heading);
  letter-spacing: .06em;
  cursor: pointer;
  --edge: var(--teal);
}
button::before {
  content: '';
  position: absolute;
  inset: 1px;
  z-index: -1;
  background: var(--bg2);
  clip-path: var(--bevel);
}
button.primary { background: linear-gradient(135deg, var(--teal2), var(--teal)); color: #111; }
button.primary::before { display: none; }
button:disabled { opacity: .5; cursor: default; }
button.wide { width: 100%; margin-bottom: 16px; }
@media (hover: hover) {
  button:not(.primary, :disabled):hover::before { background: #1d3029; }
  button.primary:not(:disabled):hover { opacity: .85; }
}

/* Na przyciskach obrys musi być w środku, bo clip-path obcina to, co wystaje. */
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
button:focus-visible { outline-offset: -5px; }
button.primary:focus-visible { outline-color: #111; }

/* Formularze */
label { display: grid; gap: 6px; font-size: .9rem; font-weight: 500; }
input, select { color: inherit; font: inherit; }
input:not([type=checkbox]), select {
  width: 100%;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  background-color: var(--bg);
  font-size: 16px; /* przy mniejszej czcionce iPhone przybliża stronę po dotknięciu pola */
  font-weight: 400;
}
input::placeholder { color: rgb(240 240 240 / .5); }
input:not([type=checkbox]):focus, select:focus { border-color: var(--teal); }

fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; padding: 0; font-size: .9rem; font-weight: 500; }
.import { padding: 16px; border: 1px solid rgb(61 232 176 / .4); background: var(--teal-dim); }
.import legend {
  float: left; /* nagłówek wewnątrz ramki, a nie na jej krawędzi */
  width: 100%;
  margin: 0;
  color: var(--teal);
  font: 700 1.1rem/1.2 var(--heading);
  letter-spacing: .04em;
}
.import legend + * { clear: both; }
.import .row button { flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 12px;
  border: 1px solid var(--field-border);
  border-radius: 4px;
  font-weight: 400;
}
.chips label:has(:checked) { border-color: var(--teal); background: var(--teal-dim); color: var(--teal); }
.chips input { accent-color: var(--teal); }
.olx { padding: 8px 16px; border: 1px solid var(--field-border); }
.olx:has([name=olx]:checked) { padding-bottom: 16px; border-color: rgb(61 232 176 / .4); }
.olx:not(:has([name=olx]:checked)) .olx-options { display: none; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.switch input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--teal); }
.search a.muted { justify-self: start; color: var(--teal); }
summary { padding: 10px 0; font-weight: 500; cursor: pointer; }

/* Logowanie */
.login {
  display: grid;
  gap: 16px;
  align-content: center;
  width: min(100%, 400px);
  min-height: 100dvh;
  margin: auto;
  padding: 24px;
  text-align: center;
}
.login::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 0, rgb(61 232 176 / .1), transparent 60vmax);
}
.login img { justify-self: center; margin-bottom: 8px; }
.login h1 { font-size: 2.6rem; line-height: 1; }
.login em {
  display: block;
  background: linear-gradient(135deg, var(--teal2), var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-style: normal;
}
.login form { margin-top: 12px; text-align: left; }

/* Układ */
#app { width: min(100%, 1200px); margin: auto; }
header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  border-bottom: 1px solid var(--border);
  background: rgb(19 20 20 / .92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
header img { flex: none; margin: -2px; }
.status { margin-left: auto; color: var(--muted); font-size: .8rem; line-height: 1.3; text-align: right; text-wrap: balance; }
#app > main { padding: 16px 16px calc(100px + env(safe-area-inset-bottom)); }
.banner {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid rgb(255 200 80 / .4);
  background: rgb(255 200 80 / .1);
  color: var(--gold);
}

nav {
  position: fixed;
  inset: auto 0 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 0 8px env(safe-area-inset-bottom);
  border-top: 1px solid var(--border);
  background: rgb(19 20 20 / .95);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
nav button {
  flex: 0 1 200px;
  min-width: 0;
  min-height: 60px;
  padding: 8px 4px;
  background: none;
  clip-path: none;
  color: var(--muted);
}
nav button::before { inset: 0 18% auto; height: 2px; background: none; clip-path: none; }
nav button[aria-current=page] { color: var(--teal); }
nav button[aria-current=page]::before,
nav button[aria-current=page]:hover::before {
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
}

/* Oferty */
.filter { margin-bottom: 16px; }
.offers { display: grid; grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); gap: 8px; }
.offer {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: inherit;
  text-decoration: none;
}
@media (hover: hover) {
  .offer:hover { border-color: rgb(61 232 176 / .4); }
}
.photo { position: relative; aspect-ratio: 3 / 4; background: #232526; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.offer-body { display: grid; gap: 3px; padding: 12px; }
.offer-body h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font: 500 .925rem/1.35 'DM Sans', sans-serif;
  letter-spacing: 0;
}
.price { color: var(--teal); font: 700 1.4rem/1.1 var(--heading); letter-spacing: .02em; }
.source {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border: 1px solid currentcolor;
  border-radius: 4px;
  background: rgb(19 20 20 / .88);
  font: 700 .85rem/1.2 var(--heading);
  letter-spacing: .06em;
}
/* Na flipr.pl obie platformy są zielone. Tu OLX ma jasne tło, żeby od razu było widać różnicę. */
.source.vinted { color: var(--teal); }
.source.olx { border-color: var(--white); background: var(--white); color: #111; }

/* Do 10 min: wypełniona etykieta z kropką. Do godziny: turkusowy napis. Później: szary. */
.found { color: var(--muted); font-size: .8rem; }
.found.recent { color: var(--teal); font-weight: 500; }
.found.fresh {
  justify-self: start;
  margin: 3px -4px;
  padding: 3px 6px;
  border-radius: 4px;
  background: var(--teal);
  color: #111;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}
.found.fresh::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentcolor;
  vertical-align: 1px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .found.fresh::before { animation: none; }
}

/* Wyszukiwania i ustawienia */
.card { padding: 20px; border: 1px solid var(--border); background: var(--bg2); }
#searches, #tab-settings { gap: 8px; }
.search { gap: 8px; }
.card.paused h3 { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.actions button { --cut: 8px; --edge: #46494b; min-height: 44px; padding: 6px 14px; color: var(--white); }
.actions .danger { color: var(--error); }
#logout, #cancel { --edge: #46494b; color: var(--white); }

dialog {
  width: min(100%, 560px);
  max-width: none;
  max-height: 100dvh;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
  overflow-y: auto;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--white);
}
dialog::backdrop { background: rgb(0 0 0 / .7); }
@media (max-width: 600px) {
  dialog { height: 100dvh; margin: 0; border: 0; }
}
