/* =====================================================================
   Zlatni Kup — aukcija visokoletača

   Belo, tiho, bez ukrasa. Zlatna se pojavljuje samo tamo gde znači
   novac: cena, dugme za ponudu, oznaka vodećeg lota.

   Pisano od telefona naviše. Sve mere u ovom fajlu važe za telefon;
   od 700px naviše se uvećavaju. Obrnuto se pokazalo lošim — na
   telefonu je sve ispadalo prekrupno.
   ===================================================================== */

:root {
  --page:      #ffffff;
  --soft:      #faf9f6;
  --line:      #e6e3db;
  --line-firm: #cfcabd;

  --ink:       #1b1a16;
  --ink-2:     #4a4740;
  --muted:     #86827a;

  --gold:      #a97f22;
  --gold-lit:  #cfa03a;
  --gold-pale: #fbf5e6;

  --alert:     #a8452c;
  --good:      #4b7a45;

  --r:    3px;
  --wrap: 1240px;
  --pad:  16px;                     /* razmak od ivice ekrana */
}

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

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;                 /* brana protiv vodoravnog klizanja */
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.5 "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
@media (min-width: 700px) { body { font-size: 16px; line-height: 1.55; } }

h1, h2, h3 {
  font-family: Bitter, Georgia, serif;
  font-weight: 700; line-height: 1.2;
  margin: 0 0 .5em; letter-spacing: -.008em;
}
h1 { font-size: 1.4rem; }
h2 { font-size: 1.08rem; }
h3 { font-size: 1rem; }
@media (min-width: 700px) { h1 { font-size: 1.7rem; } h2 { font-size: 1.15rem; } }

p { margin: 0 0 1em; }
a { color: var(--gold); text-underline-offset: 2px; }
a:hover { color: var(--ink); }
img { max-width: 100%; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.wrap {
  width: 100%; max-width: var(--wrap); margin: 0 auto;
  padding-left:  calc(var(--pad) + env(safe-area-inset-left));
  padding-right: calc(var(--pad) + env(safe-area-inset-right));
}
@media (min-width: 700px)  { :root { --pad: 24px; } }
@media (min-width: 1000px) { :root { --pad: 32px; } }

.skip { position: absolute; left: -9999px; background: var(--gold); color: #fff; padding: 10px 16px; z-index: 99; }
.skip:focus { left: 12px; top: 12px; }

/* --- Zaglavlje ------------------------------------------------------
   Nikad skraćeni zapis za padding ovde: .topbar-in deli element sa
   .wrap, pa bi "padding: 10px 0" obrisao razmak od ivica ekrana. */

.topbar { background: var(--page); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.topbar-in {
  display: flex; align-items: center; gap: 12px;
  min-height: 54px; flex-wrap: wrap;
  padding-top: 9px; padding-bottom: 9px;
}

.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 33% 30%, var(--gold-lit), var(--gold) 60%, #7e5c15);
}
.brand-name {
  font-family: Bitter, serif; font-weight: 700; font-size: .95rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Na telefonu navigacija kliže vodoravno umesto da se prelama. */
.nav {
  display: flex; gap: 2px; min-width: 0; order: 3; width: 100%;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: 0 0 auto; color: var(--ink-2); text-decoration: none;
  padding: 8px 10px; border-radius: var(--r); font-size: .86rem;
}
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav .nav-out { color: var(--gold); }

@media (min-width: 700px) {
  .topbar-in { gap: 16px; min-height: 58px; }
  .nav { order: 0; width: auto; margin-right: auto; flex-wrap: wrap; overflow: visible; }
  .nav a { font-size: .92rem; padding: 7px 10px; }
  .brand-name { font-size: 1rem; }
}

.who { display: flex; align-items: center; gap: 10px; font-size: .8rem; color: var(--muted); margin-left: auto; min-width: 0; }
.who-name { max-width: 12ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Na najužim telefonima ime korisnika ustupa mesto dugmetu za odjavu. */
@media (max-width: 359px) { .who-name { display: none; } }
.who-out { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--line-firm); flex: none; }
@media (min-width: 700px) { .who { font-size: .86rem; } .who-name { max-width: 20ch; } }

/* --- Poruke --------------------------------------------------------- */

.flash {
  margin: 12px 0 0; padding: 10px 13px; border-radius: var(--r);
  background: var(--soft); border-left: 3px solid var(--gold); font-size: .89rem;
}
.flash-error { border-left-color: var(--alert); }
.flash-ok    { border-left-color: var(--good); }

/* --- Naslov aukcije ------------------------------------------------- */

.hero { padding: 20px 0 14px; }
.hero h1 { font-size: 1.45rem; margin-bottom: .25em; }
.hero-intro { color: var(--ink-2); max-width: 62ch; font-size: .9rem; }

.hero-clock {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px;
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line);
  font-size: .84rem; color: var(--muted);
}
.hero-clock .big {
  font-family: Bitter, serif; font-weight: 700;
  font-size: 1.1rem; color: var(--ink); font-variant-numeric: tabular-nums;
}
@media (min-width: 700px) {
  .hero { padding: 32px 0 20px; }
  .hero h1 { font-size: clamp(1.7rem, 4vw, 2.2rem); }
  .hero-intro { font-size: .96rem; }
  .hero-clock { font-size: .92rem; gap: 6px 20px; }
  .hero-clock .big { font-size: 1.25rem; }
}

/* --- Mreža lotova: 2 na telefonu, 4 na desktopu --------------------- */

.lots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 12px;
  padding: 6px 0 44px;
}
.lots > * { min-width: 0; }
@media (min-width: 700px)  { .lots { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 18px; } }
@media (min-width: 1000px) { .lots { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px 22px; padding-bottom: 56px; } }

.lot { display: flex; flex-direction: column; min-width: 0; }
.lot.is-closed .lot-photo img { filter: grayscale(.55); opacity: .8; }

.lot-photo {
  display: block; position: relative;
  aspect-ratio: 1 / 1; background: var(--soft);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
}
.lot-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lot.is-leading .lot-photo { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }

.lot-no {
  position: absolute; left: 0; top: 0;
  min-width: 22px; height: 21px; padding: 0 6px;
  display: grid; place-items: center;
  background: var(--page); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-family: Bitter, serif; font-weight: 700; font-size: .75rem;
  font-variant-numeric: tabular-nums; color: var(--ink-2);
}

.lot-name {
  font-family: Bitter, serif; font-size: .92rem; font-weight: 700;
  margin: 8px 0 1px; line-height: 1.25;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lot-name a { color: inherit; text-decoration: none; }
.lot-name a:hover { color: var(--gold); }

.lot-loft {
  font-size: .74rem; color: var(--muted); margin: 0 0 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lot-price { margin-top: auto; padding-top: 7px; border-top: 1px solid var(--line); }
.lot-price .lead { display: block; font-size: .68rem; color: var(--muted); }
.lot-price .num {
  font-family: Bitter, serif; font-weight: 700; font-size: 1.15rem;
  color: var(--gold); font-variant-numeric: tabular-nums; line-height: 1.15;
}
.lot-price .unit { font-size: .7rem; color: var(--muted); }

.lot-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 5px; margin-top: 5px; font-size: .71rem; min-width: 0;
}
.lot-foot > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 700px) {
  .lot-name { font-size: 1rem; margin-top: 10px; }
  .lot-loft { font-size: .82rem; }
  .lot-price .num { font-size: 1.35rem; }
  .lot-price .unit { font-size: .78rem; }
  .lot-price .lead { font-size: .74rem; }
  .lot-foot { font-size: .78rem; }
  .lot-no { min-width: 26px; height: 24px; font-size: .82rem; }
}

.clock { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.clock[data-urgent="1"] { color: var(--alert); font-weight: 600; }
.clock.done { color: var(--muted); }

.tag { font-size: .69rem; color: var(--muted); white-space: nowrap; }
.tag-leading { color: var(--good); font-weight: 600; }
.tag-out     { color: var(--alert); }
.tag-sold    { color: var(--gold); font-weight: 600; }
@media (min-width: 700px) { .tag { font-size: .72rem; } }

/* --- Licitiranje: svaki pritisak na + je jedan korak ----------------- */

.bid { margin-top: 8px; min-width: 0; }

.stepper {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: stretch; border: 1px solid var(--line-firm); border-radius: var(--r);
  overflow: hidden; background: var(--page);
}
.stepper button {
  border: none; background: var(--soft); color: var(--ink);
  font: 600 1.1rem/1 "IBM Plex Sans", sans-serif; cursor: pointer;
  min-height: 44px; padding: 0;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.stepper button:hover:not(:disabled) { background: var(--gold-pale); color: var(--gold); }
.stepper button:disabled { color: var(--line-firm); cursor: not-allowed; }
.stepper .minus { border-right: 1px solid var(--line); }
.stepper .plus  { border-left: 1px solid var(--line); }

.stepper output {
  display: grid; place-items: center; text-align: center; min-width: 0;
  font-family: Bitter, serif; font-weight: 700; font-size: .98rem;
  font-variant-numeric: tabular-nums; color: var(--ink); padding: 0 2px;
}

.bid-added {
  display: block; text-align: center; margin: 5px 0 0;
  font-size: .69rem; color: var(--muted); min-height: 1.2em; line-height: 1.3;
}
.bid-added.on { color: var(--gold); font-weight: 600; }

.bid .btn { margin-top: 6px; }
.bid-msg { display: block; font-size: .71rem; margin: 5px 0 0; min-height: 1.1em; line-height: 1.3; }

.lot-note { font-size: .72rem; color: var(--muted); margin: 7px 0 0; }

@media (min-width: 700px) {
  .stepper { grid-template-columns: 40px minmax(0, 1fr) 40px; }
  .stepper output { font-size: 1.1rem; }
  .bid-added { font-size: .78rem; }
  .bid-msg { font-size: .78rem; }
  .lot-note { font-size: .78rem; }
}

/* --- Dugmad --------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line-firm); border-radius: var(--r);
  background: var(--page); color: var(--ink);
  font: 600 .85rem/1 "IBM Plex Sans", sans-serif;
  text-decoration: none; cursor: pointer; text-align: center;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--soft); color: var(--ink); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { background: var(--gold-lit); border-color: var(--gold-lit); color: #fff; }
.btn-wide { width: 100%; }
.btn-small { min-height: 36px; padding: 0 11px; font-size: .78rem; }
.btn-quiet { background: transparent; }
.btn-danger { border-color: var(--alert); color: var(--alert); background: transparent; }
.btn-danger:hover { background: var(--alert); color: #fff; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
@media (min-width: 700px) { .btn { font-size: .9rem; padding: 0 16px; } }

/* --- Stranica goluba ------------------------------------------------
   min-width: 0 na kolonama je obavezno. Bez njega red sličica nametne
   svoju punu širinu koloni i cela stranica se razvuče preko ekrana. */

.detail { display: grid; gap: 22px; padding: 14px 0 44px; }
.detail > * { min-width: 0; }
@media (min-width: 900px) { .detail { grid-template-columns: 1.1fr .9fr; align-items: start; gap: 28px; padding: 18px 0 56px; } }

.gallery { min-width: 0; }
.gallery-main {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border: 1px solid var(--line); border-radius: var(--r); background: var(--soft);
  touch-action: pan-y;
}

.gallery-thumbs {
  display: flex; gap: 8px; margin-top: 8px;
  min-width: 0; max-width: 100%;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 4px; scrollbar-width: thin;
}
.gallery-thumbs button {
  flex: 0 0 auto;
  width: 68px; height: 52px; padding: 0;
  border: 1px solid var(--line); background: none; border-radius: var(--r);
  overflow: hidden; cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(169,127,34,.18);
}
.gallery-thumbs button[aria-current="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
@media (min-width: 700px) { .gallery-thumbs button { width: 80px; height: 60px; } }

.panel { border: 1px solid var(--line); border-radius: var(--r); padding: 16px 14px; min-width: 0; }
.panel + .panel { margin-top: 14px; }
@media (min-width: 700px) { .panel { padding: 20px; } .panel + .panel { margin-top: 16px; } }

.price-now { margin-bottom: 14px; }
.price-now .lead { font-size: .78rem; color: var(--muted); }
.price-now .num {
  display: block; font-family: Bitter, serif; font-weight: 700;
  font-size: 2rem; line-height: 1.05;
  color: var(--gold); font-variant-numeric: tabular-nums;
}
.price-now .unit { font-size: .85rem; color: var(--ink-2); }
.price-now .eur { font-size: .82rem; color: var(--muted); }
@media (min-width: 700px) {
  .price-now .num { font-size: 2.5rem; }
  .price-now .lead { font-size: .82rem; }
}

.detail .stepper { grid-template-columns: 48px minmax(0, 1fr) 48px; }
.detail .stepper button { min-height: 50px; font-size: 1.3rem; }
.detail .stepper output { font-size: 1.3rem; }
.detail .bid-added { font-size: .8rem; }
@media (min-width: 700px) {
  .detail .stepper { grid-template-columns: 54px minmax(0, 1fr) 54px; }
  .detail .stepper button { min-height: 54px; }
  .detail .stepper output { font-size: 1.5rem; }
  .detail .bid-added { font-size: .88rem; }
}

.spec { width: 100%; border-collapse: collapse; font-size: .87rem; table-layout: fixed; }
.spec th, .spec td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; word-break: break-word; }
.spec th { color: var(--muted); font-weight: 400; width: 44%; padding-right: 10px; }
.spec tr:last-child th, .spec tr:last-child td { border-bottom: none; }
@media (min-width: 700px) { .spec { font-size: .92rem; } }

.bidlist { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.bidlist li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bidlist li:last-child { border-bottom: none; }
.bidlist .amt { font-variant-numeric: tabular-nums; color: var(--gold); font-weight: 600; flex: none; }
.bidlist .when { color: var(--muted); font-size: .78rem; }
@media (min-width: 700px) { .bidlist { font-size: .91rem; } }

/* --- Obrasci -------------------------------------------------------- */

.form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; }
@media (min-width: 700px) { .form, .form-grid { gap: 16px; } .form-grid { grid-template-columns: 1fr 1fr; } }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-size: .84rem; color: var(--ink-2); }
.field .note { font-size: .76rem; color: var(--muted); line-height: 1.4; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=datetime-local], input[type=tel], input[type=file], select, textarea {
  width: 100%; max-width: 100%; min-height: 44px; padding: 9px 11px;
  background: var(--page); border: 1px solid var(--line-firm);
  border-radius: var(--r); color: var(--ink);
  font: 400 16px "IBM Plex Sans", sans-serif;   /* 16px sprečava zumiranje na iPhoneu */
}
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; }

/* Lozinka sa dugmetom za prikaz. */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 78px; }
.pw-wrap button {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  min-height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--soft); color: var(--ink-2);
  font: 500 .78rem/1 "IBM Plex Sans", sans-serif; cursor: pointer;
  touch-action: manipulation;
}
.pw-wrap button:hover { background: var(--gold-pale); color: var(--gold); border-color: var(--gold-lit); }

.check { display: flex; align-items: flex-start; gap: 9px; font-size: .88rem; }
.check input { width: 19px; height: 19px; min-height: 0; flex: none; margin-top: 2px; accent-color: var(--gold); }

.actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; padding-top: 2px; }

/* --- Prijava -------------------------------------------------------- */

.login-page {
  min-height: 100vh; display: grid; place-items: center;
  padding: 28px calc(var(--pad) + env(safe-area-inset-left)) 36px calc(var(--pad) + env(safe-area-inset-right));
}
.login-box { width: 100%; max-width: 360px; }
.login-box h1 { font-size: 1.4rem; margin-bottom: .2em; }
.login-lead { color: var(--muted); font-size: .87rem; margin-bottom: 22px; }
.login-mark {
  width: 36px; height: 36px; border-radius: 50%; margin-bottom: 14px;
  background: radial-gradient(circle at 33% 30%, var(--gold-lit), var(--gold) 60%, #7e5c15);
}
.login-note { margin-top: 20px; font-size: .8rem; color: var(--muted); line-height: 1.45; }

/* --- Admin ---------------------------------------------------------- */

.page { padding: 18px 0 44px; }
@media (min-width: 700px) { .page { padding: 26px 0 60px; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { color: var(--muted); margin: 0; font-size: .86rem; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 520px; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 500; font-size: .78rem; white-space: nowrap; }
.table tbody tr:hover { background: var(--soft); }
.table .num { font-variant-numeric: tabular-nums; text-align: right; }
.table .right { text-align: right; }
@media (min-width: 700px) { .table { font-size: .91rem; } .table th, .table td { padding: 10px 12px; } }

.cards { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.stat { border: 1px solid var(--line); border-radius: var(--r); padding: 13px; min-width: 0; }
.stat .num {
  display: block; font-family: Bitter, serif; font-size: 1.45rem; font-weight: 700;
  color: var(--gold); font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis;
}
.stat .lead { font-size: .76rem; color: var(--muted); line-height: 1.35; }
@media (min-width: 700px) { .stat .num { font-size: 1.7rem; } .stat .lead { font-size: .82rem; } }

.thumbs { display: flex; gap: 9px; flex-wrap: wrap; }
.thumb { position: relative; width: 104px; }
.thumb img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--r); border: 1px solid var(--line); display: block; }
.thumb button { position: absolute; top: 4px; right: 4px; }

.empty { border: 1px dashed var(--line-firm); border-radius: var(--r); padding: 28px 18px; text-align: center; color: var(--muted); }
.empty h2 { color: var(--ink); }

.pwbox { background: var(--gold-pale); border: 1px solid var(--gold-lit); border-radius: var(--r); padding: 12px 14px; margin-bottom: 16px; }
.pwbox code { font-size: .95rem; color: var(--gold); user-select: all; word-break: break-all; }

/* --- Podnožje ------------------------------------------------------- */

.foot { border-top: 1px solid var(--line); margin-top: auto; padding-top: 16px; padding-bottom: calc(26px + env(safe-area-inset-bottom)); }
.foot-in { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: .77rem; color: var(--muted); }
@media (min-width: 700px) { .foot-in { font-size: .82rem; } }

/* --- Sitno ---------------------------------------------------------- */

.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.mt { margin-top: 18px; }
.inline-form { display: inline; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
