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

:root {
  --smart-primary: #6366f1;
  --smart-secondary: #8b5cf6;
  --smart-success: #10b981;
  --smart-warning: #f59e0b;
  --smart-danger: #ef4444;
  --smart-info: #06b6d4;
  --bg-gradient-start: #0f0f23;
  --bg-gradient-end: #1a1a2e;
  --container-bg: rgba(22, 22, 44, 0.95);
  --panel-bg: rgba(30, 30, 60, 0.8);
  --glass-blur: 10px;
  --accent-color: var(--smart-primary);
  --text-color: #e2e8f0;
  --heading-color: linear-gradient(
    135deg,
    var(--smart-primary),
    var(--smart-secondary)
  );
  --border-color: rgba(99, 102, 241, 0.3);
  --input-bg: rgba(15, 15, 35, 0.8);
  --shadow-intensity: 0 8px 32px rgba(0, 0, 0, 0.3);
  --triangle-accent: #a855f7;
  --min-touch-target: 44px;
  --overlay-panel-bg: rgba(22, 22, 44, 0.98);
  --drag-accent: #f59e0b;
  --triangle-color-1: #a855f7;
  --triangle-color-2: #06b6d4;
  --triangle-color-3: #10b981;
  --title-shadow: #8b5cf6;
  --panel-margin-horizontal: 20px;
  --max-image-width: 100%;
  --max-image-height: 80vh;
  --min-image-width: 50px;
  --min-image-height: 50px;
  --image-object-fit: contain;
  --image-border-radius: 4px;
  /* @tweakable maximum width for desktop layout to prevent excessive stretching */
  --max-desktop-width: 1200px;
  /* @tweakable button size reduction factor for more compact UI */
  --button-size-factor: 0.75;
  /* @tweakable compact file item spacing - reduced margins for tighter layout */
  --list-item-margin: 4px;
  /* @tweakable compact file item padding - reduced internal spacing */
  --list-item-padding: 6px 10px;
  /* @tweakable smaller icon sizes for inline actions */
  --inline-icon-size: 18px;
  /* @tweakable compact remove button size - smaller for tighter layout */
  --file-remove-button-size: 16px;
  /* @tweakable maximum width for filename input to prevent excessive stretching */
  --filename-input-max-width: 180px;
  /* @tweakable reduced gap between file item elements */
  --file-item-gap: 4px;
  /* @tweakable mobile breakpoint for responsive design */
  --mobile-breakpoint: 768px;
  --viewer-z-index: 1000;
}

body {
  background: linear-gradient(
    135deg,
    var(--bg-gradient-start),
    var(--bg-gradient-end)
  );
  background-attachment: fixed;
  color: var(--text-color);
  font-family: "Inter", "Segoe UI", sans-serif;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  padding: 10px;
  /* @tweakable main container max-width constraint for desktop layouts */
  display: flex;
  justify-content: center;
}

/* @tweakable main container width constraints */
.container {
  width: 100%;
  max-width: var(--max-desktop-width);
  margin: 0 auto;
}

h1,
h2,
h3 {
  background: var(--heading-color);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  margin-bottom: 1rem;
}

h1 {
  color: white;
  text-shadow: 2px 2px 8px var(--title-shadow);
  background: none;
  -webkit-background-clip: unset;
  -webkit-text-fill-color: unset;
  background-clip: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

h1::before {
  display: none;
}

.title-part {
  display: inline;
}

.delta-animation {
  width: 30px;
  height: 30px;
  margin: 10px 8px 2px 8px;
  display: inline-block;
  animation: svgTriangleRotateAndColor 3.6s ease-in-out infinite;
  transform-origin: center center;
  color: var(--triangle-color-1);
}

@keyframes svgTriangleRotateAndColor {
  0% {
    transform: rotate(0deg);
    color: var(--triangle-color-1);
  }

  33.33% {
    transform: rotate(120deg);
    color: var(--triangle-color-2);
  }

  66.66% {
    transform: rotate(240deg);
    color: var(--triangle-color-3);
  }

  100% {
    transform: rotate(360deg);
    color: var(--triangle-color-1);
  }
}

.rotating-triangle {
  display: none;
}

.rotating-triangle::before,
.rotating-triangle::after {
  display: none;
}

@keyframes triangleRotateAndColorOutline {
  0% {
    transform: rotate(0deg);
  }

  33.33% {
    transform: rotate(120deg);
  }

  66.66% {
    transform: rotate(240deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.rotating-triangle::before {
  animation: triangleColorCycle 3.6s ease-in-out infinite;
}

@keyframes triangleColorCycle {
  0% {
    border-bottom-color: var(--triangle-color-1);
  }

  33.33% {
    border-bottom-color: var(--triangle-color-2);
  }

  66.66% {
    border-bottom-color: var(--triangle-color-3);
  }

  100% {
    border-bottom-color: var(--triangle-color-1);
  }
}

@media (max-width: 768px) {
  h1 {
    font-size: 1.8rem;
    text-align: center;
  }

  .delta-animation {
    width: 20px;
    height: 20px;
    margin: 0 6px 1px 6px;
  }

  .rotating-triangle {
    width: 22px;
    height: 22px;
    margin: 0 6px;
  }

  .rotating-triangle::before {
    border-left-width: 11px;
    border-right-width: 11px;
    border-bottom-width: 19px;
  }

  .rotating-triangle::after {
    border-left-width: 7px;
    border-right-width: 7px;
    border-bottom-width: 13px;
    transform: translate(-50%, -50%) translateY(1.5px);
  }
}

@keyframes triangleRotateAndColor {
  0% {
    transform: rotate(0deg);
    color: var(--triangle-color-1);
  }

  33.33% {
    transform: rotate(120deg);
    color: var(--triangle-color-2);
  }

  66.66% {
    transform: rotate(240deg);
    color: var(--triangle-color-3);
  }

  100% {
    transform: rotate(360deg);
    color: var(--triangle-color-1);
  }
}

button {
  background: linear-gradient(
    135deg,
    var(--smart-primary),
    var(--smart-secondary)
  );
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-height: calc(var(--min-touch-target) * var(--button-size-factor));
  min-width: calc(var(--min-touch-target) * var(--button-size-factor));
  padding: calc(12px * var(--button-size-factor))
    calc(16px * var(--button-size-factor));
  /* @tweakable tighter button margins for better spacing */
  margin: 4px 2px;
}

button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4);
}

button:disabled {
  background: #555;
  color: #888;
  cursor: not-allowed;
  opacity: 0.6;
}

.primary-btn {
  background: linear-gradient(135deg, var(--smart-success), #059669);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
  font-size: 1.2rem;
  padding: 12px 24px;
}

.primary-btn::after {
  content: "⚡";
  margin-left: 0.5rem;
}

.primary-btn:hover {
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
}

.secondary-btn {
  background: linear-gradient(135deg, var(--smart-info), #0891b2);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.25);
  background: transparent;
  color: var(--accent-color);
  border: 1px solid var(--accent-color);
}

.secondary-btn:hover {
  background: rgba(0, 255, 0, 0.1);
  box-shadow: none;
}

.secondary-btn::after {
  content: "🔧";
  margin-left: 0.5rem;
}

.clean-btn,
button.clean-btn {
  background: linear-gradient(135deg, var(--smart-warning), #d97706);
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.25);
  background: transparent;
  color: var(--warning-color);
  border: 1px solid var(--warning-color);
  padding: 6px 12px;
  font-size: 0.9rem;
  margin-top: 10px;
}

.clean-btn::after {
  content: "🧹";
  margin-left: 0.5rem;
}

.clear-all-btn,
.remove-file,
.remove-asset {
  background: linear-gradient(135deg, var(--smart-danger), #dc2626) !important;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.25);
  background: var(--error-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: calc(var(--inline-icon-size) + 6px);
  height: calc(var(--inline-icon-size) + 6px);
  font-size: 14px;
  line-height: 28px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s ease;
}

.clear-all-btn:hover {
  background: #ff6666;
}

.clear-all-btn::after,
.remove-asset::after {
  content: "🗑️";
  margin-left: 0.25rem;
}

.download-asset,
.download-assets-zip {
  background: linear-gradient(135deg, var(--smart-secondary), #7c3aed);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--accent-color);
  padding: 4px 8px;
  font-size: 1rem;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.download-asset::after,
.download-assets-zip::after {
  content: "⬇️";
  margin-left: 0.5rem;
}

.upload-section,
.config-section,
.process-section,
.output-section {
  background: var(--panel-bg);
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-intensity);
  position: relative;
  margin: 10px 5px;
  padding: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-section:hover,
.config-section:hover,
.process-section:hover,
.output-section:hover {
  box-shadow: 0 12px 40px rgba(99, 102, 241, 0.2);
  transform: translateY(-2px);
}

.upload-section::before,
.config-section::before,
.process-section::before,
.output-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--smart-primary),
    transparent
  );
  border-radius: 12px 12px 0 0;
}

input,
textarea,
select {
  background: var(--input-bg);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 6px;
  transition: all 0.3s ease;
  padding: 10px;
  border-radius: 4px;
  width: 100%;
  margin-bottom: 15px;
}

input[type="checkbox"] {
  width: auto;
  margin-bottom: 0;
  cursor: pointer;
}

input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input[type="range"] {
  -webkit-appearance: none;
  height: 10px;
  background: var(--input-bg);
  border-radius: 5px;
  outline: none;
  border: 1px solid var(--border-color);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  transition: transform 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  border: none;
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #333;
}

.subtitle {
  color: var(--accent-color);
  font-size: 1.2rem;
}

.drop-area {
  border: 2px dashed var(--border-color);
  background: linear-gradient(
    135deg,
    rgba(245, 158, 11, 0.1),
    rgba(99, 102, 246, 0.05)
  );
  border-color: var(--drag-accent);
  margin: var(--panel-margin-horizontal);
  padding: 30px;
  position: relative;
  overflow: hidden;
  text-align: center;
  margin-bottom: 20px;
  transition: all 0.3s ease;
}

.drop-area::before {
  content: "📁";
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 1.5rem;
  opacity: 0.7;
}

.drop-area::after {
  content: "Supports: SVG, PNG, JPG, WEBP, ICO, PDF";
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: var(--drag-accent);
  opacity: 0.8;
}

.drop-area button {
  background: linear-gradient(135deg, var(--drag-accent), #d97706);
  min-width: 200px;
  min-height: 50px;
  font-size: 1.1rem;
  font-weight: 600;
  position: relative;
}

.drop-area button::before {
  content: "📂";
  margin-right: 8px;
}

.drop-area.active {
  border-color: var(--smart-success);
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.15),
    rgba(245, 158, 11, 0.1)
  );
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

/* Image Gallery Styles */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 20px;
  padding: 10px;
}

.gallery-item {
  position: relative;
  background: var(--input-bg);
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
}

.gallery-item:hover {
  border-color: var(--smart-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.gallery-item.selected {
  border-color: var(--smart-success);
  box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

.gallery-item-checkbox {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  z-index: 2;
  accent-color: var(--smart-success);
}

.gallery-item-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
}

.gallery-item-remove:hover {
  background: #ef4444;
  transform: scale(1.1);
}

.gallery-item-preview {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 35px 10px 10px 10px;
  background: rgba(15, 15, 35, 0.5);
}

.gallery-item-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.gallery-item-info {
  padding: 8px;
  background: rgba(99, 102, 241, 0.1);
  border-top: 1px solid rgba(99, 102, 241, 0.2);
}

.gallery-item-name {
  font-size: 11px;
  color: var(--text-color);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
}

.gallery-item-type {
  font-size: 9px;
  color: var(--smart-info);
  text-align: center;
  margin-top: 2px;
}

#imageCount {
  font-size: 0.8em;
  color: var(--smart-info);
  font-weight: normal;
}

/* Gallery Actions */
.gallery-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding: 15px;
  background: rgba(var(--smart-primary-rgb), 0.05);
  border-radius: 8px;
  border: 1px solid rgba(var(--smart-primary-rgb), 0.2);
  animation: slideDown 0.3s ease-out;
}

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

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery-actions button {
  flex: 1;
  padding: 12px 20px;
  font-size: 14px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.gallery-actions .primary-btn {
  background: var(--smart-primary);
  color: white;
}

.gallery-actions .primary-btn:hover {
  background: var(--smart-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--smart-primary-rgb), 0.3);
}

.gallery-actions .secondary-btn {
  background: var(--smart-secondary);
  color: white;
}

.gallery-actions .secondary-btn:hover {
  background: var(--smart-secondary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(var(--smart-secondary-rgb), 0.3);
}

/* ── Metadata sub-navigation row ── */
.metadata-sub-nav {
  display: flex;
  gap: 4px;
  padding: 6px 0 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  margin-bottom: 8px;
}
.metadata-sub-nav button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--smart-text-muted, #a0a8b8);
  font-size: 12px;
  padding: 4px 12px;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s;
}
.metadata-sub-nav button:hover {
  background: rgba(var(--smart-primary-rgb), 0.12);
  color: var(--smart-text);
}
.metadata-sub-nav button.sub-active {
  background: rgba(var(--smart-primary-rgb), 0.22);
  border-color: var(--smart-primary);
  color: var(--smart-primary);
  font-weight: 600;
}

/* Viewer Tab Info Styling */
.info-text {
  color: var(--smart-text);
  margin: 10px 0;
  line-height: 1.6;
}

.feature-list {
  list-style: none;
  padding-left: 0;
  margin: 15px 0;
}

.feature-list li {
  padding: 8px 12px;
  margin: 6px 0;
  background: rgba(var(--smart-primary-rgb), 0.05);
  border-left: 3px solid var(--smart-primary);
  border-radius: 4px;
  color: var(--smart-text);
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* @tweakable compact file preview styling for SVG display */
.file-item {
  background: var(--input-bg);
  border-radius: 4px;
  padding: var(--list-item-padding);
  margin-bottom: var(--list-item-margin);
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* @tweakable compact file item gap - reduced spacing between elements */
  gap: var(--file-item-gap);
  position: relative;
  border: 1px solid transparent;
  transition:
    background-color 0.2s,
    border-color 0.2s;
  /* @tweakable force single row layout - prevent wrapping to new lines */
  flex-wrap: nowrap;
}

.file-item:hover:not(:has(input:focus)) {
  background: rgba(0, 255, 255, 0.05);
}

.file-item.selected-file {
  border: 1px solid var(--accent-color);
  background: rgba(0, 255, 0, 0.1);
}

.file-item .filename {
}

.file-item .input-file-list {
  flex-grow: 1;
  margin-right: 5px;
  /* @tweakable compact filename input width - limit maximum width for better layout */
  min-width: 120px;
  max-width: var(--filename-input-max-width);
  /* @tweakable compact filename input styling */
  padding: 4px 6px;
  font-size: 0.85rem;
}

.file-item .file-size {
  font-size: 0.85em;
  color: #888;
  white-space: nowrap;
  /* @tweakable compact file size margins */
  margin-left: 2px;
  margin-right: 3px;
  flex-shrink: 0;
}

.file-item .remove-file {
  background: rgba(255, 0, 0, 0.7);
  color: white;
  border-radius: 50%;
  /* @tweakable compact remove button size - smaller for tighter layout */
  width: var(--file-remove-button-size);
  height: var(--file-remove-button-size);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  /* @tweakable compact remove button font size */
  font-size: 9px;
  margin-left: auto;
  flex-shrink: 0;
  /* @tweakable compact remove button padding */
  padding: 0;
  border: none;
  line-height: 1;
}

.file-item .file-preview {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  margin-right: 8px;
}

.file-item .file-preview img,
.file-item .file-preview svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.file-item .file-preview.file-type-icon {
  background: rgba(99, 102, 241, 0.1);
  color: var(--smart-primary);
  font-size: 12px;
  font-weight: bold;
}

.input-file-list {
  background: var(--container-bg);
  color: var(--text-color);
  border: 1px solid #555;
  padding: 5px 8px;
  border-radius: 3px;
  font-size: 0.9em;
  font-family: inherit;
}

.input-file-list:focus {
  border-color: var(--accent-color);
  outline: none;
  box-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

.download-all-section {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid #444;
  background: rgba(0, 0, 0, 0.1);
  padding: 15px;
  border-radius: 4px;
}

.download-all-section h4 {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--heading-color);
}

.download-all-section .option-row {
  margin-bottom: 10px;
}

.download-all-section label {
  min-width: 150px;
}

.download-all-section input[type="text"] {
  margin-bottom: 0;
}

.download-all-section button {
  width: 100%;
  margin-top: 10px;
}

.file-list-header button {
  background: transparent;
  color: var(--text-color);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
  padding: 5px 8px;
  flex-shrink: 0;
}

.file-list-header button:hover {
  background: rgba(0, 255, 255, 0.1);
}

#fileHandlingOptions {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 5px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) transparent;
}

#fileHandlingOptions::-webkit-scrollbar {
  width: 6px;
}

#fileHandlingOptions::-webkit-scrollbar-track {
  background: transparent;
}

#fileHandlingOptions::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 3px;
}

#fileHandlingOptions::-webkit-scrollbar-thumb:hover {
  background: var(--smart-secondary);
}

.protection-analysis-popup,
.feedback-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.9);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  color: white;
  z-index: 1000;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 15px rgba(0, 255, 255, 0.3);
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

.feedback-popup {
  background: rgba(20, 20, 20, 0.95);
  border-left: 5px solid var(--info-color);
}

.feedback-popup.feedback-success {
  border-left-color: var(--success-color);
  color: var(--success-color);
}

.feedback-popup.feedback-error {
  border-left-color: var(--error-color);
  color: var(--error-color);
}

.feedback-popup.feedback-warning {
  border-left-color: var(--warning-color);
  color: var(--warning-color);
}

.feedback-popup.feedback-info {
  border-left-color: var(--info-color);
  color: var(--info-color);
}

.protection-analysis-popup.fade-out,
.feedback-popup.fade-out {
  opacity: 0;
}

.protection-analysis-popup ul {
  margin: 10px 0 5px 0;
  padding-left: 20px;
}

.protection-analysis-popup li {
  margin-bottom: 3px;
}

#protectionStatusContainer {
  background: rgba(30, 30, 60, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px;
  margin-top: 15px;
  backdrop-filter: blur(5px);
}

.protection-status-header {
  margin: 0 0 10px 0;
  color: var(--smart-primary);
  font-size: 1rem;
  text-align: center;
}

.status-indicators {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-bottom: 15px;
}

.status-indicator {
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  font-family: monospace;
  font-weight: bold;
  font-size: 0.9rem;
  cursor: help;
  transition: all 0.3s ease;
}

.status-indicator:hover {
  background: rgba(99, 102, 241, 0.2);
  transform: scale(1.05);
}

.status-indicator.status-on {
  color: var(--smart-success);
  border-color: var(--smart-success);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.status-indicator.status-off {
  color: var(--smart-danger);
  border-color: var(--smart-danger);
  opacity: 0.7;
}

.status-indicator.status-unverified {
  color: var(--smart-warning);
  border-color: var(--smart-warning);
}

.protection-matrix-dialog {
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  max-width: 90%;
  width: 600px;
  padding: 20px;
}

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

.matrix-header h3 {
  margin: 0;
}

.close-matrix {
  background: var(--error-color);
  color: white;
  border: none;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.compatibility-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}

.compatibility-table th,
.compatibility-table td {
  text-align: center;
  padding: 8px;
  border: 1px solid #444;
  font-size: 0.9em;
}

.compatibility-table th:first-child,
.compatibility-table td:first-child {
  text-align: left;
}

.compatibility-table th {
  background: rgba(0, 255, 255, 0.1);
}

.compatibility-table .yes {
  color: var(--success-color);
}

.compatibility-table .no {
  color: var(--error-color);
}

.compatibility-table .warning {
  color: var(--warning-color);
}

#configJson {
  width: 100%;
  height: 300px;
  font-family: monospace;
  color: #d1d5db;
}

.config-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.config-actions button,
.process-section button {
  font-size: calc(1rem * 0.85);
  padding: calc(12px * 0.85) calc(16px * 0.85);
  min-height: calc(44px * 0.85);
  min-width: calc(44px * 0.85);
}

.config-actions button:disabled,
.process-section button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.config-actions button:disabled:hover,
.process-section button:disabled:hover {
  transform: none;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.25);
}

.config-actions button {
  margin-right: 8px;
}

.config-actions button:last-child {
  margin-right: 0;
}

.metadata-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

#metadataTable {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

#metadataTable th,
#metadataTable td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #333;
}

#metadataTable th {
  background-color: rgba(0, 255, 255, 0.1);
  color: var(--heading-color);
}

.delete-metadata-row {
  background: var(--error-color);
  color: white;
  padding: 5px 10px;
  font-size: 0.8rem;
}

.metadata-row-input {
  width: 100%;
  margin-bottom: 0;
}

.process-section {
  text-align: center;
  padding: 20px 0;
}

.output-files {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.output-file {
  background: var(--input-bg);
  border-radius: 4px;
  padding: var(--list-item-padding);
  gap: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

.output-file input.editable-filename-input {
  min-width: 100px;
  flex-shrink: 1;
  flex-grow: 1;
  margin-right: 5px;
}

.output-file .filename-extension {
  white-space: nowrap;
  color: #aaa;
  /* @tweakable compact filename extension spacing */
  margin-right: 3px;
  flex-shrink: 0;
  font-size: 0.85em;
}

.file-hash-indicator {
  font-family: monospace;
  font-size: 0.8em;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 5px;
  cursor: help;
  white-space: nowrap;
  flex-shrink: 0;
}

.file-status {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  margin-left: 10px;
  margin-right: 10px;
  flex-shrink: 0;
}

.status-success {
  background: var(--success-color);
  color: black;
}

.status-error {
  background: var(--error-color);
  color: white;
}

.output-file .file-status:not(.status-success):not(.status-error) {
  background: #555;
  color: #ccc;
}

.status-warning {
  background: var(--warning-color);
  color: black;
}

.error-msg {
  color: var(--warning-color);
  font-weight: bold;
  cursor: help;
  margin-left: 5px;
  font-size: 1.1em;
  flex-shrink: 0;
}

.generation-item-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
  margin-left: 10px;
}

.generation-item {
  padding: var(--list-item-padding);
  margin-bottom: var(--list-item-margin);
  border-radius: 8px;
  background: rgba(30, 30, 60, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.2);
  backdrop-filter: blur(5px);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.generation-item:hover {
  border-color: var(--smart-primary);
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}

.generation-item .include-in-zip-label {
  display: flex;
  align-items: center;
  margin-right: 10px;
  flex-shrink: 0;
}

.generation-item .include-in-zip-label input[type="checkbox"] {
  margin-right: 5px;
  width: auto;
  margin-bottom: 0;
}

.generation-item input.editable-filename-input {
  flex-grow: 1;
  min-width: 150px;
  background: var(--container-bg);
  color: var(--text-color);
  border: 1px solid #555;
  padding: 5px 8px;
  border-radius: 3px;
  font-size: 0.9em;
  margin-right: 5px;
}

.generation-item .filename-extension {
  color: #aaa;
  margin-left: 2px;
  flex-shrink: 0;
  font-size: 0.85em;
}

.generation-item .generation-item-actions {
  flex-shrink: 0;
  margin-left: 8px;
}

.generation-item .generation-item-actions button {
  padding: 3px 6px;
  font-size: 12px;
  min-height: calc(var(--inline-icon-size) + 4px);
  min-width: calc(var(--inline-icon-size) + 4px);
  margin: 1px;
}

.asset-protection-options {
  margin-bottom: 15px;
  padding: 10px;
  background: var(--input-bg);
  border-radius: 4px;
  border-left: 3px solid var(--smart-warning);
}

.asset-protection-options label {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--smart-warning);
}

.protection-log {
  /* @tweakable background color for the asset protection log */
  background: rgba(0, 0, 0, 0.2);
  /* @tweakable border for the asset protection log */
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 8px 12px;
  margin-top: 10px;
  font-size: 0.85rem;
}

.protection-log ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.protection-log li {
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.protection-log .status-on {
  color: var(--smart-success);
}

.protection-log .status-off {
  color: var(--smart-danger);
  opacity: 0.7;
}

.protected-indicator {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--smart-success);
  margin-left: 8px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  flex-shrink: 0;
  user-select: none;
}

.batch-actions-section {
  margin-top: 15px;
  padding: 15px;
  background: rgba(0, 0, 0, 0.1);
  border: 1px solid #444;
  border-radius: 4px;
}

.batch-actions-section h4 {
  margin-top: 0;
  margin-bottom: 10px;
  color: var(--link-color);
}

.batch-rename-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.batch-rename-row label {
  flex-shrink: 0;
}

.batch-rename-row input[type="text"] {
  flex-grow: 1;
  min-width: 200px;
  margin-bottom: 0;
}

.batch-rename-row button {
  padding: 6px 12px;
  font-size: 0.9rem;
}

.select-all-row {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.select-all-row button {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 5px 10px;
  font-size: 0.8rem;
}

.select-all-row button:hover {
  background: rgba(0, 255, 255, 0.1);
}

.visual-style-options {
  margin-bottom: 20px;
  padding: 10px;
  background: var(--input-bg);
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.visual-style-options label {
  min-width: auto;
  margin-right: 15px;
}

.visual-style-options input[type="radio"] {
  margin-bottom: 0;
  margin-right: 5px;
  width: auto;
}

#svgExporterView h3 {
  margin-bottom: 20px;
  color: var(--heading-color);
}

.svg-exporter-container {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.svg-upload-section {
  flex: 1;
  min-width: 250px;
}

.svg-export-options {
  flex: 1;
  min-width: 250px;
  background: var(--input-bg);
  padding: 15px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.svg-export-options h4 {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--heading-color);
}

.svg-export-options .option-row {
  align-items: center;
  margin-bottom: 15px;
}

.svg-export-options label {
  min-width: 150px;
}

.svg-export-options input[type="text"] {
  margin-bottom: 0;
}

.svg-export-options .option-row label.background-option {
  min-width: initial;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-right: 15px;
}

.svg-export-options .option-row label.background-option input[type="checkbox"] {
  margin-bottom: 0;
}

.svg-export-actions {
  margin: 0;
}

#svgExporterPreview {
  margin-top: 15px;
  min-height: 120px;
  max-height: 300px;
  border: 1px dashed var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  transition: background-color 0.3s ease;
  overflow: hidden;
}

#svgExporterPreview.bg-white {
  background-color: #ffffff;
}

#svgExporterPreview.bg-transparent {
  background-color: transparent;
  background-image:
    linear-gradient(
      45deg,
      var(--checkerboard-color1) 25%,
      var(--checkerboard-color2) 25%
    ),
    linear-gradient(
      -45deg,
      var(--checkerboard-color1) 25%,
      var(--checkerboard-color2) 25%
    ),
    linear-gradient(
      45deg,
      var(--checkerboard-color2) 75%,
      var(--checkerboard-color1) 75%
    ),
    linear-gradient(
      -45deg,
      var(--checkerboard-color2) 75%,
      var(--checkerboard-color1) 75%
    );
  background-size: var(--checkerboard-size) var(--checkerboard-size);
  background-position:
    0 0,
    0 calc(var(--checkerboard-size) / 2),
    calc(var(--checkerboard-size) / 2) calc(var(--checkerboard-size) / -2),
    calc(var(--checkerboard-size) / -2) 0px;
}

.viewer-preview img,
#viewerImagePreview img,
#svgExporterPreview img {
  max-width: var(--max-image-width);
  max-height: var(--max-image-height);
  min-width: var(--min-image-width);
  min-height: var(--min-image-height);
  width: auto;
  height: auto;
  object-fit: var(--image-object-fit);
  border: 1px solid var(--border-color);
  border-radius: var(--image-border-radius);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

#svgExporterPreview img:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

#svgExportOutput {
  margin-top: 20px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 15px;
  max-height: 300px;
  overflow-y: auto;
}

.hidden {
  display: none;
}

.image-preview {
  margin-top: 10px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  min-height: 80px;
}

.preview-img {
  max-width: var(--max-image-width);
  max-height: 200px;
  min-width: var(--min-image-width);
  min-height: var(--min-image-height);
  width: auto;
  height: auto;
  object-fit: var(--image-object-fit);
  border: 1px solid var(--border-color);
  border-radius: var(--image-border-radius);
}

.remove-watermark {
  background-color: var(--error-color);
  color: white;
  padding: 5px 10px;
  font-size: 0.8rem;
}

/* @tweakable asset preview container sizing */
.asset-preview {
  margin-top: 10px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  /* @tweakable asset preview container constraints */
  min-height: 80px;
  max-height: 200px;
  border: 1px dashed var(--border-color);
  border-radius: var(--image-border-radius);
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
}

/* @tweakable asset preview image sizing - ensures SVGs fit properly in small containers */
.asset-preview img,
.asset-preview svg {
  max-width: 100%;
  max-height: 180px;
  min-width: var(--min-image-width);
  min-height: var(--min-image-height);
  width: auto;
  height: auto;
  object-fit: var(--image-object-fit);
  border: 1px solid var(--border-color);
  border-radius: var(--image-border-radius);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

/* @tweakable asset preview hover effect */
.asset-preview img:hover,
.asset-preview svg:hover {
  transform: scale(1.02);
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

/* ── Title gradient Δ ── */
.title-sm {
  color: inherit;
}
.title-delta {
  background: linear-gradient(135deg, #f97316 0%, #6366f1 55%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-style: normal;
  display: inline-block;
  transform: scaleX(0.82) scaleY(1.08);
  transform-origin: center bottom;
}

/* ── Logo panel: square ── */
.asset-upload--square {
  width: 200px;
  flex-shrink: 0;
}
.asset-drop--square {
  width: 184px;
  height: 184px;
  min-height: 184px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.asset-preview--square {
  width: 184px;
  height: 184px;
  min-height: 184px;
  max-height: 184px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.asset-preview--square img,
.asset-preview--square svg {
  max-width: 168px;
  max-height: 168px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ── Banner panel: 16:5 rectangle ── */
.asset-upload--rect {
  width: 340px;
  flex-shrink: 0;
}
.asset-drop--rect {
  width: 324px;
  height: 100px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.asset-preview--rect {
  width: 324px;
  height: 100px;
  min-height: 100px;
  max-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.asset-preview--rect img,
.asset-preview--rect svg {
  max-width: 308px;
  max-height: 88px;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* ── Brand preset bar inside metadata sub-nav ── */
#brandPresetBar input[type="text"] {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #e0e0ff;
  border-radius: 4px;
  padding: 2px 5px;
  font-size: 12px;
}
#brandPresetBar select {
  background: rgba(20, 20, 48, 0.9);
  border: 1px solid rgba(99, 102, 241, 0.45);
  color: #e0e0ff;
  border-radius: 4px;
  font-size: 12px;
  padding: 2px 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(30, 30, 60, 0.4);
  border-radius: 8px;
  overflow: hidden;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #333;
  vertical-align: middle;
}

th {
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.2),
    rgba(139, 92, 246, 0.2)
  );
  color: var(--heading-color);
}

td:first-child {
  transition: opacity 0.3s ease;
}

td:first-child.protection-incompatible,
td:first-child.protection-warning {
  opacity: 0.7;
}

td:first-child.protection-incompatible {
  text-decoration: line-through;
  text-decoration-color: var(--error-color);
}

td:has(> input.protection-incompatible),
td:has(> input.protection-warning) {
  opacity: 0.7;
}

#generateExportsBtn {
  background: linear-gradient(135deg, var(--smart-success), #059669) !important;
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25) !important;
  color: white !important;
  border: none !important;
}

#generateExportsBtn:hover:not(:disabled) {
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4) !important;
  transform: translateY(-2px);
}

#generateExportsBtn:disabled {
  opacity: 0.6;
  background: #555 !important;
  color: #888 !important;
}

.ai-generator-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.control-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.control-group select,
.control-group input[type="color"],
.control-group input[type="range"],
.control-group textarea {
  background: var(--input-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--text-color);
  padding: 8px 12px;
  transition: all 0.3s ease;
}

.control-group input[type="color"] {
  width: 50px;
  height: 35px;
  padding: 2px;
  cursor: pointer;
}

.control-group input[type="range"] {
  -webkit-appearance: none;
  height: 6px;
  background: var(--input-bg);
  border-radius: 3px;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--smart-primary);
  cursor: pointer;
  transition: transform 0.2s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.control-group textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

.control-group input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
}

.ai-preview-panel h4 {
  margin: 0 0 15px 0;
  color: var(--smart-primary);
  font-size: 1.1rem;
}

.preview-actions {
  display: flex;
  justify-content: center;
}

.preview-actions button {
  width: 100%;
}

/* @tweakable AI generator popup styling */
/* ── Inline AI SVG Generator panel (below gallery buttons) ─────────────── */
/* ── Inline sub-panel (2-col grid, opens below buttons like a tab) ──── */
.ai-svg-inline-panel {
  width: 100%;
  background: rgba(22, 22, 44, 0.97);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-color);
  margin-top: 6px;
  overflow: hidden;
  /* hard cap — nothing bleeds out of the panel */
  max-height: 560px;
}
.ai-svg-inline-panel.hidden {
  display: none;
}
/* 2-column grid body */
.ai-svg-inline-panel .ai-inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
  /* stretch columns to fill available panel height */
  align-items: start;
}
/* Column base — min-width:0 prevents grid blowout */
.ai-svg-inline-panel .ai-inline-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
/* Left col: scrollable if controls overflow */
.ai-svg-inline-panel .ai-inline-controls {
  max-height: 490px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.4) transparent;
}
/* Right col: strictly clipped — preview must never escape */
.ai-svg-inline-panel .ai-inline-preview {
  overflow: hidden;
  max-height: 490px;
}
/* Column label / mini-header */
.ai-svg-inline-panel .ai-col-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--smart-primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(99, 102, 241, 0.25);
  padding-bottom: 4px;
  margin-bottom: 2px;
}
/* Close button at bottom */
.ai-svg-inline-panel .ai-inline-close {
  display: block;
  width: 100%;
  padding: 6px;
  background: rgba(99, 102, 241, 0.1);
  border: none;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.15s;
}
.ai-svg-inline-panel .ai-inline-close:hover {
  background: rgba(99, 102, 241, 0.25);
  color: var(--text-color);
}
/* Reuse popup-panel control styles for inline panel */
.ai-svg-inline-panel .control-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ai-svg-inline-panel .control-row .control-group {
  flex: 1;
  min-width: 80px;
}
.ai-svg-inline-panel .control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-svg-inline-panel .control-group label {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}
.ai-svg-inline-panel .control-group select,
.ai-svg-inline-panel .control-group input[type="color"],
.ai-svg-inline-panel .control-group input[type="range"],
.ai-svg-inline-panel .control-group input[type="text"],
.ai-svg-inline-panel .control-group textarea {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--text-color);
  padding: 4px 8px;
  font-size: 0.8rem;
  width: 100%;
  box-sizing: border-box;
}
.ai-svg-inline-panel .control-group input[type="color"] {
  height: 30px;
  padding: 2px;
  cursor: pointer;
}
.ai-svg-inline-panel .control-group textarea {
  resize: vertical;
  min-height: 50px;
}
.ai-svg-inline-panel .range-with-value {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-svg-inline-panel .range-with-value input[type="range"] {
  flex: 1;
  padding: 0;
}
.ai-svg-inline-panel .ai-preview-box {
  background: repeating-conic-gradient(#222 0% 25%, #2a2a2a 0% 50%) 0 0 / 16px
    16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  /* grow to fill column, capped so it never pushes out */
  flex: 1 1 auto;
  min-height: 100px;
  max-height: 340px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-sizing: border-box;
}
.ai-svg-inline-panel .ai-preview-box img,
.ai-svg-inline-panel .ai-preview-box svg,
.ai-svg-inline-panel .ai-preview-box canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
/* Raw inline SVG that may have explicit width/height attributes */
.ai-svg-inline-panel .ai-preview-box > svg {
  width: 100% !important;
  height: auto !important;
  max-height: 340px !important;
}
.ai-svg-inline-panel .preview-placeholder {
  color: var(--text-muted, #94a3b8);
  font-size: 0.8rem;
  text-align: center;
  padding: 12px;
}
.ai-svg-inline-panel .ai-download-formats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
/* Responsive: stack to single column on small screens */
@media (max-width: 600px) {
  .ai-svg-inline-panel .ai-inline-grid {
    grid-template-columns: 1fr;
  }
}
/* 2-col sub-grid inside left column (for dropdowns pairs) */
.ai-svg-inline-panel .ai-ctrl-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
/* Full-width item inside left column (sliders, textarea, checkbox) */
.ai-svg-inline-panel .ai-ctrl-full {
  width: 100%;
}
.ai-svg-inline-panel .ai-ctrl-full .range-with-value {
  width: 100%;
}
.ai-svg-inline-panel .ai-ctrl-full .range-with-value input[type="range"] {
  flex: 1;
  width: auto;
}
.ai-svg-inline-panel .ai-ctrl-full textarea {
  width: 100%;
  box-sizing: border-box;
}
/* Side-by-side action buttons in right column */
.ai-svg-inline-panel .ai-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

/* ── Floating popup panel (legacy / fallback) ──────────────────────────── */
.ai-svg-popup-panel {
  position: fixed;
  background: rgba(22, 22, 44, 0.95);
  backdrop-filter: blur(15px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  width: 480px;
  max-width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
  color: var(--text-color);
  cursor: move;
}

.ai-svg-popup-panel .popup-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(99, 102, 241, 0.15);
  cursor: grab;
}

.ai-svg-popup-panel .popup-header:active {
  cursor: grabbing;
}

.ai-svg-popup-panel .popup-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--smart-primary);
}

.ai-svg-popup-panel .close-popup {
  background: var(--smart-danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 25px;
  height: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0;
}

.ai-svg-popup-panel .popup-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.ai-svg-popup-panel .ai-generator-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.ai-svg-popup-panel .control-row {
  display: flex;
  gap: 15px;
}

.range-with-value {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-with-value input[type="range"] {
  flex-grow: 1;
  margin: 0;
  padding: 0;
}

.range-with-value span {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--smart-secondary);
  min-width: 20px;
  text-align: right;
}

.ai-svg-popup-panel .control-row .control-group {
  flex: 1;
}

.ai-svg-popup-panel .control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ai-svg-popup-panel .control-group label {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ai-svg-popup-panel .control-group select,
.ai-svg-popup-panel .control-group input[type="color"],
.ai-svg-popup-panel .control-group input[type="range"],
.ai-svg-popup-panel .control-group textarea {
  background: var(--input-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  color: var(--text-color);
  padding: 8px 12px;
  transition: all 0.3s ease;
}

.ai-svg-popup-panel .control-group input[type="color"] {
  width: 50px;
  height: 35px;
  padding: 2px;
  cursor: pointer;
}

.ai-svg-popup-panel .control-group textarea {
  resize: vertical;
  min-height: 50px;
  font-family: inherit;
}

.ai-svg-popup-panel .ai-preview-section {
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.ai-svg-popup-panel .ai-preview-section h4 {
  margin: 0 0 15px 0;
  color: var(--smart-primary);
  font-size: 1rem;
  text-align: center;
}

.ai-svg-popup-panel .ai-preview-box {
  width: 100%;
  max-width: 200px;
  height: 120px;
  border: 1px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  margin: 0 auto 15px auto;
  overflow: hidden;
}

.ai-svg-popup-panel .preview-placeholder {
  color: #666;
  font-size: 0.8rem;
  text-align: center;
}

.ai-svg-popup-panel .ai-preview-box img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: var(--image-object-fit);
}

.ai-svg-popup-panel .ai-generation-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.ai-svg-popup-panel .ai-generation-buttons button {
  flex: 1;
  padding: 8px 12px;
  font-size: 0.9rem;
}

/* @tweakable realistic style option emphasis - make realistic option more prominent */
.ai-svg-popup-panel select#aiStyle option[value="realistic"] {
  font-size: calc(1em * 1.2);
  font-weight: bold;
  background: linear-gradient(
    135deg,
    rgba(99, 102, 241, 0.1),
    rgba(139, 92, 246, 0.1)
  );
}

/* @tweakable color count enforcement styling - visual emphasis for color limits */
.ai-svg-popup-panel select#aiColorCount {
  border-left: 3px solid var(--smart-warning);
}

.ai-svg-popup-panel select#aiColorCount:focus {
  border-left-color: var(--smart-success);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

/* @tweakable enhanced mobile responsiveness for small screens */
@media (max-width: 768px) {
  :root {
    /* @tweakable mobile-specific adjustments */
    --list-item-padding: 6px 10px;
    --list-item-margin: 4px;
    --inline-icon-size: 16px;
  }

  .container {
    /* @tweakable mobile container adjustments */
    padding: 5px;
    margin: 0;
  }

  /* @tweakable mobile panel margins */
  .upload-section,
  .config-section,
  .process-section,
  .output-section {
    margin: 10px 5px;
    padding: 15px;
  }

  /* @tweakable mobile button sizing */
  button {
    min-height: calc(var(--min-touch-target) * 0.85);
    min-width: calc(var(--min-touch-target) * 0.85);
    padding: 8px 12px;
    font-size: 14px;
  }

  /* @tweakable mobile file item layout */
  .file-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .file-item .input-file-list {
    width: 100%;
    min-width: unset;
  }

  /* @tweakable mobile generation item layout */
  .generation-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .generation-item input.editable-filename-input {
    width: 100%;
    min-width: unset;
  }

  /* @tweakable mobile config actions layout */
  .config-actions {
    flex-direction: column;
    gap: 6px;
  }

  .config-actions button {
    width: 100%;
    margin: 2px 0;
  }

  /* @tweakable mobile table responsiveness */
  table {
    font-size: 14px;
  }

  th,
  td {
    padding: 8px 6px;
  }

  /* @tweakable mobile modal adjustments — full screen, no scroll behind */
  .image-viewer-modal {
    width: 100%;
    height: 100%;
    height: 100dvh; /* dynamic viewport height: excludes mobile browser chrome */
    padding: 0;
  }

  .viewer-container {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    border-radius: 0 !important;
    border: none !important;
  }

  .ai-svg-popup-panel {
    width: 95vw;
    max-height: 90vh;
    left: 2.5vw !important;
    top: 5vh !important;
  }

  /* ...existing code... */
}

/* @tweakable compact spacing for better mobile experience */
@media (max-width: 480px) {
  :root {
    --list-item-padding: 4px 8px;
    --list-item-margin: 3px;
  }

  .upload-section,
  .config-section,
  .process-section,
  .output-section {
    margin: 8px 3px;
    padding: 12px;
  }

  /* @tweakable very small screen adjustments */
  .control-row {
    flex-direction: column;
    gap: 8px;
  }

  .batch-rename-row {
    flex-direction: column;
    align-items: stretch;
  }

  .batch-rename-row input[type="text"] {
    min-width: unset;
    width: 100%;
  }
}

/* @tweakable responsive behavior for mobile devices */
@media (max-width: 768px) {
  :root {
    --max-image-height: 60vh;
  }

  .image-display-area {
    max-height: 50vh;
    min-height: 200px;
  }

  .preview-img {
    max-height: 150px;
  }
}

.image-display-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 300px;
  max-height: 70vh;
  overflow: hidden;
  /* Stylized checkerboard pattern to reveal transparency */
  background-image:
    linear-gradient(45deg, rgba(100, 100, 120, 0.1) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(100, 100, 120, 0.1) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(100, 100, 120, 0.1) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(100, 100, 120, 0.1) 75%);
  background-size: 20px 20px;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0px;
  background-color: rgba(30, 30, 40, 0.3);
  border-radius: var(--image-border-radius);
  /* @tweakable The cursor to display when the image is pannable. */
  cursor: grab;
}

.image-display-area.grabbing {
  /* @tweakable The cursor to display while actively panning the image. */
  cursor: grabbing;
}

#image-content-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  /* @tweakable Add a subtle transition for programmatic zoom changes. */
  transition: transform 0.1s ease-out;
  will-change: transform;
}

#image-content-wrapper.no-transition {
  transition: none;
}

#image-content-wrapper svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.image-display-area img {
  max-width: var(--max-image-width);
  max-height: var(--max-image-height);
  min-width: var(--min-image-width);
  min-height: var(--min-image-height);
  width: auto;
  height: auto;
  object-fit: var(--image-object-fit);
  border-radius: var(--image-border-radius);
}

/* @tweakable crop overlay styling */
.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.crop-overlay.active {
  pointer-events: auto;
}

.crop-rectangle {
  position: absolute;
  border: 2px solid #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
  cursor: move;
}

/* @tweakable crop handle dimensions and styling */
.crop-handle {
  position: absolute;
  background: #3b82f6;
  border: 2px solid white;
  border-radius: 50%;
  width: 10px;
  height: 10px;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    background-color 0.2s ease;
  z-index: 11;
}

.crop-handle:hover {
  transform: scale(1.2);
  background: #1d4ed8;
}

.crop-handle.dragging {
  transform: scale(1.3);
  background: #1e40af;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

/* Corner handles */
.crop-handle.corner.top-left {
  top: -6px;
  left: -6px;
  cursor: nw-resize;
}

.crop-handle.corner.top-right {
  top: -6px;
  right: -6px;
  cursor: ne-resize;
}

.crop-handle.corner.bottom-left {
  bottom: -6px;
  left: -6px;
  cursor: ne-resize;
}

.crop-handle.corner.bottom-right {
  bottom: -6px;
  right: -6px;
  cursor: nw-resize;
}

/* Edge handles */
.crop-handle.edge.top {
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: n-resize;
}

.crop-handle.edge.bottom {
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  cursor: n-resize;
}

.crop-handle.edge.left {
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: e-resize;
}

.crop-handle.edge.right {
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
  cursor: e-resize;
}

/* @tweakable handle hover effects */
.crop-handle.edge.top:hover,
.crop-handle.edge.bottom:hover {
  transform: translateX(-50%) scale(1.2);
}

.crop-handle.edge.left:hover,
.crop-handle.edge.right:hover {
  transform: translateY(-50%) scale(1.2);
}

.crop-handle.edge.top.dragging,
.crop-handle.edge.bottom.dragging {
  transform: translateX(-50%) scale(1.3);
}

.crop-handle.edge.left.dragging,
.crop-handle.edge.right.dragging {
  transform: translateY(-50%) scale(1.3);
}

/* @tweakable crop input layout and styling */
.crop-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.crop-inputs label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--smart-secondary);
}

.crop-inputs input[type="number"] {
  width: 70px;
  padding: 4px 6px;
  font-size: 0.85rem;
  text-align: right;
  /* @tweakable purple color for crop input values */
  color: var(--smart-secondary);
  background: var(--input-bg);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
}

.crop-inputs input[type="number"]:focus {
  border-color: var(--smart-secondary);
  box-shadow: 0 0 5px rgba(139, 92, 246, 0.3);
  outline: none;
}

/* @tweakable resize input layout improvements - column display for better organization */
.resize-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

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

.resize-input-row label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  color: var(--smart-secondary);
  width: 100%;
}

.resize-input-row input[type="number"] {
  width: 80px;
  padding: 4px 6px;
  font-size: 0.85rem;
  text-align: right;
  color: var(--smart-secondary);
  background: var(--input-bg);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
  margin-left: 8px;
}

.resize-input-row input[type="number"]:focus {
  border-color: var(--smart-secondary);
  box-shadow: 0 0 5px rgba(139, 92, 246, 0.3);
  outline: none;
}

.resize-input-row input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  margin-left: 0;
}

/* @tweakable preset size dropdown styling - improved dropdown appearance */
.preset-sizes {
  margin-bottom: 15px;
}

.preset-sizes label {
  font-size: 0.9rem;
  color: var(--smart-secondary);
  margin-bottom: 5px;
  display: block;
}

.preset-sizes select {
  width: 100%;
  padding: 6px 8px;
  background: var(--input-bg);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 4px;
  color: var(--smart-secondary);
  font-size: 0.9rem;
}

.preset-sizes select:focus {
  border-color: var(--smart-secondary);
  box-shadow: 0 0 5px rgba(139, 92, 246, 0.3);
  outline: none;
}

/* @tweakable purple text color for all input elements */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
textarea,
select {
  color: var(--smart-secondary);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  color: var(--smart-primary);
  border-color: var(--smart-primary);
  box-shadow: 0 0 5px rgba(99, 102, 241, 0.3);
}

/* @tweakable responsive desktop layout optimization */
@media (min-width: 1201px) {
  body {
    padding: 20px;
  }

  .upload-section,
  .config-section,
  .process-section,
  .output-section {
    margin: 15px auto;
    max-width: calc(var(--max-desktop-width) - 40px);
  }
}

/* @tweakable tablet layout adjustments */
@media (max-width: var(--mobile-breakpoint)) and (min-width: 481px) {
  .container {
    max-width: 100%;
    padding: 0 10px;
  }

  .file-item .file-preview {
    width: 28px;
    height: 28px;
  }

  /* @tweakable tablet responsive file item layout */
  .file-item .input-file-list {
    max-width: calc(var(--filename-input-max-width) - 20px);
  }
}

/* @tweakable collapsible section styling improvements */
.collapsible-section {
  margin-bottom: 15px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--panel-bg);
  overflow: hidden;
}

.collapsible-header {
  display: flex;
  align-items: center;
  /* @tweakable header padding for better touch targets */
  padding: 12px 15px;
  background: rgba(99, 102, 241, 0.1);
  cursor: pointer;
  transition: background-color 0.3s ease;
  min-height: var(--min-touch-target);
}

.collapsible-header:hover {
  background: rgba(99, 102, 241, 0.15);
}

.collapsible-header h3 {
  margin: 0;
  margin-left: 10px;
  font-size: 1rem;
  color: var(--smart-primary);
  flex-grow: 1;
}

/* @tweakable collapse triangle styling and animation */
.collapse-triangle {
  /* @tweakable triangle size for better visibility */
  width: 16px;
  height: 16px;
  color: var(--smart-primary);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

/* @tweakable collapsible content container */
.collapsible-content {
  /* @tweakable smooth height transition for collapse animation */
  max-height: 500px;
  overflow: hidden;
  transition:
    max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    padding 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  /* @tweakable content padding */
  padding: 15px;
  background: var(--input-bg);
}

.collapsible-content.collapsed {
  max-height: 0;
  padding: 0 15px;
}

/* @tweakable option row styling improvements */
.collapsible-content .option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* @tweakable row spacing for better layout */
  margin-bottom: 12px;
  gap: 10px;
}

.collapsible-content .option-row:last-child {
  margin-bottom: 0;
}

.collapsible-content .option-row label {
  /* @tweakable label width for consistent alignment */
  min-width: 120px;
  font-size: 0.9rem;
  color: var(--text-color);
  font-weight: 500;
}

.collapsible-content .option-row input[type="text"],
.collapsible-content .option-row input[type="date"] {
  /* @tweakable input width for better space utilization */
  flex: 1;
  max-width: 250px;
  margin-bottom: 0;
}

.collapsible-content .option-row input[type="checkbox"] {
  width: auto;
  margin-bottom: 0;
  cursor: pointer;
}

/* @tweakable help text styling */
.pattern-help {
  font-size: 0.8rem;
  color: var(--smart-secondary);
  /* @tweakable help text margins */
  margin: -8px 0 12px 0;
  font-style: italic;
  line-height: 1.3;
}

/* @tweakable styles for a large image viewer modal */
.image-viewer-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--viewer-z-index, 1000);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.image-viewer-modal.hidden {
  display: none;
}

.viewer-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
}

/* @tweakable modal container dimensions */
.viewer-container {
  position: relative;
  background: var(--container-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-intensity);
  /* @tweakable width of the viewer modal */
  width: 90vw;
  /* @tweakable max-width of the viewer modal */
  max-width: 1600px;
  /* @tweakable height of the viewer modal */
  height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(99, 102, 241, 0.1);
  flex-shrink: 0;
}

.viewer-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.close-viewer {
  background: var(--smart-danger);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 20px;
  line-height: 30px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-content {
  display: flex;
  flex-grow: 1;
  overflow: hidden;
  padding: 20px;
  gap: 20px;
}

.viewer-tools {
  /* @tweakable width of the tools panel */
  width: 300px;
  flex-shrink: 0;
  background: var(--input-bg);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.viewer-tools-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-color);
  cursor: move;
  user-select: none;
}

.viewer-tools-header .drag-handle {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 2px;
}

.viewer-tools-header .header-controls {
  display: flex;
  gap: 8px;
}

.viewer-tools-header .icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all 0.2s;
}

.viewer-tools-header .icon-btn:hover {
  background: var(--smart-primary);
  border-color: var(--smart-primary);
}

.viewer-tools-content {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
}

.viewer-tools.collapsed .viewer-tools-content {
  display: block !important;
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
}

.viewer-tools.collapsed {
  height: auto;
  max-height: 250px;
}

/* 3-state collapse for tools content */
.viewer-tools-content {
  transition:
    max-height 0.3s ease,
    overflow 0.3s ease;
}

.viewer-tools-content.medium-collapsed {
  max-height: 200px !important;
  overflow-y: auto !important;
  overflow-x: hidden;
}

.viewer-tools-content.fully-collapsed {
  max-height: 0 !important;
  overflow: hidden !important;
  padding: 0;
}

/* Legacy raster section collapse (no longer used) */
.raster-draw-section.medium-collapsed .raster-draw-content {
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
}

.raster-draw-section.fully-collapsed .raster-draw-content {
  max-height: 0;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

.raster-draw-section.fully-collapsed .tool-instruction {
  display: none;
}

#collapseToolsBtn.collapsed::before {
  content: "△";
}

.remove-background-actions,
.vectorize-controls,
.crop-actions,
.resize-actions,
.text-actions,
.vectorize-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.tool-section {
  margin-bottom: 20px;
}

.tool-section:last-child {
  margin-bottom: 0;
}

.tool-section h4 {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--smart-primary);
}

.draw-tools-selection {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-bottom: 15px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  flex-wrap: wrap;
}

.draw-tool-btn {
  flex: 1 1 36px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  font-size: 1.2rem;
  padding: 6px;
  transition:
    background-color 0.2s,
    border-color 0.2s;
  min-width: 36px;
  /* Ensure buttons don't get too small */
}

.draw-tool-btn:hover {
  background-color: rgba(99, 102, 241, 0.2);
  border-color: var(--smart-primary);
}

.draw-tool-btn.active {
  background-color: var(--smart-primary);
  color: white;
  border-color: var(--smart-primary);
}

.draw-options .control-group,
.draw-options .control-row {
  margin-bottom: 10px;
}

.draw-options .control-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Import SVG from Gallery styles */
.svg-import-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 10px;
}

.svg-import-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--input-bg);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.svg-import-item:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: var(--smart-primary);
  transform: translateX(2px);
}

.svg-import-item img {
  width: 50px;
  height: 50px;
  object-fit: contain;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: white;
}

.svg-import-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.svg-import-item-name {
  font-weight: 600;
  color: var(--text-color);
  font-size: 0.9rem;
}

.svg-import-item-type {
  font-size: 0.8rem;
  color: #64748b;
}

.import-svg-actions {
  text-align: center;
}

#svgImportMessage {
  color: #64748b;
  font-style: italic;
  margin: 0;
}

/* Path Delete Tool styles */
.path-delete-info {
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.path-delete-info kbd {
  display: inline-block;
  padding: 2px 6px;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
  font-weight: bold;
}

.selected-path-info {
  margin-top: 15px;
  padding: 10px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 6px;
}

.selected-path-info.hidden {
  display: none;
}

/* Highlight selected path for deletion */
.path-selected-for-deletion {
  stroke: #ef4444 !important;
  stroke-width: 3 !important;
  stroke-dasharray: 5, 5;
  animation: pathDeletePulse 1s infinite;
}

/* Multi-selection counter badge */
.path-multi-select-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #ef4444;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
  pointer-events: none;
}

@keyframes pathDeletePulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

/* Drag selection rectangle */
.path-drag-selection-rect {
  position: absolute;
  pointer-events: none;
  z-index: 10000;
}

.path-drag-selection-rect.left-to-right {
  border: 2px solid #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.path-drag-selection-rect.right-to-left {
  border: 2px dashed #10b981;
  background: rgba(16, 185, 129, 0.1);
}

/* Cursor when drag selection mode is active */
#image-content-wrapper.drag-select-mode svg {
  cursor: crosshair !important;
}

#image-content-wrapper.drag-select-mode svg * {
  cursor: crosshair !important;
}

.draw-options .control-row .control-group {
  flex: 1;
  margin-bottom: 0;
}

/* Styles for drawn SVG elements */
#image-content-wrapper svg .drawn-shape {
  transition: filter 0.2s ease;
}

#image-content-wrapper svg .drawn-shape:hover,
#image-content-wrapper svg .drawn-shape.selected {
  filter: drop-shadow(0 0 3px var(--smart-primary));
  cursor: move;
}

#image-content-wrapper svg #edit-control-box {
  pointer-events: all;
}

#image-content-wrapper svg #edit-control-box .control-handle {
  pointer-events: all;
  transition:
    transform 0.2s ease,
    fill 0.2s ease;
}

#image-content-wrapper svg #edit-control-box .control-handle:hover {
  transform: scale(1.2);
  cursor: move;
}

/* @tweakable Styling for the resize handles on selected SVG groups */
#image-content-wrapper svg #edit-control-box .resize-handle {
  fill: white;
  stroke: var(--smart-primary);
  stroke-width: 1.5;
  pointer-events: all;
}

#image-content-wrapper svg #edit-control-box .resize-handle:hover {
  fill: var(--smart-secondary);
}

#image-content-wrapper svg .drawn-shape.selected-for-fill {
  stroke: var(--smart-info);
  stroke-width: 3px;
  stroke-dasharray: 4, 4;
  cursor: pointer;
}

#image-content-wrapper svg .drawn-shape.erasing {
  opacity: 0.5;
  stroke: #ef4444;
  stroke-dasharray: 5, 5;
}

.text-inputs .control-group,
.text-inputs .control-row {
  margin-bottom: 10px;
}

.text-inputs .control-row {
  display: flex;
  gap: 10px;
}

.text-inputs .control-row .control-group {
  flex: 1;
  margin-bottom: 0;
}

.draw-actions,
.text-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}

.z-index-controls {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.z-index-controls button {
  flex: 1;
  font-size: 0.8rem;
  padding: 6px 8px;
}

.text-inputs textarea {
  resize: vertical;
  min-height: 50px;
}

.tool-instruction {
  font-size: 0.8rem;
  color: var(--smart-info);
  text-align: center;
  margin-bottom: 10px;
  padding: 5px;
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: 4px;
}

.text-actions button {
  width: 100%;
}

/* Styles for interactive text elements inside the SVG */
#image-content-wrapper svg .draggable-text {
  cursor: move;
  transition: filter 0.2s ease;
}

#image-content-wrapper svg .draggable-text:hover,
#image-content-wrapper svg .draggable-text.selected {
  filter: drop-shadow(0 0 3px var(--smart-primary));
}

.viewer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-top: 1px solid var(--border-color);
  background: rgba(99, 102, 241, 0.1);
  flex-shrink: 0;
}

.viewer-navigation,
.viewer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.image-info {
  font-size: 0.9rem;
  color: #aaa;
  margin-left: 15px;
}

.tool-button.active {
  background: linear-gradient(135deg, var(--smart-success), #059669);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.25);
  color: white;
}

.history-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--input-bg);
  padding: 4px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin-left: 15px;
}

.history-controls .tool-button {
  min-width: 30px;
  padding: 4px 8px;
  font-size: 1.1rem;
  font-weight: bold;
  margin: 0;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--input-bg);
  padding: 4px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  margin-left: 15px;
}

.zoom-controls .tool-button {
  min-width: 30px;
  padding: 4px 8px;
  font-size: 1.1rem;
  font-weight: bold;
  margin: 0;
}

#zoomLevelIndicator {
  font-size: 0.9rem;
  color: var(--text-color);
  padding: 0 8px;
  min-width: 50px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .viewer-content {
    flex-direction: column;
  }

  .viewer-tools {
    width: 100%;
    max-height: 250px;
    /* Limit height on mobile */
  }

  .image-display-area {
    min-height: 200px;
  }
}

@media (max-width: 600px) {
  .viewer-footer {
    flex-direction: column;
    gap: 15px;
  }

  .viewer-container {
    width: 98vw;
    height: 95vh;
  }
}

.viewer-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-top: 15px;
  flex-wrap: wrap;
}

.viewer-send-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.viewer-send-controls.hidden {
  display: none;
}

.viewer-send-controls button {
  font-size: 0.8rem;
  padding: 6px 10px;
}

.artboard-section .artboard-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.artboard-section .control-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.artboard-section input {
  margin-bottom: 0;
}

/* ===================================
   SELECTED FILE INFO PANEL
   =================================== */
.selected-file-info {
  background: var(--panel-bg);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.selected-file-info h3 {
  color: var(--smart-primary);
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.selected-file-info h4 {
  color: var(--smart-secondary);
  margin: 15px 0 10px 0;
  font-size: 1rem;
}

.file-details-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 20px;
}

.detail-row {
  display: flex;
  padding: 8px;
  background: var(--input-bg);
  border-radius: 4px;
}

.detail-row label {
  font-weight: bold;
  color: var(--smart-info);
  min-width: 100px;
}

.detail-row span {
  color: var(--text-color);
}

.file-metadata-edit {
  background: rgba(15, 15, 35, 0.5);
  padding: 15px;
  border-radius: 6px;
  margin: 15px 0;
}

.metadata-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.metadata-row label {
  font-weight: bold;
  color: var(--smart-info);
  margin-bottom: 5px;
}

.metadata-row input,
.metadata-row textarea {
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  color: var(--text-color);
  padding: 8px;
  border-radius: 4px;
  font-family: inherit;
}

.metadata-row input:focus,
.metadata-row textarea:focus {
  outline: none;
  border-color: var(--smart-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.protection-capabilities {
  margin-top: 20px;
}

.capabilities-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.capabilities-table th,
.capabilities-table td {
  padding: 10px;
  text-align: left;
  border: 1px solid var(--border-color);
}

.capabilities-table th {
  background: var(--smart-primary);
  color: white;
  font-weight: bold;
}

.capabilities-table tr:nth-child(even) {
  background: rgba(99, 102, 241, 0.05);
}

.status-supported {
  color: var(--smart-success);
  font-weight: bold;
}

.status-not-supported {
  color: var(--smart-danger);
  font-weight: bold;
}

.capability-note {
  margin-top: 10px;
  padding: 10px;
  background: rgba(245, 158, 11, 0.1);
  border-left: 4px solid var(--smart-warning);
  color: var(--text-color);
  border-radius: 4px;
}
