/* ==========================================================================
   Pluto AI Studio - Modern Two-Column Playground Styling
   ========================================================================== */

:root {
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --bg-input: #ffffff;
  --bg-subtle: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  
  --badge-bg: #eff6ff;
  --badge-text: #2563eb;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.08);

  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

[data-theme="dark"] {
  --bg-app: #090d16;
  --bg-card: #111827;
  --bg-input: #1a2234;
  --bg-subtle: #1f293d;
  --border-color: #2e3b52;
  --border-focus: #60a5fa;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #1e293b;
  --primary-border: #3b82f6;
  
  --badge-bg: #1e293b;
  --badge-text: #60a5fa;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==================== Top Navigation ==================== */
.navbar {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #2563eb, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.brand-logo:hover {
  transform: translateY(-1px) scale(1.04);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background-color: var(--badge-bg);
  color: var(--badge-text);
  border-radius: 9999px;
  border: 1px solid var(--primary-border);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 9999px;
  background-color: var(--bg-subtle);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
}

.btn-icon {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background-color: var(--bg-subtle);
  color: var(--text-main);
}

.btn-dev-toggle {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

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

.btn-dev-toggle.active {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
  box-shadow: 0 0 0 1px var(--primary-border);
}

/* ==================== Main Two-Column Layout ==================== */
.main-container {
  flex: 1;
  max-width: 1480px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 1024px) {
  .main-container {
    grid-template-columns: 1fr;
  }
}

/* ==================== Cards ==================== */
.panel-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  min-height: 680px;
  overflow: hidden;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* Segmented Tabs (Form | JSON, Preview | JSON) */
.tab-switcher {
  display: inline-flex;
  background-color: var(--bg-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: calc(var(--radius-sm) - 2px);
  transition: all 0.15s ease;
}

.tab-btn.active {
  background-color: var(--bg-card);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* ==================== Panel Body ==================== */
.panel-body {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}

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

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
}

.label-req {
  color: #ef4444;
}

.label-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 6px;
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
}

/* Model Selector Pills */
.model-selector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.model-card {
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.model-card:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.model-card.active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.model-card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.model-card-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--badge-bg);
  color: var(--badge-text);
}

.model-card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* API Endpoint Tag */
.endpoint-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

.endpoint-method {
  font-weight: 700;
  color: #10b981;
}

/* Custom Model Select Dropdown */
.custom-model-dropdown {
  position: relative;
  width: 100%;
  user-select: none;
}

.custom-model-trigger {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.custom-model-trigger:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.1);
}

.custom-model-trigger.is-open {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.custom-model-trigger-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.custom-model-icon-badge {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.12), rgba(124, 58, 237, 0.18));
  border: 1px solid rgba(79, 70, 229, 0.25);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.custom-model-trigger-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.custom-model-trigger-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-model-trigger-sub {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-model-trigger-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.custom-model-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--badge-bg);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.custom-model-chevron {
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.2s ease;
  display: flex;
  align-items: center;
}

.custom-model-chevron.rotate-180 {
  transform: rotate(180deg);
  color: var(--primary);
}

/* Custom Dropdown Floating Menu */
.custom-model-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.25), 0 6px 14px rgba(0, 0, 0, 0.1);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  backdrop-filter: blur(16px);
}

.custom-model-item {
  padding: 10px 12px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
}

.custom-model-item:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-color);
}

.custom-model-item.is-active {
  background-color: var(--primary-light);
  border-color: var(--primary-border);
}

.custom-model-item-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.custom-model-item-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.custom-model-item-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.custom-model-item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.custom-model-item-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.custom-model-item.is-active .custom-model-item-title {
  color: var(--primary);
}

.custom-model-item-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--badge-bg);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.custom-model-item-desc {
  font-size: 11.5px;
  color: var(--text-subtle);
  line-height: 1.4;
}

.custom-model-item-check {
  color: var(--primary);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.model-meta-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 11px;
}

.model-meta-desc {
  color: var(--text-muted);
  line-height: 1.35;
  flex: 1;
}

/* Collapsible Advanced Parameters Section */
.advanced-section {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.advanced-toggle-btn {
  width: 100%;
  padding: 12px 14px;
  background-color: var(--bg-subtle);
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  color: var(--text-main);
  transition: background-color 0.15s ease;
}

.advanced-toggle-btn:hover {
  background-color: var(--bg-card);
}

.advanced-toggle-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.advanced-icon-badge {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.advanced-toggle-btn:hover .advanced-icon-badge {
  color: var(--primary);
  border-color: var(--primary-border);
  background-color: var(--primary-light);
}

.advanced-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.advanced-action-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
}

.chevron-icon {
  transition: transform 0.2s ease;
  color: var(--text-muted);
}

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

.advanced-body {
  padding: 16px 14px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.sliders-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .sliders-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== Reference Image (Img2Img & Dual Reference) ==================== */
.ref-image-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ref-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.ref-active-tag {
  font-size: 11px;
  font-weight: 700;
  color: #10b981;
  background-color: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ref-active-tag.tag-dual {
  color: #8b5cf6;
  background-color: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
}

.ref-active-tag.tag-object {
  color: #3b82f6;
  background-color: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.25);
}

/* Dual Reference Slots Grid */
.dual-ref-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 640px) {
  .dual-ref-grid {
    grid-template-columns: 1fr;
  }
}

.dual-slot-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.slot-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.slot-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
}

.slot-title {
  letter-spacing: 0.2px;
}

.slot-badge-object {
  color: #8b5cf6;
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.25);
}

.slot-badge-object .slot-number {
  background: #8b5cf6;
}

.ref-dropzone {
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  padding: 16px 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
}

.ref-dropzone:hover, .ref-dropzone.dragging {
  border-color: var(--primary);
  background-color: var(--primary-light);
  transform: translateY(-1px);
}

#dropzone-object:hover, #dropzone-object.dragging {
  border-color: #8b5cf6;
  background-color: rgba(139, 92, 246, 0.08);
}

.ref-dropzone-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ref-upload-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ref-upload-icon.icon-object {
  color: #8b5cf6;
}

.ref-dropzone:hover .ref-upload-icon {
  background: var(--bg-card);
  border-color: var(--primary-border);
}

#dropzone-object:hover .ref-upload-icon.icon-object {
  border-color: rgba(139, 92, 246, 0.4);
}

.ref-dropzone-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.ref-dropzone-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.ref-dropzone-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.ref-dropzone-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Big Visual Preview Card (Large as requested by user) */
.ref-preview-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ref-large-preview-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}

.ref-large-preview-card:hover {
  border-color: var(--border-focus);
}

.ref-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
}

.ref-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  font-size: 12px;
}

.ref-card-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background-color: var(--primary);
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.ref-card-badge.badge-object {
  background-color: #8b5cf6;
}

.ref-filename-text {
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.ref-filesize-text {
  color: var(--text-muted);
  font-size: 11px;
}

.ref-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ref-btn-change {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ref-btn-change:hover {
  border-color: var(--primary-border);
  color: var(--primary);
}

.ref-btn-remove {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #ef4444;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ref-btn-remove:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: #ef4444;
}

.ref-image-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #0b0f19;
  background-image: radial-gradient(#1e293b 1px, transparent 1px);
  background-size: 16px 16px;
  padding: 12px;
  min-height: 180px;
  max-height: 250px;
}

.ref-large-img {
  max-width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Dual Reference Controls & Influence Sliders */
.dual-controls-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.transformation-strength-box {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.transformation-title-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.transformation-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.transformation-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.strength-pill {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 700;
  background-color: var(--bg-card);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.strength-pill.strength-pill-object {
  color: #8b5cf6;
  border-color: rgba(139, 92, 246, 0.4);
}

.range-slider-object {
  accent-color: #8b5cf6 !important;
}

.strength-slider-row {
  display: flex;
  align-items: center;
}

.strength-presets {
  display: flex;
  gap: 8px;
}

.preset-pill {
  flex: 1;
  padding: 4px 8px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.preset-pill:hover {
  border-color: var(--border-focus);
  color: var(--text-main);
}

.preset-pill.active {
  background-color: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Inputs & Textareas */
.input-text, .textarea-input {
  width: 100%;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  color: var(--text-main);
  font-family: var(--font-family);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  resize: vertical;
}

.input-text:focus, .textarea-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.textarea-input {
  min-height: 110px;
}

.form-helper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Format & Quality Grid (Aspect Ratio + Quality Selector) */
.format-quality-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 640px) {
  .format-quality-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.pill-group {
  display: flex;
  gap: 8px;
}

.pill-btn {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
}

.pill-btn:hover {
  border-color: var(--border-focus);
  color: var(--text-main);
  background-color: var(--bg-subtle);
}

.pill-btn.active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.pill-label {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

.pill-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-subtle);
  line-height: 1;
}

.pill-btn.active .pill-sub {
  color: var(--primary);
  opacity: 0.85;
}

.resolution-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Aspect Ratio Buttons (Legacy fallback) */
.aspect-ratio-group {
  display: flex;
  gap: 10px;
}

.aspect-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.aspect-btn.active {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary);
}

.aspect-dim {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-subtle);
}

/* Advanced Sliders */
.slider-container {
  display: flex;
  align-items: center;
  gap: 14px;
}

.range-slider {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}

.slider-val {
  min-width: 44px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* Seed Input Group */
.seed-group {
  display: flex;
  gap: 8px;
}

.btn-random {
  padding: 0 14px;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-random:hover {
  background-color: var(--border-color);
  color: var(--text-main);
}

/* ==================== Panel Footer ==================== */
.panel-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background-color: var(--bg-card);
}

.btn {
  padding: 10px 22px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.15s ease;
}

.btn-default {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-default:hover {
  background-color: var(--bg-subtle);
}

.btn-primary {
  background-color: var(--primary);
  border: 1px solid var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--primary-hover);
}

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

/* ==================== Output Panel Specifics ==================== */
.output-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.output-type-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background-color: var(--badge-bg);
  padding: 2px 10px;
  border-radius: 9999px;
  border: 1px solid var(--primary-border);
}

/* Visual Viewport Container */
.viewport-container {
  flex: 1;
  min-height: 440px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background-color: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Empty Placeholder (matching mockup: "no output") */
.empty-placeholder {
  color: var(--text-subtle);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Generating State */
.generating-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px;
  width: 80%;
  max-width: 400px;
  text-align: center;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #8b5cf6);
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.progress-subtext {
  font-size: 12px;
  color: var(--text-muted);
}

/* Result Image View */
.result-image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}

.result-image {
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.result-image:hover {
  transform: scale(1.01);
}

.result-overlay-info {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  display: flex;
  gap: 10px;
}

/* JSON Code Viewer */
.json-viewer {
  background-color: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 18px;
  border-radius: var(--radius-md);
  overflow: auto;
  flex: 1;
  max-height: 520px;
  white-space: pre-wrap;
  word-break: break-all;
}

/* History Drawer / Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 1100px;
  width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--bg-card);
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background-color: var(--bg-subtle);
  flex: 1;
  min-height: 0;
}

/* History Card Layout */
.history-item-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  background-color: var(--bg-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  flex-shrink: 0;
  width: 100%;
}

.history-item-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-focus);
}

.history-card-header {
  padding: 12px 18px;
  background-color: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-card-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.history-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-muted);
}

.history-tag.tag-model {
  background-color: var(--badge-bg);
  color: var(--primary);
  border-color: var(--primary-border);
}

.history-tag.tag-quality {
  background-color: rgba(16, 185, 129, 0.1);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.25);
}

.history-card-time {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 500;
}

.history-card-body {
  padding: 16px 18px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .history-card-body {
    grid-template-columns: 1fr;
  }
}

/* History Media Preview Column */
.history-media-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-output-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: #0b0f19;
  border: 1px solid var(--border-color);
  cursor: pointer;
}

.history-output-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.history-output-thumb-wrap:hover .history-output-thumb {
  transform: scale(1.03);
}

.history-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
}

.history-output-thumb-wrap:hover .history-thumb-overlay {
  opacity: 1;
}

/* Input Images Container (Slot 1 & Slot 2) */
.history-inputs-wrapper {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-inputs-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.history-inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.history-inputs-grid.single-input {
  grid-template-columns: 1fr;
}

.history-input-slot {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-input-slot-badge {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-subtle);
}

.history-input-img-thumb {
  width: 100%;
  height: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  cursor: pointer;
  background-color: #0b0f19;
  transition: opacity 0.15s ease;
}

.history-input-img-thumb:hover {
  opacity: 0.85;
}

/* History Content Column */
.history-content-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-prompt-box {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  position: relative;
}

.history-prompt-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-main);
  font-weight: 500;
  word-break: break-word;
}

.history-prompt-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.history-prompt-copy-btn:hover {
  color: var(--primary);
  border-color: var(--primary-border);
}

/* Hidden Details / Parameters Accordion */
.history-params-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 0;
  width: fit-content;
}

.history-params-toggle:hover {
  text-decoration: underline;
}

.history-params-card {
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-params-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px 14px;
}

.history-param-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.history-param-key {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-subtle);
  letter-spacing: 0.3px;
}

.history-param-val {
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
  word-break: break-all;
}

.history-param-neg {
  font-size: 11px;
  color: var(--text-muted);
  background-color: var(--bg-card);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  line-height: 1.4;
}

/* History Card Footer Action Buttons */
.history-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
}

.btn-history-action {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-main);
}

.btn-history-action:hover {
  background-color: var(--bg-subtle);
}

.btn-history-action.btn-reuse {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.btn-history-action.btn-reuse:hover {
  background-color: var(--primary);
  color: #fff;
}

.btn-history-action.btn-danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
  background-color: rgba(239, 68, 68, 0.05);
}

.btn-history-action.btn-danger:hover {
  background-color: #ef4444;
  color: #fff;
  border-color: #ef4444;
}

/* Lightbox Modal (Fullsize Image Viewer) */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.lightbox-dialog {
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background-color: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  padding: 8px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  width: 100%;
  max-width: 700px;
}

.lightbox-caption {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
