/* ============================================================
   Korte — custom product page styles
   Enqueued directly (no SASS pipeline) so cache-busting is
   handled by the theme version in functions.php.
   ============================================================ */

/* Diagnostic: visible in DevTools → :root → --korte-loaded when this file applies */
:root { --korte-loaded: 1; }

/* ── Navbar toggler: custom Korte hamburger ──────────────────────────────────── */
/* Three lines, middle offset right — clean architectural feel */

.navbar-toggler {
  border: none !important;
  box-shadow: none !important;
  padding: 6px 4px;
}
.navbar-toggler:focus { box-shadow: none !important; }

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='16' viewBox='0 0 22 16'%3E%3Cline x1='0' y1='1' x2='22' y2='1' stroke='%231d1d1b' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='5' y1='8' x2='22' y2='8' stroke='%231d1d1b' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='0' y1='15' x2='22' y2='15' stroke='%231d1d1b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  width: 22px;
  height: 16px;
}

/* ── Header dropdown: CSS hover ─────────────────────────────────────────────── */

@media (min-width: 992px) {
  .navbar .dropdown-menu {
    display: block !important;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
    pointer-events: none;
    border: none;
    border-top: 2px solid #d65b23;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    min-width: 200px;
    padding: 8px 0;
    margin-top: 0 !important;
    background: #fff;
  }
  .navbar .dropdown:hover > .dropdown-menu {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0s;
    pointer-events: auto;
  }
  .navbar .dropdown-item {
    padding: 9px 20px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #1d1d1b;
    background: transparent;
    transition: color 0.15s ease;
  }
  .navbar .dropdown-item:hover,
  .navbar .dropdown-item:focus,
  .navbar .dropdown-item.active,
  .navbar .dropdown-item:active {
    background: transparent;
    color: #d65b23;
  }
}

/* ── Custom gallery ──────────────────────────────────────────────────────────── */
/* Replaces WooCommerce Flexslider. The wrapper keeps .woocommerce-product-gallery
   so sd-layout.css sibling selectors (~ .summary) continue to work. */

.korte-gallery {
  display: flex;
  flex-direction: column;
  background: #f3f3f3;
  overflow: hidden;
}

.korte-gallery__main {
  flex: 1;
  min-height: 0;          /* allow flex child to shrink */
  overflow: hidden;
  position: relative;     /* anchor for arrows + absolutely positioned img */
  background: #f3f3f3;
}

/* Absolute fill: always occupies the full container in both axes.
   object-fit: contain then scales to the shorter dimension — no overflow ever.
   !important overrides WooCommerce's .woocommerce img { height: auto } rule. */
.korte-gallery__main-img {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  display: block;
  transition: opacity 0.15s ease;
}

.korte-gallery__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(255,255,255,0.80);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: background 0.15s, opacity 0.15s;
  opacity: 0.85;
}
.korte-gallery__arrow:hover { background: #fff; opacity: 1; }
.korte-gallery__arrow--prev { left: 12px; }
.korte-gallery__arrow--next { right: 12px; }
.korte-gallery__arrow svg   { display: block; }

/* Mobile default: small thumbs */
.korte-gallery__thumbs {
  flex: 0 0 76px;         /* 60px thumb + 16px padding */
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid #e8e3dc;
  background: #f3f3f3;
  overflow-x: auto;
  scrollbar-width: none;
}
.korte-gallery__thumbs::-webkit-scrollbar { display: none; }

.korte-gallery__thumb {
  flex: 0 0 60px;
  height: 60px;
  border: 2px solid transparent;
  background: #f3f3f3;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  transition: border-color 0.15s;
}
.korte-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.korte-gallery__thumb.is-active   { border-color: #d65b23; }
.korte-gallery__thumb:hover:not(.is-active) { border-color: #bbb; }

/* Tablet (≥ 992px): medium thumbs — the "perfect" size zone */
@media (min-width: 992px) {
  .korte-gallery__thumbs {
    flex: 0 0 106px;      /* 90px thumb + 16px padding */
    gap: 8px;
    padding: 8px 16px;
  }
  .korte-gallery__thumb {
    flex: 0 0 90px;
    height: 90px;
  }
}

/* Wide (≥ 1200px): larger thumbs */
@media (min-width: 1200px) {
  .korte-gallery__thumbs {
    flex: 0 0 136px;      /* 120px thumb + 16px padding */
  }
  .korte-gallery__thumb {
    flex: 0 0 120px;
    height: 120px;
  }
}

/* ── Sticky cart bar ─────────────────────────────────────────────────────────── */

.korte-cart-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: stretch;
  height: 54px;
}
.korte-cart-bar__price {
  flex: 0 0 35%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #6b6b6b;
  color: #fff;
  font-size: 16px;
  font-weight: 400;
  padding: 0 16px;
  overflow: hidden;
}
.korte-cart-bar__price .price {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  color: #fff;
  font-size: 16px;
  font-weight: 400;
  width: 100%;
}
.korte-cart-bar__price del { display: none; }
.korte-cart-bar__price ins { text-decoration: none; }
.korte-cart-bar__price .woocommerce-Price-amount,
.korte-cart-bar__price .woocommerce-Price-currencySymbol { color: #fff; }

.korte-cart-bar__qty {
  flex: 0 0 120px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #EC671A;
  padding: 0 14px;
}
.korte-cart-bar__qty .qty-btn {
  cursor: pointer;
  user-select: none;
  font-size: 22px;
  color: #fff;
  height: 54px;
  display: flex;
  align-items: center;
  padding: 0 4px;
  transition: opacity 0.15s;
}
.korte-cart-bar__qty .qty-btn:hover { opacity: 0.7; }
.korte-cart-bar__qty .qty-val {
  color: #fff;
  font-size: 18px;
  font-weight: 500;
  min-width: 20px;
  text-align: center;
}
.korte-cart-bar__btn {
  flex: 1;
  background: #3d3d3d;
  color: #fff;
  border: none;
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.korte-cart-bar__btn:hover:not(:disabled) { background: #555; }
.korte-cart-bar__btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Hide native WC qty/button — proxy controls handle UX ────────────────────── */
/* NOTE: no space before .single-product — it is a body class, not a child element */

body:not(.sd-konfigurator-active).single-product form.cart .quantity,
body:not(.sd-konfigurator-active).single-product form.cart .single_add_to_cart_button,
body:not(.sd-konfigurator-active).single-product form.cart .woocommerce-variation-add-to-cart {
  display: none !important;
}

/* ── Single product: shared chrome hides ─────────────────────────────────────── */

body.single-product .woocommerce-notices-wrapper { display: none !important; }
body.single-product .woocommerce-tabs            { display: none !important; }
body.single-product .related.products            { display: none !important; }
body.single-product .onsale                      { display: none !important; }

/* ── Breadcrumbs ─────────────────────────────────────────────────────────────── */
/* Hide standard WooCommerce breadcrumb (uses "/" separator, rendered before gallery) */
body.single-product .woocommerce-breadcrumb,
body.single-product nav.woocommerce-breadcrumb {
  display: none !important;
}

/* Keep theme/Bootstrap breadcrumb ("-" separator, inside summary) aligned with title */
body.single-product ol.breadcrumb,
body.single-product .breadcrumb:not(.woocommerce-breadcrumb) {
  padding-left: 20px !important;
  margin-bottom: 0.5em;
}

/* ── SKU below title ─────────────────────────────────────────────────────────── */

body.single-product .sku_wrapper {
  display: block;
  font-size: 12px;
  color: #999;
  letter-spacing: 0.04em;
  margin: 2px 0 18px;
}
body.single-product .sku_wrapper .sku { font-weight: 500; }

/* ── Price hidden from summary flow (shown in cart bar) ─────────────────────── */

body:not(.sd-konfigurator-active).single-product .summary .price,
body:not(.sd-konfigurator-active).single-product .entry-summary .price {
  display: none !important;
}

/* ── Product title ───────────────────────────────────────────────────────────── */

body.single-product h1.product_title {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  line-height: 1.2;
  margin-bottom: 0.25em;
  padding-left: 20px;
}

/* SD configure mode: title is visible, add padding so it isn't flush to the top */
body.sd-konfigurator-active.single-product h1.product_title {
  padding: 16px 20px 8px;
  margin-bottom: 0;
}

/* ── Product meta ────────────────────────────────────────────────────────────── */

body.single-product .product_meta { font-size: 13px; color: #888; }
body.single-product .product_meta .posted_in,
body.single-product .product_meta .tagged_as { display: none; }

/* ── Single column below 992px — override WooCommerce's 768px float layout ─── */
/* WooCommerce floats gallery + summary at ~48% from 768px up; our flex kicks in
   at 992px. Without this block there is a 768–991px gap where summary stays 50%. */

@media (max-width: 991px) {
  body:not(.sd-konfigurator-active).single-product .korte-gallery,
  body:not(.sd-konfigurator-active).single-product .summary,
  body:not(.sd-konfigurator-active).single-product .entry-summary {
    float: none !important;
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    height: auto !important;
  }

  /* Main image area needs an explicit height on mobile — the absolutely-positioned
     img contributes no layout height so the parent collapses without this. */
  body:not(.sd-konfigurator-active).single-product .korte-gallery__main {
    aspect-ratio: 4 / 3;
  }

  /* Summary: add horizontal padding so content doesn't touch screen edges */
  body:not(.sd-konfigurator-active).single-product .summary,
  body:not(.sd-konfigurator-active).single-product .entry-summary {
    padding: 16px 20px 0;
  }
}

/* ── Side-by-side layout — regular products, ≥992px ─────────────────────────── */

@media (min-width: 992px) {
  body:not(.sd-konfigurator-active).single-product div.product {
    display: flex !important;
    align-items: flex-start !important;
    flex-wrap: nowrap !important;
  }

  /* Gallery column — medium screens and tablets: full height */
  body:not(.sd-konfigurator-active).single-product .korte-gallery {
    float: none !important;
    flex: 0 0 50% !important;
    width: 50% !important;
    max-width: 50% !important;
    height: calc(100vh - 110px);
  }

  /* Summary column — matches gallery height */
  body:not(.sd-konfigurator-active).single-product .summary,
  body:not(.sd-konfigurator-active).single-product .entry-summary {
    float: none !important;
    flex: 0 0 50% !important;
    width: 50% !important;
    max-width: 50% !important;
    height: calc(100vh - 110px);
    overflow-y: auto;
    scrollbar-width: none;
    padding: 30px;
    margin-bottom: 0 !important;
  }
  body:not(.sd-konfigurator-active).single-product .summary::-webkit-scrollbar,
  body:not(.sd-konfigurator-active).single-product .entry-summary::-webkit-scrollbar {
    display: none;
  }
}

/* Wide screens: reduce gallery height to 80vh so it doesn't fill the entire viewport */
@media (min-width: 1200px) {
  body:not(.sd-konfigurator-active).single-product .korte-gallery {
    height: 80vh;
  }
  body:not(.sd-konfigurator-active).single-product .summary,
  body:not(.sd-konfigurator-active).single-product .entry-summary {
    height: 80vh;
  }
}

/* ── SD configure mode ───────────────────────────────────────────────────────── */
/* Breadcrumb spacing for configurable products */
body.sd-konfigurator-active .custom-breadcrumbs {
  padding-top: 10px;
  padding-left: 10px;
}
/* Title is visible — sd-layout.css handles the column split and height.
   We only add theme-specific hides here. */

body.sd-konfigurator-active.single-product .woocommerce-product-details__short-description { display: none !important; }
body.sd-konfigurator-active.single-product .product_meta                                  { display: none !important; }

body.sd-konfigurator-active.woocommerce div.product,
body.sd-konfigurator-active.woocommerce-page div.product {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: flex-start !important;
}

body.sd-konfigurator-active .woocommerce-product-gallery,
body.sd-konfigurator-active .woocommerce-product-gallery ~ .summary,
body.sd-konfigurator-active .woocommerce-product-gallery ~ .entry-summary {
  float: none !important;
}

/* ── Side-menu accordion ─────────────────────────────────────────────────────── */

.side-menu ul ul {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}
.side-menu li.is-open > ul { max-height: 600px; }
.side-menu a { cursor: pointer; }

/* ── Product tabs (storefront) ───────────────────────────────────────────────── */

.korte-ptabs { margin-top: 20px; margin-bottom: 30px; }

.korte-ptabs__nav {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid #e8e3dc;
  margin-bottom: 0;
}
.korte-ptabs__btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #aaa;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.korte-ptabs__btn.is-active {
  color: #1d1d1b;
  border-bottom-color: #d65b23;
}
.korte-ptabs__btn:hover:not(.is-active) { color: #555; }

.korte-ptabs__panels { padding-top: 14px; }

.korte-ptabs__panel { display: none; }
.korte-ptabs__panel.is-active {
  display: block;
  animation: korte-fade-in 0.2s ease;
}

.korte-ptabs__dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}
.korte-ptabs__dl dt {
  padding: 8px 16px 8px 0;
  border-bottom: 1px solid #f0ece7;
  color: #888;
  font-weight: 500;
  margin: 0;
}
.korte-ptabs__dl dd {
  padding: 8px 0;
  border-bottom: 1px solid #f0ece7;
  margin: 0;
  color: #1d1d1b;
}
.korte-ptabs__dl dd p { margin: 0 0 4px; }
.korte-ptabs__dl dd p:last-child { margin-bottom: 0; }
.korte-ptabs__dl dd a { color: #d65b23; text-decoration: underline; }
.korte-ptabs__dl dd ul,
.korte-ptabs__dl dd ol { margin: 4px 0 4px 16px; padding: 0; }
.korte-ptabs__dl dd.korte-ptabs__dd--full { grid-column: 1 / -1; }
.korte-ptabs__dl dt:last-of-type,
.korte-ptabs__dl dd:last-child { border-bottom: none; }

@keyframes korte-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Mobile nav: slide-in drawer ─────────────────────────────────────────────── */

/* Drawer header and backdrop are mobile-only */
.korte-nav-header { display: none; }

/* Backdrop */
.korte-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1054;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.korte-nav-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

@media (max-width: 991px) {
  /* Force the collapse to always exist in the DOM — we use transform/visibility
     for show/hide instead of Bootstrap's height animation. */
  .navbar .navbar-collapse {
    display: block !important;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(300px, 85vw);
    height: 100% !important;           /* override Bootstrap's 0 */
    overflow-y: auto !important;       /* override Bootstrap's hidden */
    background: #1d1d1b;
    z-index: 1055;
    transform: translateX(110%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0s linear 0.3s;
    padding: 0;
  }

  /* Kill Bootstrap's own height transition while keeping ours */
  .navbar .navbar-collapse.collapsing {
    height: 100% !important;
    overflow-y: auto !important;
    transition: none !important;
  }

  .navbar .navbar-collapse.show {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Drawer header — visible only inside the mobile drawer */
  .korte-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  }
  .korte-nav-header__brand {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    line-height: 1;
  }
  .korte-nav-header__brand span {
    color: #d65b23;          /* the orange dot */
  }

  /* Close button */
  .korte-nav-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 22px;
    line-height: 1;
    padding: 4px;
    cursor: pointer;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .korte-nav-close:hover { color: #fff; }

  /* Nav list */
  .navbar .navbar-collapse .navbar-nav {
    flex-direction: column !important;
    padding: 8px 0 24px;
    margin: 0 !important;
  }

  /* Top-level nav links */
  .navbar .navbar-collapse .nav-item > .nav-link,
  .navbar .navbar-collapse .nav-item > a:not(.dropdown-item) {
    display: block;
    padding: 13px 24px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 0.12em !important;
    text-transform: uppercase !important;
    color: rgba(255, 255, 255, 0.85) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    transition: color 0.15s, background 0.15s;
  }
  .navbar .navbar-collapse .nav-item > .nav-link:hover,
  .navbar .navbar-collapse .nav-item > .nav-link:focus,
  .navbar .navbar-collapse .nav-item > a:not(.dropdown-item):hover {
    color: #d65b23 !important;
    background: rgba(255, 255, 255, 0.04);
  }

  /* Dropdown menus inside drawer */
  .navbar .navbar-collapse .dropdown-menu {
    position: static !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    transform: none !important;
    border-radius: 0 !important;
    min-width: 0 !important;
  }
  .navbar .navbar-collapse .dropdown-item {
    padding: 10px 24px 10px 36px !important;
    font-size: 11px !important;
    font-weight: 400 !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;
    color: rgba(255, 255, 255, 0.5) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: transparent !important;
    transition: color 0.15s;
  }
  .navbar .navbar-collapse .dropdown-item:hover,
  .navbar .navbar-collapse .dropdown-item:focus {
    color: #d65b23 !important;
    background: rgba(255, 255, 255, 0.04) !important;
  }

  /* Dropdown caret — hide on mobile (all sub-items always visible) */
  .navbar .navbar-collapse .dropdown-toggle::after { display: none; }

  /* ── Icons row: cart, account, language switcher ──────────────────────────── */

  /* Any link not already handled by nav-link / dropdown-item rules */
  .navbar .navbar-collapse a:not(.nav-link):not(.dropdown-item):not(.korte-nav-header__brand),
  .navbar .navbar-collapse button:not(.korte-nav-close):not(.dropdown-toggle) {
    color: rgba(255, 255, 255, 0.75) !important;
  }
  .navbar .navbar-collapse a:not(.nav-link):not(.dropdown-item):not(.korte-nav-header__brand):hover {
    color: #fff !important;
  }

  /* Profile + cart icons are <img> tags — invert to white via filter */
  .navbar .navbar-collapse img {
    filter: brightness(0) invert(1);
    opacity: 0.75;
    transition: opacity 0.15s;
  }
  .navbar .navbar-collapse a:hover img { opacity: 1; }

  /* Polylang language switcher: native <select> inside .lang-switch */
  .navbar .navbar-collapse .lang-switch {
    display: block;
    padding: 12px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }
  .navbar .navbar-collapse .lang-switch .pll-switcher-select {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: rgba(255, 255, 255, 0.75);
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    border-radius: 2px;
    width: auto;
  }
  .navbar .navbar-collapse .lang-switch .pll-switcher-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
  }

  /* Footer strip: lang + icons */
  .navbar .navbar-collapse .korte-nav-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.10);
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 20px;
  }
  .navbar .navbar-collapse .korte-nav-footer a,
  .navbar .navbar-collapse .korte-nav-footer button,
  .navbar .navbar-collapse .korte-nav-footer span {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.15s;
  }
  .navbar .navbar-collapse .korte-nav-footer a:hover { color: #fff !important; }
}
