/* ============================================
   Configurador 3D — Custom Styles
   ============================================ */

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Model Viewer ---------- */
model-viewer {
  --poster-color: #F9FAFB;
  width: 100vw;
  height: 100vh;
  display: block;
  outline: none;
}

model-viewer::part(default-ar-button) {
  display: none;
}

/* ---------- Loading Spinner ---------- */
.loader {
  width: 36px;
  height: 36px;
  border: 3px solid #E5E7EB;
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Panel Scroll ---------- */
.panel-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.12) transparent;
}

.panel-scroll::-webkit-scrollbar {
  width: 4px;
}

.panel-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.panel-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.12);
  border-radius: 4px;
}

/* ---------- Bottom Sheet States (mobile) ---------- */
@media (max-width: 1023px) {
  .config-panel {
    max-height: 70vh;
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1);
    touch-action: none; /* prevent body scroll when dragging handle */
  }

  .config-panel .panel-scroll {
    touch-action: pan-y; /* allow normal scrolling inside content */
    -webkit-overflow-scrolling: touch;
  }

  .config-panel.panel-open {
    transform: translateY(0) !important;
  }

  .config-panel.panel-minimized {
    transform: translateY(calc(100% - 56px)) !important;
  }

  #panel-backdrop.opacity-100 {
    opacity: 1;
  }
}

/* ---------- Desktop Panel slide-in ---------- */
@media (min-width: 1024px) {
  .config-panel {
    transform: translateX(0) !important;
    animation: slideInRight 0.6s cubic-bezier(0.32, 0.72, 0, 1) both;
  }

  @keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
  }
}

/* ---------- Swatch ---------- */
.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: border-color 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.swatch.active {
  border-color: #000;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px #000;
}

.swatch-texture {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
}

/* ---------- Animation Buttons ---------- */
.anim-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid #E5E7EB;
  background: #fff;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.anim-btn:hover {
  background: #F3F4F6;
  border-color: #D1D5DB;
}

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

.anim-btn.playing {
  background: #000;
  color: #fff;
  border-color: #000;
}

.anim-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ---------- QR Modal Animation ---------- */
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-modal-in {
  animation: modalIn 0.35s cubic-bezier(0.32, 0.72, 0, 1) both;
}

/* ---------- Fade-out utility ---------- */
.fade-out {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ---------- QR Modal flex when visible ---------- */
#qr-modal.modal-visible {
  display: flex !important;
}
