/* ==========================================================================
   PhotoTone Studio - Professional Dark Theme & Layout
   ========================================================================== */

:root {
  --bg-app: #080C14;
  --bg-stage: #0D131F;
  --bg-surface: #131B2E;
  --bg-card: #1C263F;
  --bg-card-hover: #243152;
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-card: rgba(255, 255, 255, 0.12);
  --border-active: #3B82F6;

  --color-primary: #3B82F6;
  --color-primary-hover: #2563EB;
  --color-accent: #38BDF8;
  --color-zip: #8B5CF6;
  --color-zip-hover: #7C3AED;
  --color-success: #10B981;
  --color-danger: #EF4444;

  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --text-dim: #64748B;

  --font-sans: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;

  --header-height: 54px;
  --sidebar-width: 350px;
}

/* Custom Sleek Dark Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  user-select: none;
}

/* ==========================================================================
   Header Bar
   ========================================================================== */

.app-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: relative;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.brand-logo {
  width: 30px;
  height: 30px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.brand-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
}

.brand-badge {
  font-size: 0.6rem;
  background: rgba(56, 189, 248, 0.12);
  color: var(--color-accent);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* Metadata Pill */
.header-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  background: rgba(13, 19, 31, 0.75);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
}

.meta-val {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.meta-dot {
  width: 3px;
  height: 3px;
  background: var(--text-dim);
  border-radius: 50%;
}

.meta-preset {
  color: var(--color-accent);
  font-weight: 600;
}

.meta-batch-tag {
  color: #c084fc;
  font-weight: 700;
  background: rgba(192, 132, 252, 0.15);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(192, 132, 252, 0.3);
  font-size: 0.7rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  margin: 0 2px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.45);
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-card);
}

.btn-icon {
  padding: 6px 8px;
}

.btn-zip {
  background: linear-gradient(135deg, var(--color-zip), #6366f1);
  color: #ffffff;
  border: 1px solid rgba(192, 132, 252, 0.4);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

.btn-zip:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--color-zip-hover), #4f46e5);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.6);
}

.btn-file {
  cursor: pointer;
}

.btn-lg {
  padding: 10px 20px;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* Dropdown Menu */
.dropdown-export {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 230px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 2px;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.dropdown-export.open .dropdown-menu {
  display: flex;
}

.dropdown-item {
  font-family: inherit;
  background: transparent;
  border: none;
  color: var(--text-main);
  padding: 8px 10px;
  text-align: left;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-item strong {
  font-size: 0.8rem;
  font-weight: 600;
}

.dropdown-item small {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.dropdown-item:hover {
  background: var(--color-primary);
}

.dropdown-item:hover small {
  color: rgba(255, 255, 255, 0.8);
}

/* ==========================================================================
   Studio Layout
   ========================================================================== */

.studio-layout {
  display: flex;
  height: calc(100vh - var(--header-height));
  width: 100vw;
  overflow: hidden;
}

/* Stage Area */
.stage-container {
  flex: 1;
  height: 100%;
  background: var(--bg-stage);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Dropzone Empty State */
.dropzone {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.dropzone-card {
  max-width: 520px;
  width: 100%;
  background: var(--bg-surface);
  border: 1px dashed var(--border-card);
  border-radius: var(--radius-lg);
  padding: 36px 28px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.dropzone-glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 80px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
  pointer-events: none;
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: rgba(56, 189, 248, 0.1);
  color: var(--color-accent);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
}

.dropzone-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.dropzone-subtitle {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-bottom: 22px;
  line-height: 1.45;
}

.dropzone-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.dropzone-tip {
  font-size: 0.72rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

.dropzone-tip code {
  background: var(--bg-card);
  color: var(--color-accent);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
}

/* Canvas Viewport */
.canvas-viewport {
  flex: 1;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 20px 20px;
  overflow: hidden;
  padding: 16px;
}

.canvas-wrapper {
  position: relative;
  max-width: 100%;
  max-height: calc(100vh - var(--header-height) - 48px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  background: #000;
  margin: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.canvas-viewport.has-filmstrip .canvas-wrapper {
  max-height: calc(100vh - var(--header-height) - 105px);
  margin-bottom: auto;
}

#mainCanvas {
  max-width: 100%;
  max-height: calc(100vh - var(--header-height) - 52px);
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

.canvas-viewport.has-filmstrip #mainCanvas {
  max-height: calc(100vh - var(--header-height) - 110px);
}

/* Split Comparison Slider */
.split-slider-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.split-before-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
  border-right: 2px solid #ffffff;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.6);
}

#beforeCanvas {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  display: block;
}

.split-divider {
  position: absolute;
  top: 0;
  left: 50%;
  height: 100%;
  width: 2px;
  background: #ffffff;
  pointer-events: all;
  cursor: ew-resize;
  transform: translateX(-50%);
}

.split-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  background: #ffffff;
  color: #0f172a;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Floating Controls */
.floating-controls {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(19, 27, 46, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-full);
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 40;
  transition: bottom 0.2s ease;
}

.canvas-viewport.has-filmstrip .floating-controls {
  bottom: 82px;
}

.pill-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.12s;
}

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

.pill-btn.active {
  background: var(--color-primary);
  color: #ffffff;
}

.pill-divider {
  width: 1px;
  height: 14px;
  background: var(--border-subtle);
}

/* ==========================================================================
   Bottom Batch Filmstrip Component (Dock Style)
   ========================================================================== */

.batch-filmstrip {
  width: 100%;
  height: 72px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 16px;
  position: relative;
  z-index: 30;
  margin-top: auto;
}

.filmstrip-bar {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 12px;
}

.filmstrip-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}

.filmstrip-tag {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--color-accent);
}

.filmstrip-count {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filmstrip-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  flex: 1;
  padding: 4px 2px;
  align-items: center;
}

.filmstrip-item {
  flex-shrink: 0;
  width: 66px;
  height: 44px;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: var(--radius-xs);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.12s;
}

.filmstrip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.filmstrip-item:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.3);
}

.filmstrip-item.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.filmstrip-item .remove-thumb {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  border: none;
  cursor: pointer;
}

.filmstrip-item:hover .remove-thumb {
  display: flex;
}

.filmstrip-item .thumb-idx {
  position: absolute;
  bottom: 1px;
  left: 2px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: 0.5rem;
  font-weight: 700;
  padding: 0 3px;
  border-radius: 2px;
  font-family: var(--font-mono);
}

.filmstrip-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.btn-filmstrip {
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.12s;
}

.btn-filmstrip:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-card);
}

.btn-danger-film {
  color: #f87171;
}

.btn-danger-film:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
}

/* ==========================================================================
   Sidebar Panel
   ========================================================================== */

.sidebar-panel {
  width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* RGB Histogram */
.histogram-card {
  padding: 10px 14px 6px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(13, 19, 31, 0.4);
}

.histogram-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.panel-section-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.live-dot {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--color-success);
  display: flex;
  align-items: center;
  gap: 4px;
}

.dot-pulse {
  width: 5px;
  height: 5px;
  background: var(--color-success);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px var(--color-success);
}

#histogramCanvas {
  width: 100%;
  height: 48px;
  background: #080D18;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
  display: block;
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  background: rgba(13, 19, 31, 0.5);
  border-bottom: 1px solid var(--border-subtle);
  padding: 3px;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.12s;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--bg-card);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Tab Content Areas */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

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

/* Presets Intensity & Quick Chips */
.intensity-group {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.intensity-chips {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.chip-btn {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 0;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.12s;
}

.chip-btn:hover {
  color: #fff;
  border-color: var(--color-primary);
}

.chip-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* Category Filter Pills (Sticky horizontal bar) */
.category-filter-wrapper {
  margin-bottom: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  position: sticky;
  top: -12px;
  background: var(--bg-surface);
  z-index: 10;
  padding-top: 2px;
}

.category-pills {
  display: flex;
  gap: 4px;
  width: max-content;
}

.cat-pill {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.12s;
}

.cat-pill:hover {
  color: #fff;
  background: var(--bg-card-hover);
}

.cat-pill.active {
  background: var(--color-accent);
  color: #080C14;
  font-weight: 700;
  border-color: var(--color-accent);
}

/* Preset Category Section Header */
.preset-category-header {
  grid-column: 1 / -1;
  font-size: 0.68rem;
  font-weight: 800;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 6px;
  margin-bottom: -2px;
  border-top: 1px dashed var(--border-subtle);
}

.preset-category-header:first-child {
  border-top: none;
  padding-top: 0;
}

/* Preset Grid & Compact Cards */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.preset-card {
  background: var(--bg-card);
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
  text-align: left;
}

.preset-card:hover {
  transform: translateY(-1px);
  background: var(--bg-card-hover);
  border-color: var(--border-card);
}

.preset-card.active {
  border-color: var(--color-primary);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.preset-preview-box {
  width: 100%;
  height: 38px;
  border-radius: var(--radius-xs);
  margin-bottom: 5px;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.preset-badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  font-size: 0.52rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  backdrop-filter: blur(4px);
}

.preset-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-desc {
  font-size: 0.62rem;
  color: var(--text-muted);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Adjust Tab Sliders */
.adjust-group {
  margin-bottom: 14px;
}

.adjust-group-title {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-accent);
  margin-bottom: 8px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border-subtle);
}

.slider-item {
  margin-bottom: 10px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.slider-header label {
  font-size: 0.74rem;
  color: var(--text-main);
  font-weight: 500;
}

.slider-value {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--color-accent);
  background: rgba(56, 189, 248, 0.08);
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  min-width: 32px;
  text-align: right;
}

/* Range Input Styling */
.range-slider {
  -webkit-appearance: none;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-card-hover);
  outline: none;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 1.5px solid #ffffff;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease;
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: var(--color-accent);
}

.range-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 1.5px solid #ffffff;
  cursor: pointer;
}

/* ==========================================================================
   Batch Modal Progress & Spinner
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 12, 20, 0.88);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.modal-card {
  width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.7);
}

.modal-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  background: rgba(139, 92, 246, 0.15);
  color: var(--color-zip);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spin {
  animation: spinAnim 1.5s linear infinite;
}

@keyframes spinAnim {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: var(--bg-stage);
  border-radius: var(--radius-full);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  margin-bottom: 12px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-zip));
  border-radius: var(--radius-full);
  transition: width 0.12s ease;
}

.modal-subtext {
  font-size: 0.7rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--bg-surface);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-primary);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 860px) {
  body {
    overflow: auto;
  }
  .studio-layout {
    flex-direction: column;
    height: auto;
  }
  .sidebar-panel {
    width: 100%;
    height: auto;
  }
  .canvas-viewport {
    min-height: 50vh;
  }
}
