/* Scene Builder Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  height: 100%;
}

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  font-size: 11px;
  margin: 0;
  padding: 0;
}

header {
  padding: 0.35rem 0.5rem;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(96, 165, 250, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

header h1 {
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: 0.5rem;
}

.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.scene-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: visible;
  min-height: 0;
}

#canvas-container {
  flex: 1;
  position: relative;
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  overflow: auto;
}

.grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(rgba(96, 165, 250, 0.1) 1px, transparent 1px),
    linear-gradient(90deg, rgba(96, 165, 250, 0.1) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

#canvas {
  border: 2px solid rgba(96, 165, 250, 0.3);
  border-radius: 8px;
  background: #f8fafc;
  cursor: grab;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  max-width: 90%;
  max-height: 90%;
  width: auto;
  height: auto;
  object-fit: contain;
}

#canvas:active {
  cursor: grabbing;
}

.camera-frame {
  display: none;
  /* Camera frame now drawn on canvas */
}

.canvas-controls {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: rgba(30, 41, 59, 0.9);
  padding: 0.5rem;
  border-radius: 6px;
  backdrop-filter: blur(10px);
}

.zoom-controls {
  display: flex;
  gap: 0.25rem;
}

.format-selector select {
  width: 100%;
  padding: 0.25rem;
  background: rgba(51, 65, 85, 0.8);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 0.8rem;
}

.sidebar {
  width: 280px;
  background: rgba(30, 41, 59, 0.95);
  backdrop-filter: blur(10px);
  border-left: 1px solid rgba(96, 165, 250, 0.2);
  padding: 0.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.panel {
  background: rgba(51, 65, 85, 0.5);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 6px;
  padding: 0.5rem;
}

.panel h3 {
  margin-bottom: 0.35rem;
  color: #f59e0b;
  font-size: 0.8rem;
  font-weight: 600;
}

.panel h4 {
  margin-bottom: 0.25rem;
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 500;
}

.tabs {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  background: rgba(51, 65, 85, 0.3);
  border-radius: 6px;
  padding: 0;
  gap: 0.25rem;
}

.tab {
  flex: 0 1 auto;
  width: 80px;
  padding: 0.3rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: #94a3b8;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-weight: 500;
}

.tab:hover {
  background: rgba(96, 165, 250, 0.1);
  color: #e2e8f0;
}

.tab.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.form-group {
  margin-bottom: 0.35rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.65rem;
  color: #cbd5e1;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.35rem;
  background: rgba(51, 65, 85, 0.8);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 0.65rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.form-group input[type="range"] {
  padding: 0;
  height: 6px;
  background: rgba(51, 65, 85, 0.8);
  outline: none;
  border-radius: 3px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.form-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.5);
}

.form-group input[type="color"] {
  height: 30px;
  padding: 2px;
  cursor: pointer;
}

.value {
  color: #f59e0b;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  font-size: 0.6rem;
  margin-left: 0.35rem;
}

.tool-btn,
.asset-categories button {
  padding: 0.3rem 0.5rem;
  background: rgba(51, 65, 85, 0.8);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 4px;
  color: #e2e8f0;
  font-size: 0.65rem;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  margin: 0.15rem;
}

.tool-btn:hover,
.asset-categories button:hover {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  transform: translateY(-1px);
}

.tool-btn.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  border-color: #f59e0b;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.anchor-tools,
.asset-categories {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  padding: 0;
}

.items-list,
.anchor-list,
.layers-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-height: 150px;
  overflow-y: auto;
}

.item,
.anchor-item,
.layer-item {
  padding: 0.4rem;
  background: rgba(51, 65, 85, 0.6);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item:hover,
.anchor-item:hover,
.layer-item:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
}

.item.selected,
.anchor-item.selected,
.layer-item.selected {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
}

.item .name,
.anchor-item .name,
.layer-item .name {
  font-weight: 500;
}

.item .type,
.anchor-item .type,
.layer-item .type {
  font-size: 0.6rem;
  color: #94a3b8;
}

.editor-section {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(96, 165, 250, 0.1);
}

.editor-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0.2rem 0;
  cursor: pointer;
  font-size: 0.65rem;
  color: #cbd5e1;
  padding: 0.2rem;
  border-radius: 3px;
  transition: all 0.2s;
}

.checkbox:hover {
  background: rgba(245, 158, 11, 0.1);
}

.checkbox input[type="checkbox"] {
  width: 12px;
  height: 12px;
  cursor: pointer;
  accent-color: #f59e0b;
}

.asset-preview {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(30, 41, 59, 0.6);
  border-radius: 4px;
  text-align: center;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.8rem;
}

button {
  padding: 0.35rem 0.5rem;
  border: none;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
  box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(245, 158, 11, 0.4);
}

button.secondary {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  box-shadow: 0 2px 4px rgba(107, 114, 128, 0.3);
}

button.secondary:hover {
  box-shadow: 0 4px 8px rgba(107, 114, 128, 0.4);
}

button.success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3);
}

button.success:hover {
  box-shadow: 0 4px 8px rgba(16, 185, 129, 0.4);
}

button.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
  width: 100%;
  padding: 0.35rem 0.5rem !important;
  font-size: 0.7rem !important;
  margin: 0.15rem 0 !important;
}

button.danger:hover {
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
}

button.primary {
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

button.primary:hover {
  box-shadow: 0 4px 8px rgba(139, 92, 246, 0.4);
}

button.icon-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  min-width: unset;
}

.info-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 4px;
  padding: 0.35rem;
  font-size: 0.6rem;
  line-height: 1.3;
  color: #cbd5e1;
}

#status {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-weight: 500;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 1000;
}

#status.show {
  opacity: 1;
}

#status.info {
  background: rgba(59, 130, 246, 0.9);
  color: white;
}

#status.success {
  background: rgba(16, 185, 129, 0.9);
  color: white;
}

#status.warning {
  background: rgba(245, 158, 11, 0.9);
  color: white;
}

#status.error {
  background: rgba(239, 68, 68, 0.9);
  color: white;
}

/* Modal Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #1e293b;
  border-radius: 12px;
  width: 95%;
  max-width: 1000px;
  max-height: 85%;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-content.large {
  max-width: 1400px;
  width: 98%;
  max-height: 95%;
}

.modal-header {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(96, 165, 250, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  color: #f59e0b;
  font-size: 0.95rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.close-btn:hover {
  color: #ef4444;
  transform: none;
  box-shadow: none;
}

.modal-body {
  padding: 0.75rem;
  overflow-y: auto;
  max-height: 70vh;
  font-size: 0.75rem;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
}

.asset-item {
  padding: 0.5rem;
  background: rgba(51, 65, 85, 0.6);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.asset-item:hover {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.asset-item .icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.asset-item .name {
  font-size: 0.6rem;
  color: #cbd5e1;
}

/* Timeline Editor Styles */
.timeline-toggle {
  width: 100%;
  margin-top: 0.35rem;
  background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  color: white;
  border: none;
  padding: 0.35rem;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.timeline-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(139, 92, 246, 0.4);
}

.timeline-toggle.active {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.timeline-editor {
  background: rgba(30, 41, 59, 0.98);
  backdrop-filter: blur(10px);
  border-top: 2px solid rgba(245, 158, 11, 0.5);
  padding: 0.35rem 1.25rem 0 0.35rem;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  height: 200px;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.15rem;
  padding-bottom: 0.15rem;
  border-bottom: 1px solid rgba(96, 165, 250, 0.2);
  flex-shrink: 0;
  gap: 0.5rem;
}

.timeline-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.timeline-actions {
  display: flex;
  gap: 0.25rem;
}

.timeline-time {
  color: #f59e0b;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  margin-left: 0.5rem;
  font-size: 0.65rem;
}

.timeline-scrubber {
  margin-bottom: 0.50rem;
  margin-top: 0.25rem;
  position: relative;
  flex-shrink: 0;
  padding: 0.50rem;
}

.time-markers {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 14px;
  pointer-events: none;
  z-index: 1;
}

.time-marker {
  position: absolute;
  font-size: 0.55rem;
  color: #94a3b8;
  font-family: 'Courier New', monospace;
}

.timeline-scrubber input[type="range"] {
  width: 100%;
  height: 4px;
  background: rgba(51, 65, 85, 0.8);
  outline: none;
  border-radius: 2px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.timeline-scrubber input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.5);
}

.timeline-tracks {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.track-labels {
  width: 70px;
  flex-shrink: 0;
  overflow-y: auto;
}

.track-label {
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 0.3rem;
  background: rgba(51, 65, 85, 0.6);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 3px;
  margin-bottom: 0.2rem;
  font-size: 0.55rem;
  font-weight: 500;
  color: #cbd5e1;
}

.timeline-content {
  flex: 1;
  position: relative;
  min-height: 0;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(96, 165, 250, 0.2);
  border-radius: 4px;
  overflow: auto;
  background-image:
    repeating-linear-gradient(90deg,
      transparent,
      transparent 99px,
      rgba(96, 165, 250, 0.1) 100px);
}

.command-timeline {
  position: relative;
  height: 100%;
  min-width: 100%;
}

.command-item {
  position: absolute;
  background: rgba(245, 158, 11, 0.8);
  border: 1px solid rgba(245, 158, 11, 1);
  border-radius: 2px;
  padding: 0.1rem 0.2rem;
  font-size: 0.55rem;
  color: #000;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 40px;
  height: 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.command-item:hover {
  background: rgba(245, 158, 11, 1);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.command-item .time {
  font-weight: 600;
  font-size: 0.5rem;
}

.command-item .target {
  font-size: 0.45rem;
  opacity: 0.8;
}

/* Modal Actions */
.modal-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
  padding: 0.5rem;
  border-top: 1px solid rgba(96, 165, 250, 0.2);
}

/* Command Modal Specific Styles */
#command-modal .modal-content {
  max-width: 1400px;
  width: 95%;
}

#command-modal .form-group {
  margin-bottom: 0.5rem;
}

#command-modal label {
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: block;
}

#command-modal input,
#command-modal select,
#command-modal textarea {
  font-size: 0.7rem;
  padding: 0.35rem;
  min-height: 30px;
  width: 100%;
}

#command-modal textarea {
  min-height: 80px;
  resize: vertical;
}

#command-modal button {
  font-size: 0.7rem;
  padding: 0.35rem 0.5rem;
  min-height: 28px;
}

/* JSON Editor Modal Specific Styles */
#json-editor-modal .modal-content {
  max-width: 1400px;
  width: 95%;
  max-height: 90%;
}

#json-editor-modal textarea {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 11px;
  line-height: 1.4;
  min-height: 400px;
  resize: none;
  width: 100%;
  padding: 0.5rem;
}

#json-editor-modal button {
  font-size: 0.7rem;
  padding: 0.35rem 0.5rem;
  min-height: 28px;
}

/* Asset Categories in Modal */
.modal-body .asset-categories {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.modal-body .asset-categories .tool-btn {
  margin: 0;
  flex: 1;
  min-width: 80px;
}

.render-only-label {
  font-size: 0.65rem;
}

/* Support
 Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border: solid gray 1px;
  z-index: 2000;
}

.support-modal-content {
  background: #000000;
  min-width: 56rem;
  height: 90vh;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.support-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.support-modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
}

.support-close-btn {
  background: transparent;
  box-shadow: none;
  border-radius: 60%;
  transition: none;
  padding: none;
}

.support-close-btn:hover {
  background-color: #374151;
  box-shadow: none;
  border: none;
}

.support-video-container {
  margin-bottom: 0;
  border-radius: 0.5rem;
  overflow: hidden;
  max-height: 400px;
}

.support-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  max-height: 400px;
}

.support-message {
  border-radius: 0.5rem;
  padding: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.support-message-text {
  font-size: 1.25rem;
  color: #ffffff;
  margin-bottom: 1.5rem;
}

.support-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  box-shadow: 0 20px 25px -5px rgba(234, 88, 12, 0.5), 0 10px 10px -5px rgba(234, 88, 12, 0.04);
  color: #ffffff;
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: background-color 0.6s;
  text-decoration: none;
  background: linear-gradient(135deg, #000000 0%, #110f0c 100%);
  animation: flash 2s infinite;
}

.support-btn:hover {
  background: #c2410c;
}

@keyframes flash {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }
}

.support-social {
  text-align: center;
  padding-bottom: 1rem;
}

.support-social-text {
  font-size: 0.875rem;
  color: #9ca3af;
  margin-bottom: 1rem;
}

.support-social-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
}

.support-social-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background-color: #1f2937;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  text-decoration: none;
}

.support-social-icon:hover {
  background-color: #374151;
}

.support-social-icon .material-icons {
  color: #ffffff;
}

.support-social-x {
  color: #ffffff;
  font-weight: bold;
  font-size: 1.125rem;
}

.support-coffee-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.75rem;
}