/*
  BASE.CSS – premenné, reset, základ, tlačidlá, formuláre, utility triedy
*/

/* ===== CSS premenné ===== */
:root {
  --pozadie: #0f1422;
  --panel:   #161d31;
  --text:    #e9eef7;
  --tichy:   #aeb7c8;
  --akcia:   #2ea4e6;
  --okraj:   rgba(255,255,255,.10);
  --radius:  0.75rem;
  --tien:    0 0.25rem 1rem rgba(0,0,0,.3), 0 0.5rem 2rem rgba(0,0,0,.2);
  font-size: 16px;
}

/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== Základ ===== */
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--pozadie);
  color: var(--text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main { flex: 1; }

/* ===== Typografia – nadpisy ===== */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
}

/* ===== Globálny font pre natívne tlačidlá ===== */
button, input[type="submit"], input[type="button"] {
  font-family: inherit;
}

/* ===== Globálne linky ===== */
a { color: var(--akcia); }
a:visited { color: var(--akcia); }

/* ===== Obal (kontajner) ===== */
.obal {
  width: min(1100px, 92%);
  margin-inline: auto;
}

/* ===== Tlačidlo ===== */
.tlacitko {
  display: inline-block;
  background: var(--akcia);
  color: #000;
  text-decoration: none;
  font-weight: 600;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.2s ease;
}
.tlacitko:hover {
  background: #1a88c4;
  transform: translateY(-1px);
}

/* ===== Formuláre – globálne vstupy ===== */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
textarea,
select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--okraj);
  background: #0c101b;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease;
}
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):focus,
textarea:focus,
select:focus {
  border-color: rgba(46,164,230,0.7);
}

/* Skryť natívne šípky v number inpute */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

label {
  display: block;
  font-size: 0.95rem;
  color: var(--tichy);
  margin-bottom: 0.3rem;
}

/* ===== Utility triedy ===== */

.page-main { margin-top: 6rem; padding-top: 2rem; padding-bottom: 2rem; }

.filter-info { color: var(--tichy); margin-top: 0.4rem; }

.msg-chyba  { color: #ff6b6b; margin: 0.6rem 0; }
.msg-uspech { color: #4cd964; margin: 0.6rem 0; }

.karta {
  background: #0c101b;
  border-radius: var(--radius);
  padding: 1rem;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.form-row {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
}

/* ===== Tabulky ===== */
.tabulka {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
.tabulka th,
.tabulka td {
  text-align: left;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--okraj);
}
.tabulka th {
  color: var(--tichy);
  font-size: 0.9rem;
  font-weight: 600;
}
.tabulka tr:hover td {
  background: rgba(255,255,255,0.02);
}

/* ===== Stav skladu ===== */
.in-stock     { font-size: 0.8rem; color: #4cd964; }
.out-of-stock { font-size: 0.8rem; color: #ff6b6b; }

/* ===== Filter panel ===== */
.filter-panel {
  width: 16rem;
  max-width: 100%;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.filter-panel h3 { margin: 0 0 0.6rem; font-size: 1rem; }

.filter-layout {
  display: flex;
  gap: 1.2rem;
  margin-top: 1.2rem;
  align-items: flex-start;
}

.filter-section { margin-top: 0.8rem; }

.filter-label {
  font-size: 0.9rem;
  color: var(--tichy);
  margin-bottom: 0.4rem;
  display: block;
}

.filter-checks {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-check-label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.95rem;
  cursor: pointer;
}

.filter-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
}

.products-area { flex: 1; min-width: 0; }

/* ===== Filter toggle (mobil) ===== */
.filter-toggle-btn {
  display: none;
  width: 100%;
  margin-bottom: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--panel);
  border: 1px solid var(--okraj);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.filter-toggle-btn::after {
  content: ' ▾';
  float: right;
}
.filter-toggle-btn.filter-open::after {
  content: ' ▴';
}

/* ===== Sklad – málo kusov ===== */
.low-stock { font-size: 0.8rem; color: #ffa040; }

/* ===== Nav: odhlásenie červené ===== */
.nav-logout { color: #ff6b6b !important; }
.nav-logout:hover { background: rgba(255,107,107,0.1) !important; color: #ff6b6b !important; }

/* ===== Tlačidlá – zachovaj farbu po kliknutí ===== */
a.tlacitko,
a.tlacitko:visited,
a.tlacitko:focus { background: var(--akcia); color: #000; text-decoration: none; }
a.tlacitko:hover  { background: #1a88c4; color: #fff; }
a.tlacitko:active { background: #1a88c4; color: #fff; }
.tlacitko:hover   { color: #fff; }

/* ===== Disabled tlačidlá ===== */
button:disabled,
input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== Toast notifikácia ===== */
.hz-toast {
  position: fixed;
  top: 5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-160%);
  z-index: 9999;
  background: var(--panel);
  padding: 0.75rem 1.6rem;
  border-radius: 0.8rem;
  border: 1px solid var(--okraj);
  box-shadow: 0 0.5rem 2rem rgba(0,0,0,0.5);
  font-size: 0.95rem;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.hz-toast.hz-toast--show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.hz-toast.hz-toast--ok  { border-color: rgba(76,217,100,0.5);  color: #4cd964; }
.hz-toast.hz-toast--err { border-color: rgba(255,107,107,0.5); color: #ff6b6b; }

/* ===== Produkt detail ===== */
.produkt-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}

.produkt-img-karta {
  background: var(--panel);
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  position: sticky;
  top: 5.5rem;
}
.produkt-img-karta img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.produkt-cena {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin: 0.6rem 0;
}

.produkt-variant-wrap {
  margin-top: 1.2rem;
  display: grid;
  gap: 0.8rem;
  max-width: 460px;
}

.qty-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.qty-controls input { width: 90px; text-align: center; }
.qty-controls button {
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--okraj);
  background: #0c101b;
  color: var(--text);
  cursor: pointer;
  width: auto;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.qty-controls button:hover {
  border-color: var(--akcia);
  color: var(--akcia);
}

/* ===== Správa košíka ===== */
.msg-box { margin-bottom: 1rem; padding: 0.7rem 0.9rem; border-radius: var(--radius); display: none; }
.msg-box.ok  { background: rgba(76,217,100,0.1); border: 1px solid rgba(76,217,100,0.25); color: #4cd964; display: block; }
.msg-box.err { background: rgba(255,107,107,0.1); border: 1px solid rgba(255,107,107,0.25); color: #ff6b6b; display: block; }

/* ===== Košík ===== */
.kosik-riadok-img {
  width: 58px;
  height: 58px;
  background: var(--panel);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid var(--okraj);
}
.kosik-riadok-img img { width: 100%; height: 100%; object-fit: contain; }

.kosik-produkt-info { display: flex; gap: 0.8rem; align-items: center; }

.kosik-suma { display: flex; justify-content: flex-end; margin-top: 1rem; }

.kosik-suma-karta {
  background: var(--panel);
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  min-width: 280px;
}

.kosik-suma-riadok { display: flex; justify-content: space-between; gap: 1rem; }

/* ===== Objednávky ===== */
.objednavka-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2rem;
  margin-top: 1.2rem;
}

.objednavka-karta {
  background: var(--panel);
  padding: 1.2rem;
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.objednavka-karta h3 { margin-top: 0; font-size: 1rem; color: var(--tichy); font-weight: 600; }

/* ===== Responzivita ===== */
@media (max-width: 48rem) {
  .produkt-detail-grid,
  .objednavka-detail-grid {
    grid-template-columns: 1fr;
  }

  .filter-layout {
    flex-direction: column;
  }
  .filter-panel {
    width: 100%;
    display: none;
  }
  .filter-panel.filter-panel--open {
    display: block;
  }
  .filter-toggle-btn {
    display: block;
  }

  /* Moje objednávky – skryť stĺpec poznámky na mobile */
  .stlpec-poznamka { display: none; }

  /* Košík – meno produktu sa môže zalomiť */
  .kosik-polozka-nazov { white-space: normal; }

  /* Admin – skryť stĺpce na mobile */
  .amob-hide { display: none !important; }
  .amob-stav { display: block; }

  /* Produkt detail – variant wrap na celú šírku */
  .produkt-variant-wrap { max-width: 100%; }

  /* Produkt detail – menší obrázok */
  .produkt-img-karta img { max-height: 240px; }

  /* Produkt detail – tlačidlo "Pridať do košíka" na celú šírku */
  .produkt-variant-wrap > .tlacitko { width: 100%; text-align: center; }

  /* Produkt detail – väčšie qty tlačidlá pre dotyk */
  .qty-controls button { min-width: 2.4rem; min-height: 2.4rem; font-size: 1.1rem; }
}

/* ===== Admin – tabulky: stĺpce viditeľné na desktope ===== */
.amob-stav { display: none; }

/* ===== Admin filter details (collapsible na mobile) ===== */
.admin-filter-details {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: 1rem;
  border: none;
}
.admin-filter-details summary {
  display: none; /* Desktop: summary skryté, obsah vždy viditeľný */
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  padding: 0.3rem 0;
  margin-bottom: 0.6rem;
  color: var(--akcia);
  user-select: none;
}
.admin-filter-details summary::-webkit-details-marker { display: none; }

@media (max-width: 48rem) {
  .admin-filter-details summary {
    display: block; /* Mobile: summary viditeľné → collapsible */
  }
  .admin-filter-details[open] summary {
    margin-bottom: 0.8rem;
  }
}

/* ===== Tabulky scroll na mobile ===== */
.tabulka-obal {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ===== Responzivita: page-main odsadenie od headeru ===== */
@media (max-width: 64rem) {
  .page-main { margin-top: 5rem; padding-top: 1.2rem; padding-bottom: 1.5rem; }
}
@media (max-width: 48rem) {
  .page-main { margin-top: 4rem; padding-top: 0.8rem; padding-bottom: 1.2rem; }
}
