/* ==========================================================================
   GROWARQ STUDIO - GOOGLE ANTIGRAVITY WARM DARK AESTHETIC DESIGN SYSTEM
   Warm Dark Obsidian, Warm Hairlines, Google Clean Blue Accent & High Precision.
   ========================================================================== */

:root {
  /* Superfícies Warm Dark Antigravity */
  --bg-app: #1e1e1a;            /* Fundo principal do workspace */
  --bg-sidebar: #161613;        /* Barras laterais e explorer */
  --bg-sidebar-header: #131310; /* Barra superior e headers */
  --bg-header: #131310;         /* Barra superior de navegação */
  --bg-main: #1e1e1a;           /* Área de arquivos */
  --bg-card: #22221d;           /* Cards e containers */
  --bg-card-hover: #292923;     /* Hover interativo */
  --bg-active: #2f2f28;         /* Estado selecionado */
  --bg-input: #141411;          /* Campos internos e switches */

  /* Linhas e Bordas Sutis */
  --border-subtle: #2f2f29;     /* Linhas divisórias */
  --border-card: #282822;       /* Bordas de cards */
  --border-hover: #3a3a33;      /* Borda ao passar mouse */
  --border-active: #8ab4f8;     /* Borda de foco Google Blue */
  --border-focus: #8ab4f8;

  /* Acentos Antigravity */
  --accent-blue: #8ab4f8;       /* Google Blue Tech */
  --accent-blue-bg: rgba(138, 180, 248, 0.12);
  --accent-blue-hover: #aecbfa;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --accent-spark: #f59e0b;      /* Sparkle Dourado */
  --accent-coral: #f43f5e;
  --accent-emerald: #34d399;
  --accent-amber: #fbbf24;

  /* Tipografia com Relação de Contraste Perfeita */
  --text-primary: #f3f3ee;      /* Títulos e itens ativos */
  --text-secondary: #a8a89b;    /* Labels e textos de leitura */
  --text-muted: #78786d;        /* Metadados e legendas */

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, monospace;

  --sidebar-left-width: 240px;
  --sidebar-right-width: 340px;
  --header-height: 44px;
  --radius-sm: 4px;
  --radius-md: 6px;
}

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

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

/* Scrollbars */
::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(120, 120, 109, 0.35);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(120, 120, 109, 0.6);
}

/* ==========================================================================
   TOP HEADER (ANTIGRAVITY STYLE)
   ========================================================================== */
.top-header, .app-header {
  height: var(--header-height);
  min-height: var(--header-height);
  max-height: var(--header-height);
  background: var(--bg-header);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 50;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.brand-logo svg {
  height: 22px;
  width: auto;
}

.brand-tag {
  font-size: 0.62rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
  border: 1px solid rgba(138, 180, 248, 0.25);
  padding: 1px 5px;
  border-radius: 3px;
}

.breadcrumbs-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-sans);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: 8px;
}

.breadcrumbs-bar span.active-crumb {
  color: var(--text-primary);
  font-weight: 600;
}

/* Discrete Antigravity-style Sidebar Toggle Button */
.btn-sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  width: 26px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.btn-sidebar-toggle:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.btn-sidebar-toggle.active {
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
  border-color: rgba(138, 180, 248, 0.25);
}

.btn-icon-action {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 500;
  transition: all 0.15s;
}

.btn-icon-action:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* ==========================================================================
   APP WORKSPACE 3-COLUMN FLEX CONTAINER (ROCK-SOLID PINNED LAYOUT)
   ========================================================================== */
.app-container {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  position: relative;
  width: 100%;
}

/* 1. LEFT SIDEBAR: FILE EXPLORER */
.explorer-sidebar {
  width: var(--sidebar-left-width);
  min-width: var(--sidebar-left-width);
  max-width: var(--sidebar-left-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  padding: 12px 10px;
}

.app-container.left-collapsed .explorer-sidebar {
  margin-left: calc(-1 * var(--sidebar-left-width));
}

.explorer-header {
  padding: 0 4px 8px 4px;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border-bottom: none;
}

.explorer-tree {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tree-node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 3px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.tree-node:hover {
  background: var(--bg-card);
  color: var(--text-primary);
}

.tree-node.active {
  background: var(--bg-active);
  color: var(--text-primary);
  font-weight: 600;
  border-left: 2px solid var(--accent-blue);
}

.tree-node.active svg {
  stroke: var(--accent-blue);
}

.tree-node.drag-over {
  background: rgba(138, 180, 248, 0.15);
  border: 1px dashed var(--accent-blue);
}

.tree-chevron {
  width: 12px;
  height: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.tree-chevron.open {
  transform: rotate(90deg);
}

.tree-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tree-icon svg {
  width: 14px;
  height: 14px;
  stroke: var(--text-secondary);
  fill: rgba(255, 255, 255, 0.04);
}

.tree-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-badge {
  font-size: 0.68rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: transparent;
  padding: 0;
  font-weight: 500;
}

.tree-node.active .tree-badge {
  color: var(--text-primary);
  font-weight: 600;
}

.tree-node:hover .tree-dots-btn {
  opacity: 1;
}

.tree-dots-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.tree-dots-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.tree-subgroup {
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 2px;
  border-left: 1px solid var(--border-subtle);
  margin-left: 12px;
}

/* SLEEK CONTEXT DROPDOWN MENU */
.context-dropdown-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  z-index: 99999;
  min-width: 170px;
  animation: fadeIn 0.12s ease;
  backdrop-filter: blur(12px);
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.8rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.12s;
}

.context-menu-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.context-menu-item.danger {
  color: #f87171;
}

.context-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.context-color-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0.45rem 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 0.25rem;
}

.color-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  border: 1.5px solid transparent;
}

.color-swatch:hover {
  transform: scale(1.25);
  box-shadow: 0 0 8px currentColor;
}

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

/* 2. CENTER MAIN WORKSPACE (ALWAYS TAKES 100% OF AVAILABLE MIDDLE SPACE) */
.main-workspace {
  flex: 1;
  min-width: 0;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 24px;
  gap: 18px;
}

/* LIVE RENDER PROGRESS CARD (MINIMALIST & DISCREET) */
.render-progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  animation: fadeIn 0.2s ease;
}

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

.progress-status-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-primary);
}

.pulsing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 8px var(--accent-blue);
  animation: pulseDot 1.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.progress-percent {
  font-size: 0.76rem;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-blue);
}

.progress-bar-bg {
  width: 100%;
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent-blue);
  border-radius: 2px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* HERO COMPARISON VIEWER */
.hero-viewer {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: none;
  flex-direction: column;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease;
}

.hero-viewer.active {
  display: flex;
}

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

.viewer-stage {
  position: relative;
  width: 100%;
  height: 420px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
}

.viewer-split-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff;
  z-index: 30;
  cursor: ew-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 12px rgba(0,0,0,0.8);
}

.split-bubble {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  font-weight: 800;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

/* Segmented Viewer Mode Pill */
.viewer-mode-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.viewer-mode-btn {
  background: transparent;
  border: none;
  border-radius: 3px;
  padding: 4px 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}

.viewer-mode-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

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

.viewer-mode-btn.active {
  background: var(--bg-active);
  color: var(--accent-blue);
  border: 1px solid var(--border-active);
}

/* Hero Viewer Auto-Aligned Slider */
.viewer-slider-wrap {
  width: 100%;
  height: 100%;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative;
  margin: 0 auto;
}

.viewer-slider-frame {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  user-select: none;
  margin: 0 auto;
}

.viewer-img-after-el {
  max-width: 100%;
  max-height: 380px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.viewer-before-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #ffffff;
  pointer-events: none;
}

.viewer-img-before-el {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
}

/* Side-by-Side View Mode */
.viewer-stage.mode-side .viewer-slider-wrap {
  display: flex !important;
  align-items: center;
  justify-content: center;
}

.viewer-stage.mode-side .viewer-slider-frame {
  display: flex !important;
  gap: 8px;
  box-shadow: none;
  background: transparent;
}

.viewer-stage.mode-side .viewer-before-overlay {
  position: relative !important;
  width: auto !important;
  height: auto !important;
  clip-path: none !important;
  background: transparent !important;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.viewer-stage.mode-side .viewer-img-before-el,
.viewer-stage.mode-side .viewer-img-after-el {
  max-height: 380px !important;
  max-width: 45% !important;
  border-radius: 4px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.viewer-stage.mode-side .viewer-split-bar {
  display: none !important;
}

/* Single View Mode */
.viewer-stage.mode-single .viewer-before-overlay,
.viewer-stage.mode-single .viewer-split-bar {
  display: none !important;
}

.viewer-stage.mode-single .viewer-img-after-el {
  max-width: 100% !important;
  max-height: 380px !important;
  clip-path: none !important;
}

/* FILES & FOLDERS GRID SECTION (FULL SCREEN GALLERY) */
.files-grid-section {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  min-height: 0;
}

.files-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.files-grid-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Floating Selection Action Bar */
.floating-selection-bar {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--accent-blue);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.floating-selection-badge {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
  padding: 2px 7px;
  border-radius: 999px;
}

.files-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  grid-auto-rows: max-content;
  gap: 10px;
  position: relative;
  overflow-y: auto;
  padding-right: 4px;
}

/* Marquee Selection Rectangle (Windows Explorer Style) */
.selection-marquee {
  position: absolute;
  background: rgba(138, 180, 248, 0.18);
  border: 1px solid rgba(138, 180, 248, 0.8);
  pointer-events: none;
  z-index: 100;
  border-radius: 2px;
}

/* Folder Card */
.folder-card-item {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-card);
  border-radius: 5px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.folder-card-item:hover {
  background: var(--bg-card);
  border-color: var(--border-hover);
}

.folder-card-item.active-folder,
.folder-card-item.active {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-top: 2px solid var(--accent-blue);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.folder-card-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-secondary);
}

.folder-card-item.active-folder .folder-card-icon svg,
.folder-card-item.active .folder-card-icon svg {
  stroke: var(--accent-blue);
}

.folder-card-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.folder-card-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* File Card */
.file-item {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-card);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: all 0.15s;
}

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

.file-item.selected {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 1px var(--accent-blue);
  background: var(--bg-active);
}

.file-thumb {
  width: 100%;
  height: 110px;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-input);
}

.file-meta {
  padding: 0.5rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.file-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-subtext {
  font-size: 0.62rem;
  color: var(--text-muted);
}

/* 3. RIGHT SIDEBAR: RENDER CONTROLS PANEL (ALWAYS PINNED TO THE RIGHT) */
.controls-sidebar {
  width: var(--sidebar-right-width);
  min-width: var(--sidebar-right-width);
  max-width: var(--sidebar-right-width);
  background: var(--bg-sidebar);
  border-left: 1px solid var(--border-subtle);
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  transition: margin-right 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
  box-sizing: border-box;
}

.app-container.right-collapsed .controls-sidebar {
  margin-right: calc(-1 * var(--sidebar-right-width));
}

.control-card, .param-card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 5px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-sizing: border-box;
}

.control-card-title, .param-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.02em;
}

.control-card-title svg, .param-card-title svg {
  width: 13px;
  height: 13px;
  stroke: var(--text-muted);
  fill: none;
  flex-shrink: 0;
}

/* Mood Grid */
.mood-grid-v2, .param-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 100%;
}

.mood-card-v2, .opt-btn {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  height: 28px;
  min-height: 28px;
  padding: 0 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.69rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
  text-align: center;
  white-space: nowrap;
  letter-spacing: -0.01em;
  min-width: 0;
  box-sizing: border-box;
}

.mood-card-v2 svg, .opt-btn svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.mood-card-v2:hover, .opt-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.mood-card-v2.active, .opt-btn.active, .opt-btn.active-blue {
  background: var(--bg-active);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 0 8px rgba(138, 180, 248, 0.1);
}

.mood-card-v2.active svg, .opt-btn.active svg, .opt-btn.active-blue svg {
  color: var(--accent-blue);
  stroke: var(--accent-blue);
}

/* Ambientation Grid */
.ambientation-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.ambientation-card {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  height: 28px;
  min-height: 28px;
  padding: 0 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
  box-sizing: border-box;
}

.ambientation-card svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  flex-shrink: 0;
}

.ambientation-card:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.ambientation-card.active {
  background: var(--bg-active);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 0 8px rgba(138, 180, 248, 0.1);
}

.ambientation-card.active svg {
  color: var(--accent-blue);
  stroke: var(--accent-blue);
}

/* Aspect Ratio Grid */
.ratio-grid, #aspect-ratio-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.ratio-card, #aspect-ratio-selector .res-card-v2 {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  height: 28px;
  min-height: 28px;
  padding: 0 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
  white-space: nowrap;
  box-sizing: border-box;
}

.ratio-card svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
}

.ratio-card:hover, #aspect-ratio-selector .res-card-v2:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.ratio-card.active, #aspect-ratio-selector .res-card-v2.active {
  background: var(--bg-active);
  border: 1px solid var(--border-active);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 0 8px rgba(138, 180, 248, 0.1);
}

/* Resolution Grid */
.res-grid-v2 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}

.res-card-v2 {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  height: 28px;
  min-height: 28px;
  padding: 0 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s;
  white-space: nowrap;
  box-sizing: border-box;
}

.res-card-v2 .res-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.res-card-v2 .res-tag,
.res-card-v2 .res-price {
  font-size: 0.65rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.res-card-v2:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.res-card-v2.active {
  background: var(--bg-active);
  border: 1px solid var(--border-active);
  box-shadow: 0 0 8px rgba(138, 180, 248, 0.1);
}

.res-card-v2.active .res-title {
  color: var(--text-primary);
}

.res-card-v2.active .res-tag,
.res-card-v2.active .res-price {
  color: var(--accent-blue);
}

/* Engine Grid */
.engine-grid-v2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.engine-card-v2 {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 5px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.15s;
}

.engine-card-v2:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.engine-card-v2.active {
  background: var(--bg-active);
  border: 1px solid var(--border-active);
}

/* Primary Render Action Button */
.btn-primary-action {
  width: 100%;
  background: var(--accent-gradient);
  border: none;
  border-radius: 4px;
  padding: 7px 10px;
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
  transition: all 0.15s;
}

.btn-primary-action:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.45);
}

.btn-primary-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none !important;
  background: #20201c !important;
  border: 1px solid var(--border-subtle) !important;
  color: var(--text-muted) !important;
}

/* ==========================================================================
   HIGH-DEFINITION IMAGE ZOOM & PAN LIGHTBOX
   ========================================================================== */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(18, 18, 15, 0.96);
  backdrop-filter: blur(14px);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
  user-select: none;
}

.lightbox-toolbar {
  height: 48px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.2rem;
  z-index: 10;
}

.lightbox-title-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 50%;
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.lightbox-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 5px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: all 0.15s;
}

.lightbox-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
}

.lightbox-btn:hover {
  background: var(--bg-active);
  color: var(--text-primary);
  border-color: var(--accent-blue);
}

.lightbox-zoom-badge {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent-blue);
  background: var(--accent-blue-bg);
  border: 1px solid rgba(138, 180, 248, 0.25);
  padding: 3px 7px;
  border-radius: 4px;
  min-width: 48px;
  text-align: center;
}

.lightbox-btn-close {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  margin-left: 0.4rem;
}

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

.lightbox-counter-badge {
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: 4px;
  margin-left: 0.6rem;
}

/* Lightbox Navigation Buttons */
.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(22, 22, 19, 0.85);
  border: 1px solid var(--border-subtle);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 60;
  backdrop-filter: blur(8px);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
  opacity: 0.75;
}

.lightbox-nav-btn:hover {
  opacity: 1;
  background: var(--accent-gradient);
  border-color: rgba(139, 92, 246, 0.5);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.lightbox-nav-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  fill: none;
}

.lightbox-nav-prev {
  left: 24px;
}

.lightbox-nav-next {
  right: 24px;
}

.lightbox-nav-btn:disabled {
  opacity: 0.15;
  cursor: not-allowed;
  pointer-events: none;
}

.lightbox-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
}

.lightbox-viewport.panning {
  cursor: grabbing;
}

.lightbox-image-container {
  position: absolute;
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
  pointer-events: none;
}

/* Lightbox Split Slider */
.lightbox-slider-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
}

.lightbox-slider-wrap #lightbox-img-after {
  display: block;
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  pointer-events: none;
}

.lightbox-before-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #ffffff;
  pointer-events: none;
}

.lightbox-img-before {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
}

.lightbox-slider-wrap .viewer-split-bar {
  z-index: 10;
  pointer-events: auto;
  cursor: ew-resize;
}

/* Lightbox Side-by-Side */
.lightbox-side-wrap {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
}

.lightbox-side-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(18, 18, 15, 0.85);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 5;
  pointer-events: none;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.lightbox-img-side {
  max-width: 44vw !important;
  max-height: 82vh !important;
}

.lightbox-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 22, 19, 0.85);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.7rem;
  padding: 4px 12px;
  border-radius: 999px;
  pointer-events: none;
  backdrop-filter: blur(6px);
}
