/* ============================================================================
   UI OVERLAY STYLES — Additional UI components for 3D site
   Separated for clarity; loads after 3d-base.css
   ============================================================================ */

/* ============================================================================
   TOOLTIPS / HOVER CARDS (for 3D object interactions)
   ============================================================================ */
.ui-tooltip {
  position: fixed;
  background: var(--forest-deep);
  color: var(--earth-cream);
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: none;
  z-index: 200;
  transform: translate(-50%, -100%);
  margin-bottom: 0.5rem;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s ease;
  box-shadow: var(--shadow-strong);
}

.ui-tooltip.visible {
  opacity: 1;
}

.ui-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--forest-deep);
}

/* ============================================================================
   HUD ELEMENTS (scene indicators, progress, etc.)
   ============================================================================ */
.hud {
  position: fixed;
  z-index: 30;
  pointer-events: none;
}

.hud-top-left {
  top: 1.5rem;
  left: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hud-top-right {
  top: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.hud-bottom-center {
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1rem;
}

.hud-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--earth-cream);
  border: 1px solid var(--line);
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--forest-deep);
  box-shadow: var(--shadow-soft);
}

.hud-badge .icon {
  font-size: 1rem;
}

/* ============================================================================
   SCENE TRANSITION OVERLAY
   ============================================================================ */
.scene-transition {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--forest-deep), var(--forest-light));
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.scene-transition.active {
  opacity: 1;
  visibility: visible;
}

.scene-transition-content {
  text-align: center;
  color: var(--earth-cream);
  transform: translateY(20px);
  transition: transform 0.4s ease;
}

.scene-transition.active .scene-transition-content {
  transform: translateY(0);
}

.scene-transition-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.scene-transition-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
}

/* ============================================================================
   PROGRESS INDICATORS (loading assets, etc.)
   ============================================================================ */
.progress-ring {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  z-index: 200;
  transform: rotate(-90deg);
}

.progress-ring-circle {
  fill: none;
  stroke: var(--line);
  stroke-width: 4;
}

.progress-ring-progress {
  fill: none;
  stroke: var(--sun-gold);
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s ease;
}

.progress-ring-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--sun-gold);
}

/* ============================================================================
   CONTEXT MENU (right-click on characters/objects)
   ============================================================================ */
.context-menu {
  position: fixed;
  background: var(--earth-cream);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem 0;
  min-width: 180px;
  box-shadow: var(--shadow-strong);
  z-index: 300;
  animation: fadeIn 0.1s ease;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  color: var(--bark-brown);
  cursor: pointer;
  transition: background 0.1s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.context-menu-item:hover {
  background: var(--forest-light);
  color: var(--earth-cream);
}

.context-menu-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.context-menu-divider {
  height: 1px;
  background: var(--line);
  margin: 0.5rem 0;
}

.context-menu-item .icon {
  font-size: 1.1rem;
}

/* ============================================================================
   TOAST NOTIFICATIONS
   ============================================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 1.5rem;
  z-index: 400;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--forest-deep);
  color: var(--earth-cream);
  border-radius: 10px;
  box-shadow: var(--shadow-strong);
  animation: slideInRight 0.3s ease;
  pointer-events: auto;
  max-width: 360px;
}

.toast.success {
  background: var(--leaf-green);
}

.toast.error {
  background: #9c2118;
}

.toast.warning {
  background: #8a5a00;
}

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

.toast-message {
  flex: 1;
  font-size: 0.9rem;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 0;
  line-height: 1;
}

.toast-close:hover {
  opacity: 1;
}

/* ============================================================================
   CHARACTER NAME TAGS (floating above 3D sprites)
   ============================================================================ */
.character-name-tag {
  position: absolute;
  pointer-events: none;
  transform: translate(-50%, -100%);
  margin-bottom: 0.5rem;
  white-space: nowrap;
  z-index: 50;
}

.character-name-tag-label {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--forest-deep);
  color: var(--sun-gold);
  border-radius: 9999px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.character-name-tag:hover .character-name-tag-label,
.character-name-tag.visible .character-name-tag-label {
  opacity: 1;
}

/* ============================================================================
   MOBILE TOUCH HINTS
   ============================================================================ */
.touch-hint {
  position: fixed;
  bottom: 4rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--forest-deep);
  color: var(--earth-cream);
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 30;
  pointer-events: none;
}

.touch-hint.visible {
  opacity: 1;
}

@media (hover: none) and (pointer: coarse) {
  .touch-hint {
    opacity: 1;
  }
}

/* ============================================================================
   SCROLLBAR STYLING (for overflow areas in UI)
   ============================================================================ */
.cabins-grid::-webkit-scrollbar,
.gallery-grid::-webkit-scrollbar,
.seasons-ring-ui::-webkit-scrollbar,
.clearing-main::-webkit-scrollbar,
.modal-content::-webkit-scrollbar {
  width: 8px;
}

.cabins-grid::-webkit-scrollbar-track,
.gallery-grid::-webkit-scrollbar-track,
.seasons-ring-ui::-webkit-scrollbar-track,
.clearing-main::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track {
  background: var(--earth-sand);
  border-radius: 4px;
}

.cabins-grid::-webkit-scrollbar-thumb,
.gallery-grid::-webkit-scrollbar-thumb,
.seasons-ring-ui::-webkit-scrollbar-thumb,
.clearing-main::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb {
  background: var(--forest-light);
  border-radius: 4px;
  border: 2px solid var(--earth-sand);
}

.cabins-grid::-webkit-scrollbar-thumb:hover,
.gallery-grid::-webkit-scrollbar-thumb:hover,
.seasons-ring-ui::-webkit-scrollbar-thumb:hover,
.clearing-main::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover {
  background: var(--forest-deep);
}

/* Firefox */
.cabins-grid,
.gallery-grid,
.seasons-ring-ui,
.clearing-main,
.modal-content {
  scrollbar-width: thin;
  scrollbar-color: var(--forest-light) var(--earth-sand);
}

/* ============================================================================
   PRINT STYLES (hide 3D UI)
   ============================================================================ */
@media print {
  #canvas-container,
  #ui-overlay,
  .loading-overlay,
  .reduced-motion-toggle {
    display: none !important;
  }

  body {
    overflow: visible;
    height: auto;
  }
}