/* ==========================================================================
   Ideogram 4 Vod Studio - Design System & Stylesheet
   ========================================================================== */

/* Variables & Base Styles */
:root {
  --bg-primary: #070a13;
  --bg-secondary: #0f1524;
  --bg-tertiary: #172033;
  --bg-glass: rgba(15, 21, 36, 0.7);
  --bg-glass-card: rgba(23, 32, 51, 0.45);
  
  --border-light: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.15);
  --border-focus: #6366f1;
  
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dimmed: #64748b;
  
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-rose: #f43f5e;
  --accent-emerald: #10b981;
  
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-indigo-glow: rgba(99, 102, 241, 0.35);
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

input::placeholder,
textarea::placeholder {
  color: #475569 !important;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Scrollbar customization */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--border-medium);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  background-image: radial-gradient(circle at 50% -20%, #1e1b4b 0%, var(--bg-primary) 70%);
}

/* Header Removed */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-indigo), var(--accent-purple));
  color: #fff;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-main);
  border-color: var(--border-light);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-medium);
}

.btn-danger-outline {
  background: transparent;
  color: var(--accent-rose);
  border-color: rgba(244, 63, 94, 0.3);
}
.btn-danger-outline:hover {
  background: rgba(244, 63, 94, 0.1);
  border-color: var(--accent-rose);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 4px;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 4px;
}

.btn-icon {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.btn-icon:hover, .btn-icon.active {
  background: var(--bg-tertiary);
  color: var(--accent-cyan);
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.1);
}

/* Workspace Layout */
.app-workspace {
  display: flex;
  flex: 1;
  height: 100vh;
  overflow: hidden;
}

/* Canvas Panel */
.canvas-workspace-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  background-color: #000000;
  background-image: 
    radial-gradient(var(--bg-secondary) 1px, transparent 0),
    radial-gradient(var(--bg-secondary) 1px, transparent 0);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  position: relative;
  overflow: hidden;
  padding: 16px;
}

.floating-guide-btn {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 90;
}

.ratio-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ratio-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-fast);
}
.ratio-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-main);
}
.ratio-btn.active {
  background: var(--bg-tertiary);
  color: #fff;
  border-color: var(--border-medium);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Canvas Area */
.canvas-container-wrapper {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding: 20px;
}

.canvas-viewport {
  position: relative;
  background-color: var(--bg-primary);
  border: 1.5px solid var(--border-medium);
  border-radius: 8px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(99, 102, 241, 0.05);
  width: 512px;
  height: 512px;
  max-width: none;
  max-height: none;
  min-width: 250px;
  min-height: 250px;
  overflow: visible;
  transition: box-shadow var(--transition-normal);
  user-select: none;
}

.canvas-viewport.dragging-active {
  border-color: var(--accent-indigo);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(99, 102, 241, 0.25);
}

/* Canvas Grid Lines */
.canvas-grid-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 10% 10%, 10% 10%, 50% 50%, 50% 50%;
  border-radius: 6px;
  opacity: 0;
  transition: opacity var(--transition-normal);
  z-index: 1;
}

.canvas-grid-overlay.active {
  opacity: 1;
}

/* Canvas Background Image */
.canvas-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  border-radius: 6px;
  z-index: 0;
}

/* Drawing Box Overlay */
.drawing-box-overlay {
  position: absolute;
  border: 1.5px dashed var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
  pointer-events: none;
  z-index: 50;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.2);
}

.drawing-coords {
  position: absolute;
  top: -24px;
  left: 0;
  background: var(--bg-primary);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(6, 182, 212, 0.3);
  white-space: nowrap;
}

/* Bounding Boxes Container */
.bbox-elements-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
}

/* Canvas Bottom bar removed */

/* Canvas Corner Resize Handles */
.canvas-resize-handle {
  position: absolute;
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
  cursor: nwse-resize;
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.canvas-resize-handle:hover {
  color: var(--accent-indigo);
  border-color: var(--accent-indigo);
}
.canvas-resize-handle.br {
  bottom: -6px;
  right: -6px;
}

.canvas-size-indicator {
  position: absolute;
  bottom: -28px;
  left: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(7, 10, 19, 0.6);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-light);
}

/* Bounding Box Element styling */
.bbox-element {
  position: absolute;
  border: 1.5px solid var(--accent-indigo);
  background: rgba(99, 102, 241, 0.03);
  cursor: move;
  border-radius: 4px;
  box-shadow: inset 0 0 10px rgba(99, 102, 241, 0.05);
  transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.bbox-element:hover {
  background: rgba(99, 102, 241, 0.07);
}

.bbox-element.selected {
  border-color: var(--accent-cyan);
  border-width: 2px;
  background: rgba(6, 182, 212, 0.05);
  box-shadow: 
    0 0 12px rgba(6, 182, 212, 0.15), 
    inset 0 0 15px rgba(6, 182, 212, 0.08);
  z-index: 40;
}

/* Watermark description element inside Bounding Box */
.box-inner-content {
  position: absolute;
  top: 6px;
  left: 6px;
  right: 6px;
  bottom: 26px; /* leaves room for bottom colors container */
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: hidden;
  z-index: 2;
  pointer-events: none; /* Let box-level dragging work by default */
}

/* Enable pointer events only for selected box edit fields */
.bbox-element.selected .box-inner-content {
  pointer-events: auto;
}

/* Watermark styles (when unselected) */
.box-watermark-header {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  flex-shrink: 0;
  background: rgba(11, 15, 25, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 8px;
  margin: -6px -6px 0 -6px;
  border-radius: 4px 4px 0 0;
  pointer-events: none;
  user-select: none;
}

.watermark-badge {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(99, 102, 241, 0.2);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.4);
  line-height: 1.2;
}

.watermark-badge.text {
  background: rgba(168, 85, 247, 0.2);
  color: #f3e8ff;
  border: 1px solid rgba(168, 85, 247, 0.4);
}

.watermark-literal {
  font-size: 11px;
  color: var(--text-main);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.watermark-literal strong {
  font-weight: 600;
  color: #ffffff;
}

.watermark-literal em {
  font-style: italic;
  color: var(--text-muted);
}

.box-desc-watermark {
  width: 100%;
  flex: 1;
  font-size: 11px;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.65);
  word-wrap: break-word;
  overflow-wrap: break-word;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  padding: 4px;
}

/* Editor styles (when selected) */
.box-editor-header {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  flex-shrink: 0;
  background: rgba(11, 15, 25, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0 8px;
  margin: -6px -6px 0 -6px;
  border-radius: 4px 4px 0 0;
}

.type-select-mini {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 3px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  height: 20px;
  outline: none;
}

.type-select-mini:focus {
  border-color: var(--accent-cyan);
}

.box-literal-input {
  background: rgba(15, 21, 36, 0.6);
  border: 1px solid var(--border-light);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  height: 20px;
  flex: 1;
  outline: none;
}

.box-literal-input:focus {
  border-color: var(--accent-cyan);
  background: var(--bg-tertiary);
}

.box-desc-textarea {
  width: 100%;
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 1.35;
  padding: 4px 0;
  margin: 0;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Visibility toggles based on selected status */
.bbox-element:not(.selected) .box-editor-header,
.bbox-element:not(.selected) .box-desc-textarea {
  display: none !important;
}

.bbox-element.selected .box-watermark-header,
.bbox-element.selected .box-desc-watermark {
  display: none !important;
}

/* Color blotches inside Bounding Box */
.box-colors-container {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(11, 15, 25, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0 0 4px 4px;
  padding: 4px 8px;
  pointer-events: auto;
  cursor: default;
  z-index: 10;
  height: 26px;
}

.box-blotches-list {
  display: flex;
  gap: 4px;
}

.color-blotch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  position: relative;
  transition: transform var(--transition-fast);
}

.color-blotch:hover {
  transform: scale(1.2);
  z-index: 2;
}

.color-blotch::after {
  content: '×';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 10px;
  line-height: 1;
  opacity: 0;
  text-shadow: 0 0 2px rgba(0,0,0,0.8);
  transition: opacity var(--transition-fast);
  pointer-events: none;
}

.color-blotch:hover::after {
  opacity: 1;
}

.add-box-color-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px dashed var(--text-muted);
  background: transparent;
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.add-box-color-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  transform: scale(1.1);
}

/* Element BBox Resize Handles */
.bbox-resize-handle {
  position: absolute;
  width: 8px;
  height: 8px;
  background-color: #fff;
  border: 1px solid var(--accent-cyan);
  border-radius: 1px;
  z-index: 20;
  display: none;
}

.bbox-element.selected .bbox-resize-handle {
  display: block;
}

.bbox-resize-handle.n { top: -5px; left: calc(50% - 4px); cursor: ns-resize; }
.bbox-resize-handle.s { bottom: -5px; left: calc(50% - 4px); cursor: ns-resize; }
.bbox-resize-handle.e { top: calc(50% - 4px); right: -5px; cursor: ew-resize; }
.bbox-resize-handle.w { top: calc(50% - 4px); left: -5px; cursor: ew-resize; }
.bbox-resize-handle.nw { top: -5px; left: -5px; cursor: nwse-resize; }
.bbox-resize-handle.ne { top: -5px; right: -5px; cursor: nesw-resize; }
.bbox-resize-handle.sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.bbox-resize-handle.se { bottom: -5px; right: -5px; cursor: nwse-resize; }

/* Coordinates Tag */
.bbox-element.selected::after {
  content: attr(data-coords);
  position: absolute;
  bottom: -22px;
  right: 0;
  background: var(--bg-secondary);
  color: var(--accent-cyan);
  border: 1px solid var(--border-medium);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 9px;
  pointer-events: none;
  z-index: 50;
  white-space: nowrap;
}

/* Sidebar Header */
.sidebar-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(15, 21, 36, 0.4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.btn-help-emoji {
  background: transparent;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
  line-height: 1;
}
.btn-help-emoji:hover {
  transform: scale(1.15);
}
.sidebar-header .header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-header .logo-icon {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.2);
}
.sidebar-header .header-logo h1 {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #e2e8f0);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sidebar-header .header-logo h1 span {
  font-weight: 400;
  background: linear-gradient(to right, var(--accent-cyan), var(--accent-indigo));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Sidebar Panel */
.sidebar-panel {
  width: 440px;
  min-width: 440px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 80;
  transition: transform 0.3s ease;
}

/* Sidebar Footer Removed */

.sidebar-actions-row {
  display: flex;
  gap: 10px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  background: rgba(8, 11, 18, 0.2);
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  background: rgba(15, 21, 36, 0.5);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 14px 8px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.04);
}

.sidebar-tab-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 20px;
  height: 100%;
}

.tab-pane.active {
  display: flex;
}

/* Panel Sections */
.panel-section {
  background: var(--bg-glass-card);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.element-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-tertiary);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
}

/* Form inputs */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  display: flex;
  flex-direction: column;
}

.label-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 13px;
  transition: all var(--transition-fast);
}

.form-group input[type="text"]:focus,
.form-group textarea:focus {
  border-color: var(--accent-cyan);
  outline: none;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.1);
  background: rgba(15, 21, 36, 0.5);
}

/* Global Palette colors */
.global-palette-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-primary);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.palette-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.palette-color {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  position: relative;
}

.palette-color:hover {
  transform: scale(1.1);
}

.palette-color::after {
  content: '×';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  opacity: 0;
  pointer-events: none;
  text-shadow: 0 0 2px rgba(0,0,0,0.8);
}

.palette-color:hover::after {
  opacity: 1;
}

.add-color-circle {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: transparent;
  border: 1.5px dashed var(--text-muted);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.add-color-circle:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
}

/* Element list in sidebar */
.element-list-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 4px;
}

.empty-list-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 10px;
  text-align: center;
  color: var(--text-dimmed);
  border: 1px dashed var(--border-light);
  border-radius: 6px;
  gap: 10px;
}

.empty-list-placeholder p {
  font-size: 12px;
}

/* Element item card */
.element-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition-fast);
}

.element-card:hover {
  border-color: var(--border-medium);
  background: var(--bg-tertiary);
}

.element-card.active {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.03);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.05);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.card-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}

.card-badge.obj {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.card-badge.text {
  background: rgba(168, 85, 247, 0.15);
  color: #f3e8ff;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

.card-coords {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

.card-body {
  font-size: 12px;
  color: var(--text-main);
  word-break: break-word;
}

.card-body-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  color: var(--text-main);
  font-size: 11px;
  font-family: var(--font-main);
  padding: 4px 6px;
  resize: vertical;
  min-height: 22px;
  max-height: 80px;
  transition: border-color var(--transition-fast);
}
.card-body-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}
.card-body-input::placeholder {
  color: var(--text-dimmed);
}

.card-colors {
  display: flex;
  gap: 4px;
}

.card-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-delete-card {
  background: transparent;
  border: none;
  color: var(--text-dimmed);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.btn-delete-card:hover {
  color: var(--accent-rose);
  background: rgba(244, 63, 94, 0.1);
}

/* Tab 2: JSON View stylesheet */
.json-code-wrapper {
  background: #050811;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  flex: 1;
}

.code-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
}

.code-badge {
  color: var(--accent-cyan);
  font-weight: 600;
}

.json-textarea-block {
  margin: 0;
  padding: 16px;
  border: none;
  background: #050811;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: #34d399; /* beautiful light green code text */
  flex: 1;
  resize: none;
  outline: none;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  transition: color var(--transition-fast);
}

.json-textarea-block:focus {
  color: #f1f5f9; /* brighten to white when focused for editing */
}

/* Simple Syntax Highlighting styles */
.hljs-key { color: #f472b6; }      /* Pink for keys */
.hljs-string { color: #34d399; }   /* Green for strings */
.hljs-number { color: #fbbf24; }   /* Yellow for numbers */
.hljs-boolean { color: #60a5fa; }  /* Blue for booleans */
.hljs-null { color: #a78bfa; }     /* Purple for null */

.schema-guideline-note {
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  padding: 12px;
}

.schema-guideline-note h4 {
  font-size: 12px;
  color: var(--accent-indigo);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.schema-guideline-note p {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.schema-guideline-note code {
  font-family: var(--font-mono);
  background: rgba(0,0,0,0.3);
  padding: 1px 4px;
  border-radius: 3px;
  color: #fff;
}

/* Color Picker Popover styling */
.color-picker-popover {
  position: absolute;
  background: #0f172a;
  border: 1.5px solid var(--border-medium);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 1px 1px rgba(255,255,255,0.05);
  padding: 12px;
  width: 220px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.popover-arrow {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #0f172a;
  border-left: 1.5px solid var(--border-medium);
  border-top: 1.5px solid var(--border-medium);
  transform: rotate(-45deg);
  z-index: 199;
}

.color-picker-content h4 {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}

.color-swatches-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  cursor: pointer;
  transition: transform var(--transition-fast);
}

.color-swatch:hover {
  transform: scale(1.15);
  border-color: #fff;
}

.custom-color-row {
  border-top: 1px solid var(--border-light);
  padding-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-preview-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-preview-container input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 28px;
  height: 20px;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
}

.color-preview-container input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-preview-container input[type="color"]::-webkit-color-swatch {
  border: 1px solid var(--border-medium);
  border-radius: 4px;
}

.custom-color-hex-label {
  font-size: 11px;
  color: var(--text-muted);
}

.hex-input-wrapper {
  display: flex;
  gap: 4px;
}

.hex-input-wrapper input[type="text"] {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  color: #fff;
  border-radius: 4px;
  padding: 4px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  width: 80px;
}

.hex-input-wrapper input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

/* Modal overlays */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 10, 19, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  width: 500px;
  max-width: 90%;
  max-height: 85vh;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), var(--shadow-glow);
  display: flex;
  flex-direction: column;
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h2 {
  font-size: 18px;
  color: #fff;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.close-btn:hover {
  color: #fff;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.modal-body h3 {
  font-size: 14px;
  color: #fff;
  margin-top: 16px;
  margin-bottom: 8px;
}
.modal-body h3:first-child {
  margin-top: 0;
}

.modal-body ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.modal-body li {
  margin-bottom: 6px;
}

.modal-body code {
  font-family: var(--font-mono);
  background: var(--bg-primary);
  padding: 2px 4px;
  border-radius: 3px;
  color: var(--accent-cyan);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
}

/* Toast Alerts */
.toast-container {
  position: fixed;
  top: 24px;
  left: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--border-medium);
  border-left: 4px solid var(--accent-cyan);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  transform: translateX(-120%);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.active {
  transform: translateX(0);
}

.toast.success {
  border-left-color: var(--accent-emerald);
}

.toast.info {
  border-left-color: var(--accent-cyan);
}

.toast.warning {
  border-left-color: var(--accent-purple);
}

/* Sidebar Toggle Button */
.sidebar-toggle-btn {
  display: none;
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 200;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-fast);
}
.sidebar-toggle-btn:hover {
  background: var(--accent-cyan);
  color: #fff;
  border-color: var(--accent-cyan);
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 79;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
  display: block;
}

/* Responsive: Narrow / Mobile */
@media (max-width: 860px) {
  .sidebar-toggle-btn {
    display: flex;
  }

  .sidebar-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: min(440px, 92vw);
    min-width: 0;
    transform: translateX(100%);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.4);
  }

  .sidebar-panel.open {
    transform: translateX(0);
  }

  .canvas-workspace-panel {
    width: 100%;
    min-width: 0;
  }

  /* When boundingBoxes is false on mobile, hide the canvas completely and make the sidebar normal block */
  body.mobile-hide-canvas .canvas-workspace-panel {
    display: none !important;
  }

  body.mobile-hide-canvas .sidebar-panel {
    position: relative !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100vh !important;
    box-shadow: none !important;
  }

  body.mobile-hide-canvas .sidebar-toggle-btn {
    display: none !important;
  }
}

/* Drag and Drop Guide Image Styles */
.floating-guide-btn {
  transition: all 0.2s ease-in-out !important;
}
.floating-guide-btn.dragover {
  background: var(--accent-blue) !important;
  color: white !important;
  transform: scale(1.15) !important;
  border-color: var(--accent-blue-hover) !important;
  box-shadow: 0 0 15px var(--accent-blue) !important;
}
body.window-dragging .floating-guide-btn {
  transform: scale(1.1);
  border: 2px dashed var(--accent-blue) !important;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
  background: rgba(59, 130, 246, 0.15) !important;
}

/* Reference Image Slots */
.reference-image-slot {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-glass-card);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.reference-image-slot.empty-slot {
  border: 2px dashed var(--border-light);
  cursor: pointer;
}

.reference-image-slot.empty-slot:hover, .reference-image-slot.empty-slot.drag-over {
  border-color: var(--accent-indigo);
  background: rgba(99, 102, 241, 0.04);
}

.reference-image-slot.empty-slot .plus-icon {
  font-size: 24px;
  color: var(--text-muted);
  font-weight: 300;
  transition: color var(--transition-fast);
}

.reference-image-slot.empty-slot:hover .plus-icon {
  color: var(--accent-indigo);
}

.reference-image-slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.reference-image-slot .image-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-main);
  font-weight: 500;
}

.reference-image-slot .remove-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(244, 63, 94, 0.85);
  border: none;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  transition: background var(--transition-fast);
}

.reference-image-slot .remove-btn:hover {
  background: var(--accent-rose);
}

.sidebar-panel.reference-active {
  background: linear-gradient(180deg, #180d2b 0%, var(--bg-secondary) 100%);
  border-left: 1px solid rgba(168, 85, 247, 0.3);
}

.sidebar-panel.full-width {
  width: 100% !important;
  max-width: 100% !important;
  flex: 1 !important;
}

/* Canvas Disabled Overlay */
.canvas-workspace-panel.canvas-disabled {
  position: relative;
}

.canvas-workspace-panel.canvas-disabled::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: grayscale(1) blur(2px);
  z-index: 1000;
  pointer-events: all;
}

.canvas-workspace-panel.canvas-disabled::before {
  content: '';
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(to top right, transparent calc(50% - 2px), rgba(255, 255, 255, 0.1) 50%, transparent calc(50% + 2px)),
    linear-gradient(to bottom right, transparent calc(50% - 2px), rgba(255, 255, 255, 0.1) 50%, transparent calc(50% + 2px));
  z-index: 1001;
  pointer-events: none;
}

/* Dice Button Style */
.input-with-action {
  display: flex;
  gap: 8px;
  align-items: center;
  width: 100%;
}
.input-with-action input {
  flex: 1;
  min-width: 0; /* allows shrinking below default size */
}
.dice-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  font-size: 14px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  flex-shrink: 0;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
  user-select: none;
}
.dice-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-medium);
  transform: scale(1.05);
}
.dice-btn:active {
  transform: scale(0.95);
}

.color-dice-btn {
  width: 24px;
  height: 24px;
  font-size: 11px;
  border-radius: 6px;
  background: transparent;
  border: 1.5px dashed var(--text-muted);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.color-dice-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.05);
  transform: scale(1.1);
}

#enhance-toggle:checked + .enhance-toggle-icon {
  filter: none !important;
  opacity: 1 !important;
  text-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
  transform: scale(1.15);
}


/* ==========================================================================
   Result Overlay — SSE image push panel
   ========================================================================== */
.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}
.result-panel {
  position: relative;
  z-index: 1;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.04);
  max-width: min(92vw, 680px);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: resultPanelIn 0.35s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
@keyframes resultPanelIn {
  from { opacity: 0; transform: scale(0.88) translateY(20px); }
  to   { opacity: 1; transform: scale(1)   translateY(0);     }
}
.result-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.result-panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.01em;
}
.result-panel-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.result-panel-close:hover {
  color: var(--text-main);
  background: rgba(255,255,255,0.07);
}
.result-images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 20px;
  overflow-y: auto;
  justify-content: center;
}
.result-image-wrap {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.result-image-wrap img {
  max-width: min(100%, 560px);
  max-height: 60vh;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.result-download-btn {
  font-size: 0.78rem;
  padding: 5px 14px;
}
.result-panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* ==========================================================================
   Generation Progress Bar — overlays logo in sidebar header
   ========================================================================== */
.gen-progress-bar {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 180px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 10;
}
.gen-progress-bar.active {
  opacity: 1;
  pointer-events: auto;
}
/* Hide logo when progress bar is active */
.gen-progress-bar.active ~ .header-logo,
.sidebar-header:has(.gen-progress-bar.active) .header-logo {
  opacity: 0;
  pointer-events: none;
}
.gen-progress-inner {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.gen-progress-label {
  display: flex;
  align-items: center;
  gap: 5px;
}
.gen-progress-icon {
  font-size: 0.85rem;
  animation: genPulse 1.2s ease-in-out infinite;
}
@keyframes genPulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
#gen-progress-text {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.gen-progress-track {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
  width: 100%;
}
.gen-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-indigo));
  border-radius: 99px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}
.gen-progress-pct {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.03em;
  align-self: flex-end;
}

/* Mobile: make progress bar width match available space */
@media (max-width: 768px) {
  .gen-progress-bar {
    width: calc(50vw - 30px);
    max-width: 200px;
  }
}
