/* ===============================
   INTEGRATED Z-OFFSET CONTROLS STYLES
   =============================== */

/* Asset Item with Z-Offset Controls */
.modern-asset-zoffset {
  margin-top: 12px;
  padding: 12px;
  background: rgba(46, 207, 176, 0.08);
  border-radius: 8px;
  border: 1px solid rgba(46, 207, 176, 0.2);
}

.zoffset-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.zoffset-value {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  font-size: 13px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
  color: #4caf50; /* Default green */
  transition: all 0.3s ease;
  min-width: 65px;
  text-align: center;
}

/* Z-Offset Slider with Gradient (DO NOT CHANGE - functional color mapping) */
.zoffset-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  margin-bottom: 12px;
  background: linear-gradient(to right,
    #f44336 0%,      /* Red at -5m */
    #ff9800 25%,     /* Orange */
    #4caf50 50%,     /* Green at 0m */
    #2196f3 75%,     /* Blue */
    #9c27b0 100%     /* Purple at +5m */
  );
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.zoffset-slider:hover {
  box-shadow: 0 2px 8px rgba(46, 207, 176, 0.4);
}

/* Slider Thumb - WebKit */
.zoffset-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  background: #ffffff;
  border: 3px solid var(--brand-teal, #2ECFB0);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
}

.zoffset-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(46, 207, 176, 0.8);
}

.zoffset-slider::-webkit-slider-thumb:active {
  background: var(--brand-teal, #2ECFB0);
  transform: scale(1.3);
}

/* Slider Thumb - Firefox */
.zoffset-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #ffffff;
  border: 3px solid var(--brand-teal, #2ECFB0);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.2s ease;
  border: none;
}

.zoffset-slider::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(46, 207, 176, 0.8);
}

.zoffset-slider::-moz-range-thumb:active {
  background: var(--brand-teal, #2ECFB0);
  transform: scale(1.3);
}

/* Input Box Row */
.zoffset-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Z-Offset Input Box */
.zoffset-input-box {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text-primary, #E2E8F0);
  border: 1px solid rgba(46, 207, 176, 0.3);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s ease;
  outline: none;
}

.zoffset-input-box:hover {
  border-color: rgba(46, 207, 176, 0.5);
  background: rgba(0, 0, 0, 0.4);
}

.zoffset-input-box:focus {
  border-color: var(--brand-teal, #2ECFB0);
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(46, 207, 176, 0.2);
}

/* Reset Button */
.zoffset-reset-btn {
  background: rgba(46, 207, 176, 0.2);
  color: var(--brand-teal, #2ECFB0);
  border: 1px solid rgba(46, 207, 176, 0.3);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoffset-reset-btn:hover {
  background: rgba(46, 207, 176, 0.35);
  border-color: rgba(46, 207, 176, 0.5);
  transform: rotate(180deg);
}

.zoffset-reset-btn:active {
  background: rgba(46, 207, 176, 0.5);
  transform: rotate(180deg) scale(0.95);
}

/* Per-asset "clamp to terrain" button — matches reset button sizing */
.zoffset-clamp-btn {
  background: rgba(46, 207, 176, 0.12);
  color: var(--brand-teal, #2ECFB0);
  border: 1px solid rgba(46, 207, 176, 0.3);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoffset-clamp-btn:hover {
  background: rgba(46, 207, 176, 0.28);
  border-color: rgba(46, 207, 176, 0.5);
}

.zoffset-clamp-btn:active {
  background: rgba(46, 207, 176, 0.45);
  transform: scale(0.95);
}

/* Asset Item Enhancement */
.modern-asset-item {
  background: rgba(0, 0, 0, 0.3);
  border-left: 3px solid rgba(46, 207, 176, 0.5);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  transition: background 0.2s ease, border-left-color 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.modern-asset-item:hover {
  background: rgba(0, 0, 0, 0.4);
  border-left-color: rgba(46, 207, 176, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modern-asset-itwin {
  border-left-color: rgba(17, 153, 142, 0.7);
}

.modern-asset-itwin:hover {
  border-left-color: rgba(17, 153, 142, 1);
}

/* Asset Header */
.modern-asset-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
  cursor: pointer;
  user-select: none;
}

/* Collapsible details (Opacity + Z-Offset + optional GLB controls) */
.modern-asset-details {
  display: none;
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.modern-asset-item.expanded .modern-asset-details {
  display: block;
}

/* Chevron indicator */
.modern-asset-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: rgba(255, 255, 255, 0.4);
  transition: transform 0.2s ease, color 0.2s ease;
}

.modern-asset-header:hover .modern-asset-chevron {
  color: rgba(255, 255, 255, 0.75);
}

.modern-asset-item.expanded .modern-asset-chevron {
  transform: rotate(90deg);
  color: var(--brand-teal, #2ECFB0);
}

/* Strip the opacity row's border/margin when it's the first item inside details */
.modern-asset-details > .modern-asset-opacity:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.modern-asset-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary, #E2E8F0);
  flex: 1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
  margin-right: 10px;
}

.modern-asset-controls {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Opacity Control */
.modern-asset-opacity {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 12px;
}

.modern-asset-opacity .modern-label-small {
  min-width: 60px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.modern-asset-opacity .modern-slider-small {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.modern-asset-opacity .modern-slider-small::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--brand-teal, #2ECFB0);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.modern-asset-opacity .modern-slider-small::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--brand-teal, #2ECFB0);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.modern-asset-opacity .modern-value-small {
  min-width: 45px;
  text-align: right;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
  .zoffset-input-row {
    gap: 6px;
  }

  .zoffset-input-box {
    padding: 6px 10px;
    font-size: 12px;
  }

  .zoffset-reset-btn {
    padding: 6px 10px;
    min-width: 36px;
  }

  .modern-asset-item {
    padding: 8px 10px;
  }

  .modern-asset-name {
    font-size: 13px;
  }
}

/* Animation for slider interaction */
@keyframes sliderGlow {
  0%, 100% {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  }
  50% {
    box-shadow: 0 2px 8px rgba(46, 207, 176, 0.6);
  }
}

.zoffset-slider:active {
  animation: sliderGlow 0.5s ease-in-out;
}

/* Empty State */
.modern-assets-list:empty::after {
  content: 'No assets loaded';
  display: block;
  text-align: center;
  padding: 30px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
}

/* Scrollbar for Asset List */
.modern-assets-list {
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  padding-right: 8px;
}

.modern-assets-list::-webkit-scrollbar {
  width: 8px;
}

.modern-assets-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.modern-assets-list::-webkit-scrollbar-thumb {
  background: rgba(46, 207, 176, 0.5);
  border-radius: 4px;
}

.modern-assets-list::-webkit-scrollbar-thumb:hover {
  background: rgba(46, 207, 176, 0.7);
}

/* Icon Buttons */
.modern-icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modern-icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: scale(1.1);
}

.modern-icon-btn:active {
  transform: scale(0.95);
}

.modern-icon-btn-danger {
  background: rgba(231, 76, 60, 0.15);
  border-color: rgba(231, 76, 60, 0.3);
  color: #ff6b6b;
}

.modern-icon-btn-danger:hover {
  background: rgba(231, 76, 60, 0.25);
  border-color: rgba(231, 76, 60, 0.5);
  color: #ff8787;
}

/* Loaded Assets panel — top action row (e.g. Clamp all to terrain) */
.assets-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}

.assets-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(46, 207, 176, 0.1);
  border: 1px solid rgba(46, 207, 176, 0.25);
  border-radius: 6px;
  color: rgba(46, 207, 176, 0.9);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.assets-action-btn:hover {
  background: rgba(46, 207, 176, 0.2);
  border-color: rgba(46, 207, 176, 0.5);
  color: #2ECFB0;
}

.assets-action-btn:active {
  transform: scale(0.98);
}

.assets-action-btn svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.2;
}
