/**
 * PrestaHU
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Commercial License
 * you can't distribute, modify or sell this code
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file
 * If you need help please contact info@presta.hu
 *
 * @author    PrestaHU <info@presta.hu>
 * @copyright PrestaHU
 * @license   commercial
 */

/* Fonts, headings and buttons come from the theme; the module draws only the picture, the points and the bubble. */
.pshuhotspot {
  --pshuhotspot-dur: 200ms;
  --pshuhotspot-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pshuhotspot-point: 28px;
  --pshuhotspot-hit: 44px;
  --pshuhotspot-bg: var(--bs-body-bg, #fff);
  --pshuhotspot-fg: var(--bs-body-color, #1a1a1a);
  --pshuhotspot-error: var(--bs-danger, rgb(176, 0, 32));
  --pshuhotspot-muted: #5c5c5c;
  --pshuhotspot-line: rgba(0, 0, 0, 0.12);
  margin: 0 0 2rem;
  clear: both;
}
.pshuhotspot--size-s { --pshuhotspot-point: 22px; }
.pshuhotspot--size-l { --pshuhotspot-point: 36px; }
.pshuhotspot--bubble-dark {
  --pshuhotspot-bg: #1f1f1f;
  --pshuhotspot-fg: #fff;
  --pshuhotspot-muted: #cfcfcf;
  --pshuhotspot-line: rgba(255, 255, 255, 0.16);
}
.pshuhotspot__title { margin-bottom: 1rem; }

.pshuhotspot__stage {
  position: relative;
  line-height: 0;
}
.pshuhotspot__img {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

/* The button is the touch area (44 px); the visible dot sits in its middle. */
.pshuhotspot__point {
  position: absolute;
  width: var(--pshuhotspot-hit);
  height: var(--pshuhotspot-hit);
  margin: calc(var(--pshuhotspot-hit) / -2) 0 0 calc(var(--pshuhotspot-hit) / -2);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 2;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.pshuhotspot__dot {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--pshuhotspot-point);
  height: var(--pshuhotspot-point);
  margin: calc(var(--pshuhotspot-point) / -2) 0 0 calc(var(--pshuhotspot-point) / -2);
  border-radius: 50%;
  background: var(--pshuhotspot-color);
  color: white;
  font-size: calc(var(--pshuhotspot-point) * 0.5);
  font-weight: 700;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85), 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: transform var(--pshuhotspot-dur) var(--pshuhotspot-ease);
}
.pshuhotspot--shape-plus .pshuhotspot__dot { font-size: calc(var(--pshuhotspot-point) * 0.75); font-weight: 400; }
.pshuhotspot--shape-dot .pshuhotspot__dot::after {
  content: "";
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: white;
}
.pshuhotspot__point:hover .pshuhotspot__dot,
.pshuhotspot__point.is-active .pshuhotspot__dot,
.pshuhotspot__point.is-linked .pshuhotspot__dot { transform: scale(1.18); }
.pshuhotspot__point:focus { outline: none; }
.pshuhotspot__point:focus-visible .pshuhotspot__dot {
  outline: 3px solid var(--pshuhotspot-fg);
  outline-offset: 4px;
}

.pshuhotspot__bubble {
  position: absolute;
  z-index: 5;
  width: 280px;
  max-width: calc(100% - 16px);
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  line-height: 1.4;
  text-align: left;
  color: var(--pshuhotspot-fg);
  background: var(--pshuhotspot-bg);
  border: 1px solid var(--pshuhotspot-line);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity var(--pshuhotspot-dur) var(--pshuhotspot-ease), transform var(--pshuhotspot-dur) var(--pshuhotspot-ease);
}
.pshuhotspot__bubble[hidden] { display: none; }
.pshuhotspot__bubble.is-open { opacity: 1; transform: none; }
.pshuhotspot__close {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--pshuhotspot-muted);
  font-size: 22px;
  line-height: 36px;
  cursor: pointer;
}
.pshuhotspot__close:focus-visible { outline: 2px solid var(--pshuhotspot-fg); outline-offset: -4px; }
.pshuhotspot__bimg {
  flex: 0 0 auto;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  background: color-mix(in srgb, currentColor 6%, transparent);
}
.pshuhotspot__bimg--manufacturer { object-fit: contain; background: var(--pshuhotspot-bg); }
.pshuhotspot__bbody { flex: 1 1 auto; min-width: 0; padding-right: 22px; }
.pshuhotspot__bname { margin: 0 0 4px; font-weight: 600; color: inherit; overflow-wrap: anywhere; }
.pshuhotspot__price { margin: 0 0 4px; }
.pshuhotspot__regular { margin-right: 6px; color: var(--pshuhotspot-muted); font-size: 0.9em; }
.pshuhotspot__current { font-weight: 700; }
.pshuhotspot__avail { margin: 0 0 8px; font-size: 0.875em; color: var(--pshuhotspot-muted); }
.pshuhotspot__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pshuhotspot__actions .btn { margin: 0; white-space: normal; }
.pshuhotspot__msg { margin: 6px 0 0; font-size: 0.875em; }
.pshuhotspot__msg:empty { display: none; }
.pshuhotspot__msg.is-error { color: var(--pshuhotspot-error); }
.pshuhotspot--bubble-dark .pshuhotspot__msg.is-error { color: rgb(255, 138, 138); }
.pshuhotspot__cart[aria-busy="true"] { opacity: 0.6; pointer-events: none; }

.pshuhotspot__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.pshuhotspot__card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 8px 10px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: border-color var(--pshuhotspot-dur) var(--pshuhotspot-ease), transform var(--pshuhotspot-dur) var(--pshuhotspot-ease);
}
.pshuhotspot__card:hover,
.pshuhotspot__card:focus-visible,
.pshuhotspot__item.is-linked .pshuhotspot__card { border-color: var(--pshuhotspot-color); text-decoration: none; }
.pshuhotspot__num {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--pshuhotspot-color);
  color: white;
  font-size: 13px;
  font-weight: 700;
}
.pshuhotspot__cimg { flex: 0 0 auto; width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }
/* Name and price stack in one column: a narrow card breaks the name between words, never inside them. */
.pshuhotspot__ctext { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; line-height: 1.3; }
.pshuhotspot__cname { overflow-wrap: break-word; hyphens: auto; }
.pshuhotspot__cprice { font-weight: 600; white-space: nowrap; }

/* Phones: the bubble opens as a sheet at the bottom of the screen. */
@media (max-width: 767px) {
  .pshuhotspot { --pshuhotspot-point: 26px; }
  .pshuhotspot--size-s { --pshuhotspot-point: 22px; }
  .pshuhotspot--size-l { --pshuhotspot-point: 32px; }
  .pshuhotspot__bubble {
    position: fixed;
    left: 0 !important;
    right: 0;
    bottom: 0;
    top: auto !important;
    width: auto;
    max-width: none;
    max-height: 70vh;
    overflow-y: auto;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    border-radius: 14px 14px 0 0;
    z-index: 1050;
    transform: translateY(24px);
  }
  .pshuhotspot__list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .pshuhotspot__dot,
  .pshuhotspot__bubble,
  .pshuhotspot__card { transition: none; }
}
