/* FC27 global UI v7.4 — header, mini-carrello e chat coerenti su tutto il sito */

/*
 * Il tema KLEO assegna z-index elevati al menu del carrello, ma li racchiude
 * nella navbar a z-index 30. Il livello va quindi alzato sull'intera catena
 * dell'header: in questo modo il mini-carrello passa sopra barre contestuali,
 * switch tema e contenuti senza dipendere dalla singola pagina.
 */
body.jf-fc27-surface #header {
  position: relative !important;
  z-index: 200100 !important;
  overflow: visible !important;
}

body.jf-fc27-surface #header > .navbar,
body.jf-fc27-surface #header .sticky-wrapper,
body.jf-fc27-surface #header .kleo-main-header,
body.jf-fc27-surface #header .kleo-main-header > .container,
body.jf-fc27-surface #header .primary-menu,
body.jf-fc27-surface #header .navbar-nav {
  overflow: visible !important;
}

body.jf-fc27-surface #header > .navbar {
  z-index: 200101 !important;
}

body.jf-fc27-surface #header .shop-drop {
  position: relative !important;
  z-index: 200102 !important;
}

body.jf-fc27-surface #header .shop-drop > .kleo-toggle-submenu {
  right: 0 !important;
  left: auto !important;
  z-index: 200103 !important;
  width: min(370px, calc(100vw - 24px)) !important;
  max-width: calc(100vw - 24px) !important;
  padding: 0 !important;
  border: 1px solid var(--jf-line, rgba(82, 242, 202, .28)) !important;
  border-radius: 0 0 20px 20px !important;
  background: var(--jf-surface-solid, #0d1421) !important;
  box-shadow: 0 26px 70px rgba(0, 0, 0, .38), 0 0 34px rgba(82, 242, 202, .12) !important;
}

body.jf-fc27-surface #header .shop-drop > .kleo-toggle-submenu::before {
  right: 16px !important;
  border-color: var(--jf-line, rgba(82, 242, 202, .28)) transparent transparent var(--jf-line, rgba(82, 242, 202, .28)) !important;
  background: var(--jf-surface-solid, #0d1421) !important;
}

body.jf-fc27-surface #header .kleo-minicart {
  overflow: hidden;
  width: 100%;
  border-radius: inherit;
  color: var(--jf-copy, #c5cfdd) !important;
  background: var(--jf-surface-solid, #0d1421) !important;
}

body.jf-fc27-surface #header .minicart-header,
body.jf-fc27-surface #header .minicart-contents,
body.jf-fc27-surface #header .minicart-total-checkout,
body.jf-fc27-surface #header .minicart-buttons {
  color: var(--jf-copy, #c5cfdd) !important;
  border-color: var(--jf-line, rgba(82, 242, 202, .22)) !important;
  background: var(--jf-surface-solid, #0d1421) !important;
}

body.jf-fc27-surface #header .minicart-header {
  padding: 15px 18px !important;
  font-size: 11px !important;
  font-weight: 800;
  letter-spacing: .08em;
}

body.jf-fc27-surface #header .cart-product {
  min-height: 88px;
  padding: 14px 16px !important;
  border-color: var(--jf-line, rgba(82, 242, 202, .22)) !important;
  color: var(--jf-copy, #c5cfdd) !important;
  background: var(--jf-surface-soft, rgba(19, 34, 47, .92)) !important;
}

body.jf-fc27-surface #header .cart-product figure {
  margin-right: 12px !important;
}

body.jf-fc27-surface #header .cart-product-img img {
  width: 60px !important;
  height: 60px !important;
  border: 1px solid var(--jf-line, rgba(82, 242, 202, .28));
  border-radius: 12px;
  object-fit: cover;
}

body.jf-fc27-surface #header .cart-product-details {
  min-width: 0;
  margin: 0 28px 0 74px !important;
}

body.jf-fc27-surface #header .cart-product-title,
body.jf-fc27-surface #header .cart-product-title a {
  display: block;
  overflow: visible !important;
  max-width: 100%;
  color: var(--jf-text, #f7f9ff) !important;
  font-size: 13px !important;
  font-weight: 800;
  line-height: 1.35 !important;
  white-space: normal !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere;
}

body.jf-fc27-surface #header .cart-product-price,
body.jf-fc27-surface #header .cart-product-quantity,
body.jf-fc27-surface #header .quick-view {
  margin-top: 5px;
  color: var(--jf-muted, #93a4b7) !important;
  font-size: 11px !important;
  line-height: 1.35 !important;
}

body.jf-fc27-surface #header .cart-product-price .amount,
body.jf-fc27-surface #header .minicart-total-checkout .amount {
  color: var(--jf-text, #f7f9ff) !important;
  font-weight: 850;
}

body.jf-fc27-surface #header .cart-product .remove {
  top: 14px !important;
  right: 12px !important;
  display: grid !important;
  width: 26px;
  height: 26px;
  padding: 0 !important;
  place-items: center;
  border: 1px solid var(--jf-line, rgba(82, 242, 202, .25));
  border-radius: 9px;
  color: var(--jf-copy, #c5cfdd) !important;
  background: var(--jf-surface, #111c2b) !important;
}

body.jf-fc27-surface #header .cart-product .remove:hover,
body.jf-fc27-surface #header .cart-product .remove:focus-visible {
  border-color: var(--jf-mint, #52f2ca);
  color: var(--jf-text, #f7f9ff) !important;
}

body.jf-fc27-surface #header .minicart-total-checkout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px 0 !important;
  font-size: 12px !important;
  font-weight: 750;
}

body.jf-fc27-surface #header .minicart-buttons {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  padding: 15px 18px 18px !important;
}

body.jf-fc27-surface #header .minicart-buttons a.btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  max-width: none !important;
  margin: 0 !important;
  padding: 9px 12px !important;
  border: 1px solid var(--jf-line, rgba(82, 242, 202, .3)) !important;
  border-radius: 12px !important;
  color: var(--jf-text, #f7f9ff) !important;
  background: var(--jf-surface, #111c2b) !important;
  font-size: 11px !important;
  font-weight: 850;
  line-height: 1.25 !important;
  white-space: normal;
}

body.jf-fc27-surface #header .minicart-buttons a.checkout-button {
  border-color: transparent !important;
  color: #07110f !important;
  background: linear-gradient(135deg, #d8ff38, #52f2ca) !important;
}

body.jf-fc27-surface #header .minicart-buttons a.btn:hover,
body.jf-fc27-surface #header .minicart-buttons a.btn:focus-visible {
  transform: translateY(-1px);
  border-color: var(--jf-mint, #52f2ca) !important;
}

html[data-jf-theme="light"] body.jf-fc27-surface #header .shop-drop > .kleo-toggle-submenu,
html[data-jf-theme="light"] body.jf-fc27-surface #header .shop-drop > .kleo-toggle-submenu::before,
html[data-jf-theme="light"] body.jf-fc27-surface #header .kleo-minicart,
html[data-jf-theme="light"] body.jf-fc27-surface #header .minicart-header,
html[data-jf-theme="light"] body.jf-fc27-surface #header .minicart-contents,
html[data-jf-theme="light"] body.jf-fc27-surface #header .minicart-total-checkout,
html[data-jf-theme="light"] body.jf-fc27-surface #header .minicart-buttons {
  background: #fff !important;
}

html[data-jf-theme="light"] body.jf-fc27-surface #header .cart-product {
  background: #f4faf7 !important;
}

@media (max-width: 991px) {
  body.jf-fc27-surface #header .shop-drop > .kleo-toggle-submenu {
    position: fixed !important;
    top: calc(72px + env(safe-area-inset-top, 0px)) !important;
    right: max(10px, env(safe-area-inset-right, 0px)) !important;
    left: auto !important;
    width: min(370px, calc(100vw - 20px)) !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(100vh - 88px - env(safe-area-inset-top, 0px)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    border-radius: 18px !important;
  }

  body.jf-fc27-surface #header .shop-drop > .kleo-toggle-submenu::before {
    display: none !important;
  }
}

@supports (height: 100dvh) {
  @media (max-width: 991px) {
    body.jf-fc27-surface #header .shop-drop > .kleo-toggle-submenu {
      max-height: calc(100dvh - 88px - env(safe-area-inset-top, 0px)) !important;
    }
  }
}

@media (max-width: 430px) {
  body.jf-fc27-surface #header .minicart-buttons {
    grid-template-columns: 1fr;
  }

  body.jf-fc27-surface #header .quick-view {
    display: none !important;
  }

  body.jf-fc27-surface #header .cart-product {
    min-height: 84px;
    padding: 13px !important;
  }

  body.jf-fc27-surface #header .cart-product-img img {
    width: 56px !important;
    height: 56px !important;
  }

  body.jf-fc27-surface #header .cart-product-details {
    margin-left: 68px !important;
  }
}

body #chat-icon {
  position: fixed !important;
  right: max(14px, env(safe-area-inset-right, 0px)) !important;
  bottom: max(14px, env(safe-area-inset-bottom, 0px)) !important;
  z-index: 1001 !important;
  width: 58px !important;
  height: 58px !important;
}

body #chat-icon a {
  position: relative;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(82, 242, 202, .72);
  border-radius: 18px;
  color: #07110f !important;
  background: linear-gradient(135deg, #d8ff38, #52f2ca);
  box-shadow: 0 14px 38px rgba(0, 0, 0, .25), 0 0 24px rgba(82, 242, 202, .2);
  transition: transform .2s ease, box-shadow .2s ease;
}

body #chat-icon a:hover,
body #chat-icon a:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, .3), 0 0 30px rgba(82, 242, 202, .3);
}

body #chat-icon a:focus-visible {
  outline: 3px solid rgba(82, 242, 202, .62);
  outline-offset: 4px;
}

body #chat-icon img {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

body #chat-icon a::before {
  width: 29px;
  height: 29px;
  content: "";
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='M20.5 11.5a8.3 8.3 0 0 1-8.7 8.2 9.5 9.5 0 0 1-4.6-1.3L3 20l1.4-4.1A8.3 8.3 0 1 1 20.5 11.5Z'/%3E%3Cpath fill='%23000' d='M8 10.6a1.1 1.1 0 1 0 0 2.2 1.1 1.1 0 0 0 0-2.2Zm4 0a1.1 1.1 0 1 0 0 2.2 1.1 1.1 0 0 0 0-2.2Zm4 0a1.1 1.1 0 1 0 0 2.2 1.1 1.1 0 0 0 0-2.2Z'/%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 24 24'%3E%3Cpath fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.8' d='M20.5 11.5a8.3 8.3 0 0 1-8.7 8.2 9.5 9.5 0 0 1-4.6-1.3L3 20l1.4-4.1A8.3 8.3 0 1 1 20.5 11.5Z'/%3E%3Cpath fill='%23000' d='M8 10.6a1.1 1.1 0 1 0 0 2.2 1.1 1.1 0 0 0 0-2.2Zm4 0a1.1 1.1 0 1 0 0 2.2 1.1 1.1 0 0 0 0-2.2Zm4 0a1.1 1.1 0 1 0 0 2.2 1.1 1.1 0 0 0 0-2.2Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

body #chat-icon a::after {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  content: "";
  border: 2px solid #91c52d;
  border-radius: 50%;
  background: #07110f;
}

@media (max-width: 700px) {
  body #chat-icon,
  body #chat-icon a {
    width: 54px !important;
    height: 54px !important;
  }

  body #chat-icon a { border-radius: 17px; }
  body #chat-icon a::before { width: 27px; height: 27px; }
}

@media (prefers-reduced-motion: reduce) {
  body #chat-icon a { transition-duration: .01ms !important; }
}
