/* ==========================================================================
   StudioShot - AI Product Photo Editor
   Design Constitution: Clean, minimal, premium, bright, restrained & elegant.
   ========================================================================== */

:root {
  /* Color Palette - Refined Neutral & Bright Studio Tones */
  --bg-app: #fcfcfd;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-hover: #f1f5f9;
  --bg-active: #e2e8f0;
  
  /* Borders */
  --border-light: #f1f5f9;
  --border-medium: #e2e8f0;
  --border-dark: #cbd5e1;
  --border-focus: #0f172a;

  /* Typography */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;
  --text-inverse: #ffffff;

  /* Accent & Brand */
  --brand-primary: #090d16;
  --brand-primary-hover: #1e293b;
  --brand-accent: #2563eb;
  --brand-accent-subtle: #eff6ff;
  --brand-emerald: #10b981;
  --brand-emerald-subtle: #ecfdf5;

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.03);
  --shadow-dock: 0 12px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.05);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-normal: 250ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  overflow-x: hidden;
}

/* App Wrapper */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Header Component
   ========================================================================== */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 54px;
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
}

.header-container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #090d16 0%, #1e293b 100%);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.15);
}

.brand-text-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.brand-kicker {
  font-size: 0.725rem;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 3px 9px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-full);
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--brand-emerald);
  box-shadow: 0 0 0 2px var(--brand-emerald-subtle);
}

.header-reset-btn {
  font-size: 0.775rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ==========================================================================
   Alert / Notification Banner
   ========================================================================== */
.alert-banner {
  width: calc(100% - 2.5rem);
  max-width: 1200px;
  margin: 0.75rem auto 0;
  padding: 0.65rem 1rem;
  background-color: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  animation: slideDown 200ms ease;
}

.alert-content {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: #9f1239;
  font-weight: 500;
}

.alert-icon {
  flex-shrink: 0;
  display: flex;
  color: #e11d48;
}

.alert-message {
  line-height: 1.4;
}

.alert-dismiss {
  background: none;
  border: none;
  color: #be123c;
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: var(--radius-sm);
  transition: opacity var(--transition-fast);
}

.alert-dismiss:hover {
  opacity: 0.7;
}

/* ==========================================================================
   Main Content Layout
   ========================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.screen-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   Screen 1: Upload View (Viewport-Aware, Fits in 1440x900 without scroll)
   ========================================================================== */
.upload-view {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(1rem, 2.5vh, 2rem) 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
}

.upload-hero {
  text-align: center;
  max-width: 700px;
  margin-bottom: clamp(0.9rem, 2vh, 1.4rem);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.725rem;
  font-weight: 600;
  color: #1e40af;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: clamp(1.35rem, 2.3vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.hero-subtitle {
  font-size: clamp(0.85rem, 1.05vw, 0.95rem);
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Upload Card & Dropzone */
.upload-card {
  width: 100%;
  max-width: 760px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  padding: clamp(1rem, 2vh, 1.35rem);
  display: flex;
  flex-direction: column;
  gap: clamp(0.9rem, 1.8vh, 1.2rem);
}

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  padding: clamp(1.6rem, 3.5vh, 2.5rem) 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  outline: none;
}

.dropzone:hover,
.dropzone.drag-active {
  border-color: var(--brand-accent);
  background-color: var(--brand-accent-subtle);
  transform: translateY(-1px);
}

.dropzone:focus-visible {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.1);
}

.file-input-hidden {
  display: none;
}

.dropzone-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  pointer-events: none;
}

.dropzone-icon-ring {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal);
}

.dropzone:hover .dropzone-icon-ring {
  transform: scale(1.05);
  color: var(--brand-accent);
  border-color: #bfdbfe;
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.primary-text {
  font-size: 0.975rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.secondary-text {
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.browse-link {
  color: var(--brand-accent);
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  pointer-events: auto;
}

.browse-link:hover {
  color: #1d4ed8;
}

.dropzone-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-size: 0.725rem;
  color: var(--text-tertiary);
  margin-top: 0.2rem;
}

.meta-tag {
  font-weight: 500;
}

.meta-dot {
  opacity: 0.5;
}

/* Sample Product Tray */
.sample-tray {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-medium);
}

.sample-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.sample-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.sample-card {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
}

.sample-card:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-dark);
  box-shadow: var(--shadow-xs);
  transform: translateY(-1px);
}

.sample-preview {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-primary);
}

.sample-bg-cosmetics {
  background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);
  color: #db2777;
}

.sample-bg-watch {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  color: #334155;
}

.sample-bg-sneaker {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  color: #059669;
}

.sample-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sample-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sample-desc {
  font-size: 0.685rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Upload Supporting Features */
.upload-features {
  width: 100%;
  max-width: 820px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-top: clamp(1.1rem, 2.5vh, 1.8rem);
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.feature-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  flex-shrink: 0;
}

.feature-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.feature-text strong {
  font-size: 0.785rem;
  font-weight: 600;
  color: var(--text-primary);
}

.feature-text span {
  font-size: 0.715rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

/* ==========================================================================
   Screen 2: Editor Screen (Desktop Two-Column Workspace)
   ========================================================================== */
.editor-view {
  width: 100%;
  height: calc(100vh - 54px);
  max-height: calc(100vh - 54px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 1fr 410px;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ==========================================================================
   Left Column: Viewport / Workspace Canvas
   ========================================================================== */
.workspace-viewport {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #f8fafc;
  border-right: 1px solid var(--border-medium);
  overflow: hidden;
  position: relative;
}

.viewport-header {
  height: 50px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-medium);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 0.75rem;
}

.viewport-title-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.viewport-label {
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.image-meta-text {
  font-size: 0.725rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text-tertiary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
}

/* View Mode Tabs (Segmented Control) */
.view-tabs {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background-color: #f1f5f9;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  gap: 2px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 4px 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

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

.tab-btn.active {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

/* Viewport Stage / Canvas */
.viewport-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  position: relative;
  overflow: hidden;
  background-image: 
    radial-gradient(rgba(15, 23, 42, 0.05) 1px, transparent 0),
    radial-gradient(rgba(15, 23, 42, 0.05) 1px, #f8fafc 0);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
}

.stage-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Single Image View Card */
.single-container {
  max-width: 100%;
  max-height: 100%;
}

.single-pane-card {
  width: 100%;
  height: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
}

/* Split Comparison View Cards (Side by Side) */
.split-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  width: 100%;
  height: 100%;
  position: relative;
}

.split-pane-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
  box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.05), 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: all var(--transition-normal);
}

.split-pane-card.split-pane-result {
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.1), 0 8px 24px -4px rgba(15, 23, 42, 0.08);
}

/* Pane Card Header Bar */
.pane-header {
  height: 38px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-medium);
  padding: 0 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.pane-header-result {
  background: linear-gradient(90deg, #f8fafc 0%, #eff6ff 100%);
  border-bottom-color: #dbeafe;
}

.pane-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pane-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pane-indicator-original {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-tertiary);
}

.pane-indicator-result {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  background-color: #2563eb;
  color: #ffffff;
}

.pane-title {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pane-status {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.pane-badge {
  font-size: 0.675rem;
  font-weight: 600;
  color: #1e40af;
  background: #dbeafe;
  border: 1px solid #bfdbfe;
  padding: 1px 7px;
  border-radius: var(--radius-full);
}

/* Image Surface Container */
.image-wrapper {
  flex: 1;
  width: 100%;
  height: calc(100% - 38px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  position: relative;
  background: radial-gradient(#ffffff 0%, #f8fafc 100%);
  overflow: hidden;
}

.preview-image {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  transition: transform var(--transition-normal);
}

/* ==========================================================================
   REDESIGNED RESULT ACTIONS DOCK
   Floating, elevated action bar docked inside the viewport, not stuck to edges.
   ========================================================================== */
.result-action-dock {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  box-shadow: var(--shadow-dock);
  border-radius: var(--radius-full);
  padding: 5px 6px 5px 14px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideUpFade 220ms cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.dock-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.dock-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--brand-emerald);
  box-shadow: 0 0 0 2px var(--brand-emerald-subtle);
}

.dock-status-text {
  font-size: 0.775rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.dock-divider {
  width: 1px;
  height: 18px;
  background-color: var(--border-medium);
}

.dock-buttons {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

/* Primary and Secondary Dock Buttons */
.btn-dock-secondary {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-full);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  font-size: 0.785rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-dock-secondary:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-dark);
  color: var(--text-primary);
}

.btn-dock-primary {
  height: 34px;
  padding: 0 16px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, #090d16 0%, #1e293b 100%);
  border: 1px solid #0f172a;
  color: #ffffff;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.15), 0 2px 4px rgba(15, 23, 42, 0.08);
  transition: all var(--transition-fast);
}

.btn-dock-primary:hover {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
  transform: translateY(-1px);
}

.btn-dock-primary:active {
  transform: translateY(0);
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 200ms ease;
}

.loading-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.loading-card {
  position: relative;
  z-index: 41;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-xl);
  padding: 1.6rem 2rem;
  width: 90%;
  max-width: 370px;
  text-align: center;
  box-shadow: var(--shadow-lg), 0 20px 40px rgba(15, 23, 42, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}

.spinner-container {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--border-medium);
  border-top-color: var(--brand-accent);
  animation: spin 1s linear infinite;
}

.spinner-core {
  color: var(--brand-accent);
  display: flex;
  animation: pulseGlow 2s ease-in-out infinite;
}

.loading-text-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.loading-title {
  font-size: 0.925rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.loading-step {
  font-size: 0.785rem;
  color: var(--text-secondary);
  line-height: 1.4;
  min-height: 2.2em;
}

.loading-bar {
  width: 100%;
  height: 4px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.loading-bar-progress {
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  border-radius: var(--radius-full);
  animation: indeterminateBar 1.5s ease-in-out infinite;
}

/* ==========================================================================
   Right Column: Workspace Sidebar (Controls & Instructions)
   ========================================================================== */
.workspace-sidebar {
  background-color: var(--bg-surface);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.sidebar-scroll {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  overflow-y: auto;
  height: 100%;
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

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

.section-title-wrapper {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-primary);
}

.section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
}

.section-hint {
  font-size: 0.715rem;
  color: var(--text-tertiary);
}

.clear-btn {
  font-size: 0.725rem;
  font-weight: 500;
  color: var(--text-tertiary);
  background: none;
  border: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.clear-btn:hover {
  color: var(--text-primary);
}

/* Quick Actions Grid */
.quick-actions-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  outline: none;
}

.quick-action-btn:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-dark);
  box-shadow: var(--shadow-xs);
  transform: translateX(2px);
}

.quick-action-btn:focus-visible {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 2px var(--brand-accent-subtle);
}

.quick-action-btn.active {
  background-color: #eff6ff;
  border-color: #93c5fd;
  color: #1e40af;
}

.quick-action-btn.active .action-icon {
  background-color: #dbeafe;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.action-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.action-text {
  display: flex;
  flex-direction: column;
}

.action-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.action-desc {
  font-size: 0.685rem;
  color: var(--text-tertiary);
}

.quick-action-btn.active .action-desc {
  color: #3b82f6;
}

/* Instruction Textarea */
.instruction-box {
  width: 100%;
}

.instruction-textarea {
  width: 100%;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  padding: 0.7rem;
  font-family: inherit;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-primary);
  background-color: var(--bg-surface);
  resize: vertical;
  min-height: 80px;
  max-height: 160px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.instruction-textarea:focus {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.instruction-textarea::placeholder {
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

/* Example Instructions */
.example-instructions-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.2rem;
}

.examples-heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
}

.example-chips {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.example-chip {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  padding: 0.42rem 0.55rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all var(--transition-fast);
  outline: none;
}

.example-chip:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-dark);
  transform: translateX(2px);
}

.chip-arrow {
  display: flex;
  color: var(--text-tertiary);
  margin-top: 0.15rem;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.example-chip:hover .chip-arrow {
  color: var(--brand-accent);
  transform: translateX(1px);
}

.chip-text {
  font-size: 0.735rem;
  color: var(--text-secondary);
  line-height: 1.35;
}

.example-chip:hover .chip-text {
  color: var(--text-primary);
}

/* Sidebar Footer & Execution Button */
.control-footer {
  margin-top: auto;
  padding-top: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.btn-execute {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.behavior-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-tertiary);
  text-align: center;
}

/* ==========================================================================
   Buttons & Core Components
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  outline: none;
}

.btn-sm {
  font-size: 0.75rem;
  padding: 0.35rem 0.65rem;
  height: 30px;
}

.btn-md {
  font-size: 0.825rem;
  padding: 0.45rem 0.9rem;
  height: 38px;
}

.btn-lg {
  font-size: 0.9rem;
  padding: 0.7rem 1.2rem;
  height: 44px;
}

.btn-primary {
  background: linear-gradient(135deg, #090d16 0%, #1e293b 100%);
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12), 0 2px 4px rgba(15, 23, 42, 0.08);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  box-shadow: 0 4px 8px rgba(15, 23, 42, 0.16);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

/* Shake Animation for Validation Error */
.shake {
  animation: shake 400ms cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Keyframes
   ========================================================================== */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.8; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes indeterminateBar {
  0% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
  100% { transform: translateX(250%); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideUpFade {
  from { transform: translate(-50%, 12px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
  .workspace-layout {
    grid-template-columns: 1fr 350px;
  }
}

@media (max-width: 820px) {
  .editor-view {
    height: auto;
    max-height: none;
    overflow-y: auto;
  }

  .workspace-layout {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }

  .workspace-viewport {
    height: 65vh;
    min-height: 420px;
    border-right: none;
    border-bottom: 1px solid var(--border-medium);
  }

  .workspace-sidebar {
    height: auto;
    overflow: visible;
  }

  .sample-cards {
    grid-template-columns: 1fr;
  }

  .upload-features {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .split-container {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .result-action-dock {
    width: calc(100% - 2rem);
    justify-content: space-between;
    padding: 6px 10px;
  }
}
