/* =============================================
   RAI WooCommerce Image Hotspot Widget CSS
   ============================================= */

/* Wrapper & Image Container */
.rai-wh-wrapper { position: relative; display: block; width: 100%; }
.rai-wh-image-container { position: relative; display: inline-block; width: 100%; line-height: 0; }
.rai-wh-bg-image { width: 100%; height: auto; display: block; }

/* Hotspot Absolute Position */
.rai-wh-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 10;
}

/* Pin Button */
.rai-wh-pin {
  --pin-size: 36px;
  width: var(--pin-size);
  height: var(--pin-size);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.6);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--pin-size) * 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  z-index: 2;
  padding: 0;
  line-height: 1;
}
.rai-wh-pin:hover,
.rai-wh-pin:focus {
  transform: scale(1.15);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  outline: 3px solid rgba(255,255,255,0.8);
}

/* Pulse Animation */
.rai-wh-pin--pulse::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  animation: rai-wh-pulse 1.8s ease-out infinite;
  z-index: -1;
  opacity: 0.5;
}
@keyframes rai-wh-pulse {
  0%   { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* Tooltip Base */
.rai-wh-tooltip {
  position: absolute;
  z-index: 100;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.18);
  max-width: 280px;
  min-width: 180px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #333;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
  will-change: opacity, transform;
}
.rai-wh-tooltip--visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Tooltip Arrow (CSS triangle via ::before) */
.rai-wh-tooltip::before {
  content: '';
  position: absolute;
  width: 0;
  height: 0;
  border: 7px solid transparent;
}

/* Tooltip Position Variants */
.rai-wh-tooltip--top {
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
}
.rai-wh-tooltip--top.rai-wh-tooltip--visible { transform: translateX(-50%) translateY(0); }
.rai-wh-tooltip--top::before {
  top: 100%; left: 50%; transform: translateX(-50%);
  border-top-color: #ffffff;
}

.rai-wh-tooltip--bottom {
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
}
.rai-wh-tooltip--bottom.rai-wh-tooltip--visible { transform: translateX(-50%) translateY(0); }
.rai-wh-tooltip--bottom::before {
  bottom: 100%; left: 50%; transform: translateX(-50%);
  border-bottom-color: #ffffff;
}

.rai-wh-tooltip--left {
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(6px);
}
.rai-wh-tooltip--left.rai-wh-tooltip--visible { transform: translateY(-50%) translateX(0); }
.rai-wh-tooltip--left::before {
  left: 100%; top: 50%; transform: translateY(-50%);
  border-left-color: #ffffff;
}

.rai-wh-tooltip--right {
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(-6px);
}
.rai-wh-tooltip--right.rai-wh-tooltip--visible { transform: translateY(-50%) translateX(0); }
.rai-wh-tooltip--right::before {
  right: 100%; top: 50%; transform: translateY(-50%);
  border-right-color: #ffffff;
}

/* Spinner */
.rai-wh-spinner {
  width: 28px; height: 28px;
  border: 3px solid #f0f0f0;
  border-top-color: #e74c3c;
  border-radius: 50%;
  animation: rai-wh-spin 0.7s linear infinite;
  margin: 20px auto;
}
@keyframes rai-wh-spin { to { transform: rotate(360deg); } }

/* Product Card */
.rai-wh-product-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rai-wh-product-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.rai-wh-product-info { padding: 4px 0 0; }
.rai-wh-product-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 4px;
  line-height: 1.4;
  color: #1a1a1a;
}
.rai-wh-product-price {
  font-size: 14px;
  font-weight: 700;
  color: #e74c3c;
  margin-bottom: 8px;
}
.rai-wh-product-price del {
  color: #999;
  font-weight: 400;
  font-size: 12px;
  margin-right: 4px;
}

/* CTA Button */
.rai-wh-cta-btn {
  display: inline-block;
  padding: 7px 14px;
  background: #e74c3c;
  color: #fff;
  text-decoration: none;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  transition: background 0.2s, transform 0.15s;
  width: 100%;
  box-sizing: border-box;
}
.rai-wh-cta-btn:hover { background: #c0392b; transform: translateY(-1px); color: #fff; }

/* Custom Content Tooltip */
.rai-wh-custom-image { width: 100%; border-radius: 6px; margin-bottom: 8px; }
.rai-wh-custom-text { margin: 0 0 8px; font-size: 13px; color: #555; }

/* Product Search (Editor only) */
.rai-wh-product-search-wrap { margin-top: 6px; }
.rai-wh-product-search {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d5d5d5;
  border-radius: 4px;
  font-size: 12px;
}
.rai-wh-search-results {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-top: none;
  background: #fff;
  border-radius: 0 0 4px 4px;
}
.rai-wh-search-item {
  padding: 6px 8px;
  cursor: pointer;
  font-size: 12px;
  border-bottom: 1px solid #f0f0f0;
}
.rai-wh-search-item:hover { background: #f9f9f9; }

/* Responsive */
@media (max-width: 768px) {
  .rai-wh-tooltip { max-width: 200px; min-width: 150px; }
  .rai-wh-product-thumb { height: 120px; }
}
