/* ============================================================
   Strawberry 3D Viewer — sb3d-viewer.css
   Brand: #DE2227 | Dark stage: #0c0d11 | RTL / Arabic
   ============================================================ */

/* ---- Stage ------------------------------------------------ */
.sb3d-stage {
  position: relative;
  width: 100%;
  margin: 28px 0;
  background: radial-gradient(ellipse at 50% 38%, #34373f 0%, #1b1d23 48%, #0c0d11 100%);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    inset 0 0 80px rgba(222, 34, 39, 0.06),
    0 6px 40px rgba(0, 0, 0, 0.55);
  direction: rtl;
  font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  color: #fff;
}

/* ---- Brand header strip ---------------------------------- */
.sb3d-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sb3d-header-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #DE2227;
  box-shadow: 0 0 6px #DE2227, 0 0 14px rgba(222, 34, 39, 0.5);
  animation: sb3d-dot-pulse 2.2s ease-in-out infinite;
}

@keyframes sb3d-dot-pulse {
  0%, 100% { box-shadow: 0 0 6px #DE2227, 0 0 14px rgba(222,34,39,.5); }
  50%       { box-shadow: 0 0 10px #DE2227, 0 0 26px rgba(222,34,39,.8); }
}

.sb3d-header-brand {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
}

.sb3d-header-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-right: auto;
}

/* ---- model-viewer element -------------------------------- */
model-viewer {
  display: block;
  width: 100%;
  min-height: 480px;
  background: transparent;
  --poster-color: transparent;
}

/* ---- Viewer wrap + entrance animation ------------------- */
.sb3d-mv-wrap {
  position: relative;
}

/* Stage-level loading bar (above model-viewer) */
.sb3d-stage-loader {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  z-index: 20;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  transition: opacity 0.4s ease;
}

.sb3d-stage-loader-bar {
  height: 100%;
  width: 0%;
  background: #DE2227;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px #DE2227;
}

/* Entrance: model-viewer fades + scales in after 3D loads */
.sb3d-stage.sb3d-loaded model-viewer {
  animation: sb3d-entrance 1.2s cubic-bezier(0.22, 0.68, 0, 1.2) both;
}

@keyframes sb3d-entrance {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}

/* Custom progress bar slot (inside model-viewer shadow DOM boundary) */
.sb3d-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  transition: opacity 0.4s ease 0.5s;
}

.sb3d-progress-bar {
  height: 100%;
  background: #DE2227;
  box-shadow: 0 0 8px #DE2227;
  transition: width 0.3s ease;
}

/* ---- Hotspots ------------------------------------------- */
.sb3d-hotspot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #DE2227;
  border: 2.5px solid #fff;
  cursor: pointer;
  position: relative;
  padding: 0;
  box-shadow: 0 0 0 0 rgba(222, 34, 39, 0.6);
  transition: transform 0.15s ease;
}

.sb3d-hotspot:hover {
  transform: scale(1.15);
}

/* Pulsing halo ring */
.sb3d-hotspot::before {
  content: '';
  position: absolute;
  inset: -7px;
  border-radius: 50%;
  background: rgba(222, 34, 39, 0.35);
  animation: sb3d-halo 1.9s ease-out infinite;
}

/* Second outer ring */
.sb3d-hotspot::after {
  content: '';
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: rgba(222, 34, 39, 0.12);
  animation: sb3d-halo 1.9s ease-out 0.6s infinite;
}

@keyframes sb3d-halo {
  0%   { transform: scale(0.8); opacity: 0.8; }
  100% { transform: scale(1.9); opacity: 0; }
}

/* ---- Interaction hint ------------------------------------ */
.sb3d-hint {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(8, 9, 13, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: rgba(255, 255, 255, 0.88);
  font-size: 12px;
  padding: 8px 18px;
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  direction: rtl;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
}

.sb3d-hint.sb3d-hint-visible {
  animation: sb3d-hint-cycle 6s ease forwards;
}

@keyframes sb3d-hint-cycle {
  0%   { opacity: 0; }
  12%  { opacity: 1; }
  72%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- Feature info panel ---------------------------------- */
.sb3d-panel {
  position: absolute;
  bottom: 24px;
  right: 20px;
  width: min(310px, calc(100% - 32px));
  background: rgba(10, 11, 15, 0.82);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  border: 1px solid rgba(222, 34, 39, 0.28);
  border-radius: 14px;
  padding: 20px 22px 18px;
  direction: rtl;
  text-align: right;
  z-index: 30;
  display: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}

.sb3d-panel.sb3d-panel-open {
  display: block;
  animation: sb3d-panel-in 0.28s cubic-bezier(0.22, 0.68, 0, 1.2);
}

@keyframes sb3d-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.sb3d-panel-close {
  position: absolute;
  top: 10px;
  left: 12px;
  width: 26px;
  height: 26px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 0;
}

.sb3d-panel-close:hover {
  background: rgba(222, 34, 39, 0.4);
}

.sb3d-panel-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: #DE2227;
  letter-spacing: 0.02em;
}

.sb3d-panel-body {
  margin: 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.65;
}

/* ---- Weak-device lazy cover ----------------------------- */
.sb3d-lazy-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: #0c0d11;
  z-index: 40;
}

.sb3d-lazy-cover[hidden] {
  display: none;
}

.sb3d-lazy-cover img {
  max-height: 260px;
  max-width: 80%;
  object-fit: contain;
  opacity: 0.55;
}

/* ---- Bottom control bar ---------------------------------- */
.sb3d-controls {
  display: flex;
  gap: 8px;
  padding: 11px 16px;
  justify-content: center;
  flex-wrap: wrap;
  background: rgba(0, 0, 0, 0.32);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  direction: rtl;
}

/* ---- Buttons (pill) -------------------------------------- */
.sb3d-btn {
  padding: 7px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.1s;
  direction: rtl;
  line-height: 1.4;
  white-space: nowrap;
}

.sb3d-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.38);
}

.sb3d-btn:active {
  transform: scale(0.96);
}

.sb3d-btn-ar {
  background: #DE2227;
  border-color: #DE2227;
  font-weight: 700;
  box-shadow: 0 0 14px rgba(222, 34, 39, 0.4);
}

.sb3d-btn-ar:hover {
  background: #c41f23;
  border-color: #c41f23;
}

.sb3d-btn-load3d {
  background: rgba(222, 34, 39, 0.2);
  border-color: #DE2227;
  font-size: 14px;
  padding: 10px 24px;
}

.sb3d-btn-load3d:hover {
  background: rgba(222, 34, 39, 0.38);
}

/* ---- Responsive ------------------------------------------ */
@media (max-width: 640px) {
  model-viewer {
    min-height: 360px;
  }

  .sb3d-hint {
    font-size: 11px;
    white-space: normal;
    max-width: 260px;
    text-align: center;
  }

  .sb3d-panel {
    bottom: 16px;
    right: 12px;
    left: 12px;
    width: auto;
  }

  .sb3d-controls {
    gap: 6px;
    padding: 9px 10px;
  }

  .sb3d-btn {
    font-size: 12px;
    padding: 6px 14px;
  }
}

@media (max-width: 380px) {
  model-viewer {
    min-height: 300px;
  }
}
