/* ================================================================
   Karacter Product Gallery — gallery.css
   ================================================================ */

/* ── Container ── */
.krc-gallery {
  position: relative;
}

/* Imaginea mare sus, banda de miniaturi dedesubt.
   Ordinea în DOM e inversă (miniaturile sunt primele în .tpl, ca să fie
   accesibile la tab înaintea imaginii) — o inversăm vizual cu `order`. */
.krc-gallery-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

/* ── Banda de miniaturi (sub imagine) ── */
.krc-thumbs-col {
  order: 2;
  display: flex;
  flex-direction: row;
  align-items: center;
  max-width: 100%;
  gap: 4px;
}

.krc-thumbs-nav {
  background: none;
  border: 1px solid white;
  border-radius: 4px;
  width: 28px;
  height: 72px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

/* Săgețile din SVG sunt deja stânga/dreapta („M6 1L1 6l5 5" / „M6 1l5 5-5 5").
   În layout-ul vertical erau rotite 90°; pe orizontală se folosesc ca atare. */
.krc-thumbs-nav svg{
    fill:none
}

/* Ambele săgeți dezactivate = nu e nimic de derulat. Pe verticală stăteau
   discret deasupra și dedesubt; pe orizontală, două săgeți gri care încadrează
   două miniaturi arată prost. */
.krc-thumbs-col:has(.krc-thumbs-prev:disabled):has(.krc-thumbs-next:disabled) .krc-thumbs-nav {
  display: none;
}
.krc-thumbs-nav:disabled {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}
.krc-thumbs-nav:not(:disabled):hover {
    background: rgb(255, 255, 255, .9);
    box-shadow: 0 2px 10px -2px rgb(102, 102, 102, .15);
    border: 1px solid rgb(102, 102, 102, .1);
}

/* `max-width` fără `width`: fiind element flex cu flex-basis:auto, viewport-ul
   se dimensionează după conținut și se oprește la plafon. Efect — cu 2-3
   miniaturi banda e exact cât ele și rămâne centrată sub imagine; cu 9
   miniaturi se taie la 5 și derulează.
   Un `width: 384px` fix ar fi lăsat miniaturile puține lipite în stânga
   unei cutii goale de 384px. */
.krc-thumbs-viewport {
  overflow: hidden;
  /* 5 miniaturi × 72px + 4 spații × 6px = 384px */
  max-width: 384px;
  height: 72px;
}

.krc-thumbs-track {
  display: flex;
  flex-direction: row;
  gap: 6px;
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
}

.krc-thumb {
  width: 72px;
  height: 72px;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s;
  background: #f9f9f9;
  outline: none;
}
.krc-thumb:focus-visible {
  border-color: #213946;
  box-shadow: 0 0 0 2px rgba(33,57,70,0.3);
}
.krc-thumb:hover,
.krc-thumb.active {
  border-color: #213946;
}
.krc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ── Imaginea principală ── */
.krc-main-col {
  order: 1;
  width: 100%;
  min-width: 0;
}

.krc-main-wrap {
  position: relative;
  cursor: zoom-in;
  background: #fafafa;
  border-radius: 6px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  border: 1px solid #f0f0f0;
  outline: none;
}
.krc-main-wrap:focus-visible {
  box-shadow: 0 0 0 2px rgba(33,57,70,0.3);
}

.krc-main-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transition: opacity 0.18s ease;
}

.krc-zoom-icon {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #213946;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.krc-zoom-icon svg{
    fill:none
}
/* ── Mobile dots ── */
.krc-dots {
  display: none;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.krc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
  flex-shrink: 0;
}
.krc-dot.active {
  background: #213946;
  transform: scale(1.25);
}

/* ── Responsive: mobile ── */
@media (max-width: 991px) {
  .krc-gallery-inner {
    flex-direction: column;
  }
  .krc-thumbs-col {
    display: none;
  }
  .krc-dots {
    display: flex;
  }
  .krc-main-col {
    width: 100%;
  }
  .krc-main-wrap {
    border-radius: 4px;
  }
}

/* ================================================================
   Lightbox
   ================================================================ */

/* Overlay */
.krc-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 10998;
}
.krc-lightbox-overlay[hidden] { display: none; }

/* Lightbox wrapper — centers the modal */
.krc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.krc-lightbox[hidden] { display: none; }

/* Modal box */
.krc-lb-modal {
  position: relative;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 1060px;
  height: 85vh;
  max-height: 820px;
  overflow: hidden;
}

/* Close button */
.krc-lb-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: rgba(0,0,0,0.06);
  border: none;
  color: #333;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  z-index: 20;
  padding: 4px 10px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.krc-lb-close:hover { background: rgba(0,0,0,0.14); }

/* Main wrapper — fills modal, leaves room for sidebar on left */
.krc-lb-main {
  position: absolute;
  inset: 0;
  left: 0; /* sidebar width */
  display: flex;
  flex-direction: column;
}

/* Sidebar — absolute left column on desktop */
.krc-lb-sidebar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 112px;
  background: #f7f7f7;
  border-right: 1px solid #e8e8e8;
  overflow-y: auto;
  padding: 10px 8px;
  scrollbar-width: thin;
  scrollbar-color: #ccc transparent;
  z-index: 1;
}
.krc-lb-sidebar::-webkit-scrollbar { width: 4px; }
.krc-lb-sidebar::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.krc-lb-thumbs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.krc-lb-thumb {
  width: 92px;
  height: 92px;
  border: 2px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 0.15s;
  background: #fff;
}
.krc-lb-thumb.active,
.krc-lb-thumb:hover { border-color: #213946; }
.krc-lb-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Image row */
.krc-lb-body {
  flex: 1;
  position: relative;
  min-height: 0;
  background: #fff;
}

/* Arrows — positioned over the image */
.krc-lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 1px solid transparent;
  color: #444;
  width: 44px;
  height: 60px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  z-index: 5;
  
  transition: background 0.15s, border-color 0.15s;
}
.krc-lb-arrow:hover { 
    background: #fff; 
    border-color: #bbb; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.krc-lb-arrow svg{fill:none}
.krc-lb-prev { left: 120px; }
.krc-lb-next { right: 10px; }
.krc-lb-arrow:disabled { opacity: 0.2; cursor: default; pointer-events: none; }

/* Image wrap — zoom container */
.krc-lb-img-wrap {
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: absolute;
  inset: 0;
  cursor: zoom-in;
  user-select: none;
  -webkit-user-select: none;
}
.krc-lb-img-wrap.is-zoomed { cursor: grab; }
.krc-lb-img-wrap.is-dragging { cursor: grabbing !important; }

.krc-lb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  transform-origin: 0 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
  will-change: transform;
  -webkit-user-drag: none;
}

/* Footer */
.krc-lb-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 16px;
  border-top: 1px solid #eee;
  background: #fff;
}

/* Add to cart — aceeași înfățișare ca butoanele din site (.pm-btn din custom.css) */
.krc-lb-add-cart {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    min-height: 46px;
    padding: 6px 22px;
    border: none;
    border-radius: 0;
    background: #E50F1E;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .25s ease;
}
.krc-lb-add-cart:hover,
.krc-lb-add-cart:focus {
    background: #C30D1A;
    color: #fff;
}
.krc-lb-add-cart[hidden] {
    display: none;
}
/* SVG-ul portocaliu din template e înlocuit de iconița comună (mask) */
.krc-lb-add-cart svg {
    display: none;
}
.krc-lb-add-cart::before {
    content: "";
    flex: 0 0 auto;
    width: 21px;
    height: 21px;
    background-color: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cpath fill='black' d='M0-16l116 0c2.1 11.7 5 27.7 8.7 48L576 32c-1 5.3-17 90.7-48 256l-356.7 0 8.7 48 316 0 0 48-356 0-3.6-19.7-60.4-332.3-76 0 0-48zM162.6 240l325.6 0 30-160-384.7 0 29.1 160zM208 416a48 48 0 1 1 0 96 48 48 0 1 1 0-96zm224 0a48 48 0 1 1 0 96 48 48 0 1 1 0-96z'/%3E%3C/svg%3E") center / contain no-repeat;
            mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 640 512'%3E%3Cpath fill='black' d='M0-16l116 0c2.1 11.7 5 27.7 8.7 48L576 32c-1 5.3-17 90.7-48 256l-356.7 0 8.7 48 316 0 0 48-356 0-3.6-19.7-60.4-332.3-76 0 0-48zM162.6 240l325.6 0 30-160-384.7 0 29.1 160zM208 416a48 48 0 1 1 0 96 48 48 0 1 1 0-96zm224 0a48 48 0 1 1 0 96 48 48 0 1 1 0-96z'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* ── Mobile lightbox ── */
@media (max-width: 767px) {
  .krc-lightbox { padding: 12px; }

  .krc-lb-modal {
    height: 88vh;
    max-height: 88vh;
    border-radius: 6px;
  }

  /* Main: no left offset (no sidebar column) */
  .krc-lb-main { left: 0; }
  .krc-lb-prev{left:10px;}
  /* Sidebar becomes a horizontal strip at the bottom */
  .krc-lb-sidebar {
    position: relative;
    left: auto; top: auto; bottom: auto;
    width: 100%;
    height: 82px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 8px 0;
    border-right: none;
    border-top: 1px solid #e8e8e8;
  }

  .krc-lb-thumbs {
    flex-direction: row;
    gap: 6px;
  }

  .krc-lb-thumb {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
  }

  .krc-lb-body { flex: 1; }

  .krc-lb-arrow {
    width: 36px;
    height: 46px;
  }

  .krc-lb-footer { padding: 8px 12px; }
  .krc-lb-add-cart {
    font-size: 13px;
    min-height: 40px;
    padding: 5px 14px;
    width: 100%;
    justify-content: center;
  }
  .krc-lb-add-cart::before {
    width: 18px;
    height: 18px;
  }
}
