/**
 * tienda-3d.css — Three.js 3D Viewer Customization
 */

/* ====================================================================== */
/* 3D VIEWER CONTAINER */
/* ====================================================================== */

#viewer-3d {
  width: 100%;
  height: 350px;
  background-color: #243847;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid var(--tienda-border);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

/* ====================================================================== */
/* 3D BADGE */
/* ====================================================================== */

.tienda-3d-interactive-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background-color: var(--tienda-accent);
  color: #000;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 212, 255, 0.3);
}

/* ====================================================================== */
/* CANVAS RESPONSIVE */
/* ====================================================================== */

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ====================================================================== */
/* 3D CONTROLS HINT */
/* ====================================================================== */

.tienda-3d-hint {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background-color: rgba(0, 0, 0, 0.7);
  color: var(--tienda-accent);
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.75rem;
  pointer-events: none;
  animation: fadeInUp 0.5s ease-out;
  border: 1px solid var(--tienda-accent);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ====================================================================== */
/* MOBILE 3D ADJUSTMENTS */
/* ====================================================================== */

@media (max-width: 640px) {
  #viewer-3d {
    height: 280px;
  }

  .tienda-3d-interactive-badge {
    padding: 0.35rem 0.65rem;
    font-size: 0.7rem;
  }

  .tienda-3d-hint {
    font-size: 0.7rem;
    padding: 0.4rem 0.65rem;
  }
}

/* ====================================================================== */
/* LOADING STATE */
/* ====================================================================== */

.tienda-3d-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #243847;
  z-index: 50;
  gap: 0.75rem;
  color: var(--tienda-accent);
  font-size: 0.9rem;
}

.tienda-3d-loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(0, 212, 255, 0.3);
  border-top-color: var(--tienda-accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ====================================================================== */
/* ERROR STATE */
/* ====================================================================== */

.tienda-3d-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #243847;
  z-index: 50;
  color: var(--tienda-danger);
  font-size: 0.95rem;
  text-align: center;
  padding: 2rem;
  gap: 1rem;
}

.tienda-3d-error-icon {
  font-size: 3rem;
}

/* ====================================================================== */
/* TEXTURE PREVIEW */
/* ====================================================================== */

.tienda-3d-texture-preview {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.tienda-3d-texture-option {
  width: 60px;
  height: 60px;
  border: 2px solid var(--tienda-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
  background-color: var(--tienda-hover-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.tienda-3d-texture-option:hover {
  border-color: var(--tienda-accent);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

.tienda-3d-texture-option.active {
  border-color: var(--tienda-accent);
  background-color: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.4);
}

.tienda-3d-texture-option img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ====================================================================== */
/* QUALITY SELECTOR */
/* ====================================================================== */

.tienda-3d-quality-selector {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  align-items: center;
}

.tienda-3d-quality-label {
  color: var(--tienda-text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.tienda-3d-quality-btn {
  padding: 0.35rem 0.75rem;
  background-color: transparent;
  border: 1px solid var(--tienda-border);
  color: var(--tienda-text-muted);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tienda-3d-quality-btn:hover {
  border-color: var(--tienda-accent);
  color: var(--tienda-accent);
}

.tienda-3d-quality-btn.active {
  background-color: var(--tienda-accent);
  color: #000;
  border-color: var(--tienda-accent);
  font-weight: 600;
}

/* ====================================================================== */
/* FULLSCREEN TOGGLE */
/* ====================================================================== */

.tienda-3d-fullscreen-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--tienda-accent);
  color: var(--tienda-accent);
  width: 36px;
  height: 36px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all 0.2s ease;
  z-index: 100;
}

.tienda-3d-fullscreen-btn:hover {
  background-color: rgba(0, 212, 255, 0.1);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.3);
}

/* ====================================================================== */
/* FULLSCREEN STATE */
/* ====================================================================== */

#viewer-3d.fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  z-index: 9999;
  margin: 0;
}

.tienda-3d-fullscreen-exit {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10000;
}
