/* Custom styles that can't be easily replaced by Tailwind */

/* Burger-Button Hint-Blink (einmaliges blaues Aufleuchten) */
@keyframes burgerHint {
  0%   { background-color: rgba(255, 255, 255, 0.95); box-shadow: none; }
  40%  { background-color: rgba(37, 99, 235, 0.9);   box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.25); }
  100% { background-color: rgba(255, 255, 255, 0.95); box-shadow: none; }
}

#burgerMenuButton.burger-hint {
  animation: burgerHint 0.6s ease-in-out forwards;
}

#burgerMenuButton.burger-hint svg {
  color: #fff;
  transition: color 0.1s;
}

/* Language flag buttons */
.lang-flag-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
  overflow: hidden;
}

.lang-flag-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  pointer-events: none;
}

.lang-flag-btn:hover {
  transform: scale(1.15);
}

.lang-flag-btn.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
  transform: scale(1.1);
}
body { 
  margin: 0; 
  overflow: hidden; 
  touch-action: none; 
}

/* Ensure the Three.js canvas takes full space */
canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  z-index: 1;
  position: relative;
}

/* Custom radio button styling for better visual feedback */
input[type="radio"]:checked + label {
  color: #1d4ed8; /* blue-700 */
  font-weight: 600;
}

/* Smooth transitions for radio option selection */
.radio-option-selected {
  background-color: #eff6ff; /* blue-50 */
  border-color: #3b82f6; /* blue-500 */
}

/* VR/AR buttons are now integrated in the options panel */

/* Universal burger menu styles - All platforms */
#burgerMenuButton {
  min-width: 44px;
  min-height: 44px;
  display: block;
}

/* Options panel with slide animation */
#optionsContainer {
  display: block;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

#optionsContainer.mobile-visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

/* Slide-in animation keyframes */
@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

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

/* Mobile-specific styles - Portrait and Landscape */
@media (max-width: 768px) {
  /* Ensure options panel takes full width on mobile when visible */
  #optionsContainer {
    width: calc(100vw - 2rem);
    max-width: none;
    left: 1rem;
    right: 1rem;
    top: 5rem; /* Position below burger menu on mobile */
  }
  
  /* Adjust logo positioning on very small screens */
  #logo {
    top: 1rem;
    right: 1rem;
  }
  
  /* Improve touch targets for radio options */
  .radio-option-selected,
  .flex.items-center.p-2.rounded-lg {
    min-height: 44px;
  }
  
  /* VR/AR buttons are now integrated in the options panel */
  
  /* Controls drawer adjustments for mobile - handled in mobile drawer positioning section below */
  
  #drawerContent {
    padding: 1rem;
  }
  
  /* VR/AR buttons are now positioned at top, no interference with controls drawer */
}

/* Landscape orientation specific adjustments */
@media (max-width: 768px) and (orientation: landscape) {
  /* Burger menu is already visible on all platforms */
  
  /* Adjust options panel positioning for landscape */
  #optionsContainer {
    top: 5rem; /* Position below burger menu in landscape */
    width: calc(100vw - 2rem);
    max-width: 400px; /* Limit width in landscape */
  }
  
  /* Adjust logo for landscape */
  #logo {
    top: 0.5rem;
    right: 0.5rem;
    width: 6rem;
  }
  
  /* VR/AR buttons are now integrated in the options panel */
}

/* Controls drawer styles */
#controlsDrawer {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transform: translateX(-50%) translateY(calc(100% - 60px));
}

/* Mobile drawer positioning override */
@media (max-width: 768px) {
  #controlsDrawer {
    transform: translateY(calc(100% - 60px));
    left: 1rem;
    right: 1rem;
    width: calc(100vw - 2rem);
    max-width: none;
  }
}

#controlsDrawer.collapsed {
  transform: translateX(-50%) translateY(calc(100% - 60px));
}

#controlsDrawer.collapsed #drawerContent {
  opacity: 0;
  transform: translateY(-20px);
  pointer-events: none;
  max-height: 0;
  overflow: hidden;
  padding: 0;
}

#controlsDrawer.open {
  transform: translateX(-50%) translateY(0);
}

#controlsDrawer.open #drawerContent {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
  max-height: 500px;
  overflow: visible;
  padding: 1.5rem;
}

/* Mobile drawer states */
@media (max-width: 768px) {
  #controlsDrawer.collapsed {
    transform: translateY(calc(100% - 60px));
    left: 1rem;
    right: 1rem;
    width: calc(100vw - 2rem);
    max-width: none;
  }
  
  #controlsDrawer.open {
    transform: translateY(0);
    left: 1rem;
    right: 1rem;
    width: calc(100vw - 2rem);
    max-width: none;
  }
}

#controlsDrawer.collapsed #drawerToggleIcon {
  transform: rotate(180deg);
}

#drawerHandle {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
  -webkit-user-select: none;
}

#drawerContent {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.5s ease-in-out;
  max-height: 500px;
  overflow: hidden;
}

/* Smooth transitions for control sections */
.desktop-controls, .touch-controls, .vr-controls {
  transition: opacity 0.3s ease;
}

/* Remove hover effects that cause text jumping */
#drawerContent .flex.items-center {
  padding: 0.25rem;
  margin: 0;
}

/* Drawer handle hover effect */
#drawerHandle:hover {
  background-color: rgba(255, 255, 255, 1);
}

/* Responsive text sizing */
@media (max-width: 480px) {
  #drawerContent {
    font-size: 0.75rem;
    padding: 0.75rem;
  }
  
  #drawerHandle h3 {
    font-size: 1rem;
  }
  
  #drawerContent h4 {
    font-size: 0.875rem;
  }
}

/* Ensure drawer doesn't interfere with other elements */
#controlsDrawer {
  z-index: 20;
}

/* Animation for smooth drawer movement */
#controlsDrawer {
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#drawerContent {
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================
   Top-center tool toggle buttons (1:1 square)
   ============================================================ */
.tool-toggle-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.tool-toggle-btn.tool-active {
  background-color: #2563eb; /* blue-600 */
  border-color: #1d4ed8;
}

.tool-toggle-btn.tool-active svg {
  color: #fff;
}

/* ============================================================
   Height filter vertical dual slider
   ============================================================ */
.height-slider-track {
  position: relative;
  width: 8px;
  height: 45vh;
  min-height: 180px;
  background: #e5e7eb; /* gray-200 */
  border-radius: 4px;
  touch-action: none;
}

.height-slider-range {
  position: absolute;
  left: 0;
  width: 100%;
  background: #2563eb; /* blue-600 */
  border-radius: 4px;
}

.height-slider-handle {
  position: absolute;
  left: 50%;
  width: 20px;
  height: 20px;
  transform: translate(-50%, 50%);
  bottom: 0;
  background: #fff;
  border: 2px solid #2563eb;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  cursor: grab;
  touch-action: none;
}

.height-slider-handle:active {
  cursor: grabbing;
  background: #eff6ff; /* blue-50 */
}

/* ============================================================
   Collision mesh debug panel
   ============================================================ */
.collision-input {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid #d1d5db; /* gray-300 */
  border-radius: 6px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
  color: #374151;
}

.collision-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.gizmo-mode-btn {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: #f3f4f6; /* gray-100 */
  color: #374151;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.gizmo-mode-btn:hover {
  background: #e5e7eb;
}

.gizmo-mode-btn.active {
  background: #2563eb;
  color: #fff;
}

/* ============================================================
   Maßband: Hint-Popup und Zoomansicht (Lupe)
   ============================================================ */
.measure-hint-text {
  white-space: pre-line;
}

#measureLoupe {
  position: fixed;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.15);
  pointer-events: none;
  z-index: 45;
  background: #000;
}

/* ============================================================
   Splat-Umschalter (links mittig, bei mehreren dataX.rad)
   ============================================================ */
.splat-switch-btn {
  min-width: 130px;
  max-width: 220px;
  padding: 12px 18px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: #1f2937; /* gray-800 */
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(229, 231, 235, 0.5);
  border-radius: 12px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.splat-switch-btn:hover {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  transform: translateX(2px);
}

.splat-switch-btn.active {
  background: #2563eb; /* blue-600 */
  border-color: #1d4ed8;
  color: #fff;
}

.splat-switch-btn.loading {
  animation: splat-btn-pulse 1.1s ease-in-out infinite;
  pointer-events: none;
}

@keyframes splat-btn-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}