@import url('/shared/variables.css');
@import url('/shared/utilities.css');
@import url('/shared/links.css');
@import url('/shared/buttons.css');

/* ============================================
   ZMIENNE LOKALNE (specyficzne dla sklepu)
   ============================================ */
:root {
  --bg: #0b0b12;
  --card: #151320;
  --border: #2e2a3d;
  --text: #f5f3ff;
  --muted: #b5a8d3;
  --accent: #d4af37;
  --accent-light: #f6d14a;
  --vh: 1vh;
}

/* ============================================
   BAZOWE STYLE
   ============================================ */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100%;
  flex-direction: column;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px;
  flex: 1;
}

.brand {
  font-weight: 800;
  font-size: 22px;
  color: var(--accent);
}

.muted {
  color: var(--text);
}

/* ============================================
   NAGŁÓWEK SKLEPU
   ============================================ */
header.top {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

/* Link powrotu */
.back-arrow {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}
.back-arrow:hover {
  color: var(--accent);
}

/* Tytuł strony */
.page-title {
  margin: 0;
  text-align: center;
  justify-self: center;
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 800;
  color: var(--text);
  letter-spacing: 1px;
}

/* Przycisk koszyka */
.cart-btn {
  justify-self: end;
  margin-left: auto;
  position: relative;
  background: var(--accent);
  color: #000;
  border: 0;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.3s ease, box-shadow 0.3s ease;
  isolation: isolate; /* tworzy nowy kontekst stackingu dla badge */
}

.cart-btn:hover {
  background: var(--accent-light);
  box-shadow: 0 0 10px rgba(212,175,55,.4);
}


/* Kotwica pod badge — nie zmienia wyglądu .btn/.btn-primary */
#openCart{
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Badge z liczbą sztuk (ID) */
#cartCount{
  position: absolute;
  top: -8px;
  right:-8px;
  display: none;                 /* JS ustawia inline-flex gdy count > 0 */
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  line-height: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  background: #e23c3c;          /* czerwony badge */
  color: #fff;                   /* biała cyfra */
  z-index: 1;
}

/* Tekstowa suma obok „Koszyk” (KLASA) */
.cartCount{
  margin-left: 8px;
  font-weight: 700;
  color: #000;                   /* czarny tekst na złotym btn-primary */
}


/* ============================================
   LISTA PRODUKTÓW
   ============================================ */
#list article {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin: 12px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: 0 4px 12px rgba(0,0,0,.6);
}

#list article img {
  display: block;
  aspect-ratio: 1/1;
  object-fit: cover;
  cursor: zoom-in;
}

#list h3 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}

/* Linki w tytułach produktów */
#list h3 a,
#list h3 a:link,
#list h3 a:visited,
#list h3 a:active {
  color: var(--accent) !important;
  text-decoration: none !important;
  transition: color 0.25s ease;
}

#list h3 a:hover,
#list h3 a:focus {
  color: var(--accent-light) !important;
}

#list h3 a:focus-visible {
  outline: 2px solid var(--accent-light) !important;
  outline-offset: 2px;
  border-radius: 4px;
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.product-info .muted {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  word-wrap: break-word;
  hyphens: auto;
  max-width: 100%;
  display: block;
}

.bottom-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.price {
  font-weight: 800;
  margin: 0;
  color: var(--accent);
  font-size: 15px;
}

/* Opis produktu */
article .desc {
  grid-column: 1 / -1;
  margin-top: 10px;
  white-space: pre-line;
}

.desc .muted {
  white-space: pre-line !important;
}

.desc-first {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap !important;
}

.desc-more {
  display: none !important;
  margin-top: 4px;
}

.desc-more.show {
  display: block !important;
}

.desc-toggle {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-weight: 700;
}

.desc-toggle:hover {
  color: var(--accent-light);
  text-decoration: underline;
}

/* ============================================
   KONTROLKI ILOŚCI
   ============================================ */
.qty {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.qty button {
  border: 0;
  background: #1f1b2a;
  color: var(--text);
  padding: 6px 10px;
  cursor: pointer;
}

.qty button:hover {
  background: #2b2440;
}

.qty span {
  min-width: 34px;
  display: inline-block;
  text-align: center;
  padding: 6px 10px;
  background: #0e0d16;
  color: var(--text);
}

/* ============================================
   PRZYCISKI
   ============================================ */
.add-btn,
.btn-primary {
  background: var(--accent);
  color: #000;
  border: 0;
  border-radius: 8px;
  padding: 6px 10px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(212,175,55,0.35);
}

.add-btn:hover,
.btn-primary:hover {
  background: var(--accent-light);
}

.add-btn:active,
.btn-primary:active {
  filter: brightness(1.2);
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.cookie-btn {
  background: var(--accent);
  color: #000;
  border: 0;
  border-radius: 10px;
  padding: 2px 12px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(212,175,55,.35);
}

.cookie-btn:hover {
  background: var(--accent-light);
}

.cookie-btn:active {
  filter: brightness(1.06);
}

/* ============================================
   ODZNAKA PROMO
   ============================================ */
.badge-promo {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(212,175,55,.3);
}

/* ============================================
   OVERLAY I DRAWER (KOSZYK)
   ============================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(90,65,150,0.6);
  opacity: 0;
  pointer-events: none;
  transition: .25s;
  z-index: 1100;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 100vw;
  height: calc(var(--vh) * 100);
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,.6);
  transform: translateX(100%);
  transition: .25s;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

@supports(height: 100dvh) {
  .drawer {
    height: 100dvh;
  }
}

.drawer.open {
  transform: translateX(0);
}

.drawer header {
  position: sticky;
  top: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1;
}

#closeDrawerBtn {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  border: 0;
}

#closeDrawerBtn:hover {
  color: var(--accent);
  background: rgba(255,255,255,.06);
}

#closeDrawerBtn:active {
  transform: scale(0.96);
}

.drawer .content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 16px;
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
}

.drawer .row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 0;
  background: #0e0d16;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.drawer .row > div {
  flex: 1 1 auto;
  min-width: 0;
}

.drawer .row strong {
  color: var(--accent);
  flex-shrink: 0;
  white-space: nowrap;
  min-width: fit-content;
  margin-left: auto;
}

.drawer .qty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-shrink: 0;
}

.drawer .qty span {
  width: 40px;
  text-align: center;
}

.drawer .qty button {
  width: 30px;
  flex-shrink: 0;
}

.drawer .row button[title="Usuń"] {
  flex-shrink: 0;
}

.drawer footer {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 360px;
  max-width: 100vw;
  background: var(--card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -2px 8px rgba(0,0,0,.6);
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 1300;
}

/* ============================================
   LIGHTBOX
   ============================================ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  cursor: zoom-out;
}

.lightbox-overlay.show {
  display: flex;
}

.lightbox-overlay img {
  max-width: 92vw;
  max-height: 90vh;
  border-radius: 12px;
  display: block;
  box-shadow: 0 0 25px rgba(212,175,55,.35);
  animation: zoomIn .25s ease-out;
}

@keyframes zoomIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.lb-figure {
  max-width: 92vw;
  max-height: 80vh;
  margin: 0 56px;
  position: relative;
}

.lb-figure img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  border-radius: 12px;
  box-shadow: 0 0 25px rgba(212,175,55,.35);
  animation: zoomIn .2s ease-out;
}

.lb-caption {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(14,13,22,.8);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  z-index: 1;
}

.lb-prev {
  left: 14px;
}

.lb-next {
  right: 14px;
}

.lb-nav:hover {
  background: rgba(46,42,61,.9);
}

.lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(14,13,22,.8);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.lb-thumbs {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 18px;
  display: flex;
  gap: 8px;
  max-width: 92vw;
  overflow-x: auto;
  padding: 6px 8px;
  background: rgba(14,13,22,.6);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.lb-thumbs button {
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.lb-thumbs img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  display: block;
  border-radius: 6px;
}

.lb-thumbs button.active {
  border-color: var(--accent);
}

.lb-counter {
  position: absolute;
  top: 18px;
  left: 18px;
  background: rgba(14,13,22,.8);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 8px;
  font-weight: 700;
  color: var(--text);
}

/* ============================================
   MODAL CHECKOUT
   ============================================ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
}

.modal.show {
  display: flex;
}

.modal .box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(900px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
}

.modal header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal .content {
  padding: 14px 16px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.modal footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.close-x {
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 26px;
  cursor: pointer;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.table th,
.table td {
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

.table tfoot td {
  font-weight: 800;
}

.row-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ============================================
   FORMULARZ
   ============================================ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 220px;
}

.field input,
.field textarea {
  background: #0e0d16;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
}

.field.invalid input,
.field.invalid textarea {
  border-color: #ff6b6b;
  box-shadow: 0 0 0 3px rgba(255,107,107,.15);
}

.error-msg {
  color: #ff8686;
  font-size: 12px;
  line-height: 1.3;
  margin-top: 4px;
}

.shake {
  animation: shake .28s ease-in-out;
}

@keyframes shake {
  10%, 90% {
    transform: translateX(-1px);
  }
  20%, 80% {
    transform: translateX(2px);
  }
  30%, 50%, 70% {
    transform: translateX(-4px);
  }
  40%, 60% {
    transform: translateX(4px);
  }
}

/* ============================================
   OPCJE DOSTAWY
   ============================================ */
.ship-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ship-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0e0d16;
}

.ship-item label {
  display: flex;
  gap: 10px;
  align-items: center;
  cursor: pointer;
}

.ship-price {
  font-weight: 800;
  color: var(--accent);
  white-space: nowrap;
}

/* ============================================
   TOAST
   ============================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: #1f1b2a;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  z-index: 3000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-6px);
}

/* ============================================
   STOPKA
   ============================================ */
footer.site {
  margin-top: 24px;
  padding: 16px;
  background: #0e0d16;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

footer.site a {
  color: var(--accent);
  text-decoration: none;
}

footer.site a:hover {
  text-decoration: underline;
}

/* ============================================
   RESPONSYWNOŚĆ
   ============================================ */
@media (max-width: 700px) {
  header.top {
    grid-template-columns: 1fr;
    gap: 8px;
    text-align: center;
  }
  
  .back-arrow {
    justify-self: start;
  }
  
  .cart-btn {
    justify-self: end;
  }
  
  .page-title {
    font-size: 26px;
  }
}

@media (max-width: 520px) {
  .lb-figure {
    margin: 0 8px;
  }
  
  .lb-thumbs img {
    width: 48px;
    height: 48px;
  }
}

@media (max-width: 480px) {
  #list article {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
  }
  
  #list h3 {
    font-size: 18px;
  }
  
  #closeDrawerBtn {
    font-size: 36px;
    width: 48px;
    height: 48px;
  }
}

/* ============================================
   NAGŁÓWEK H1
   ============================================ */
h1 {
  display: block;
  font-size: 1em;
  margin-block-start: 0.67em;
  margin-block-end: 0.67em;
  margin-inline-start: 0;
  margin-inline-end: 0;
  font-weight: bold;
}

.TytulSklep {
  font-family: 'Uncial Antiqua', serif;
  font-size: 1.8rem;
  text-align: center;
  color: var(--color-accent);
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(212,175,55,0.35);
  margin: 0;
  line-height: 1.2;
}
.TytulSklep {
  animation: fadeInTitle 1.2s ease-out;
}
@keyframes fadeInTitle {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
