/* ========================================================
   WebP Studio - Modern Design System (Light & Dark Mode)
   Default: Light Mode | Optional: Dark Mode Toggle
   ======================================================== */

:root,
[data-theme="light"] {
  /* Surface & Backgrounds */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.88);
  --bg-input: #ffffff;
  --bg-subtle: #f1f5f9;
  
  /* Borders */
  --border-subtle: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: #2563eb;
  --border-glow: rgba(37, 99, 235, 0.2);

  /* Typography Colors */
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  /* Brand Accents & Gradients */
  --accent-cyan: #0284c7;
  --accent-blue: #2563eb;
  --accent-indigo: #4f46e5;
  --accent-violet: #7c3aed;
  --accent-gradient: linear-gradient(135deg, #0284c7 0%, #2563eb 50%, #7c3aed 100%);
  --accent-gradient-hover: linear-gradient(135deg, #0369a1 0%, #1d4ed8 50%, #6d28d9 100%);

  /* Status Colors */
  --success: #059669;
  --success-bg: rgba(5, 150, 105, 0.1);
  --warning: #d97706;
  --warning-bg: rgba(217, 119, 6, 0.1);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.08);

  /* Image Stage Checkerboard */
  --checker-base: #f8fafc;
  --checker-tile: #e2e8f0;

  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.06), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 16px 32px -4px rgba(15, 23, 42, 0.12), 0 6px 12px -3px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.18);

  /* Ambient Glow Orbs in Light Mode */
  --glow-opacity: 0.12;

  /* Modals */
  --modal-overlay-bg: rgba(15, 23, 42, 0.55);
}

[data-theme="dark"] {
  /* Surface & Backgrounds */
  --bg-primary: #07090e;
  --bg-secondary: #0d121f;
  --bg-card: rgba(18, 24, 38, 0.75);
  --bg-card-hover: rgba(26, 35, 54, 0.9);
  --bg-glass: rgba(15, 23, 42, 0.7);
  --bg-input: #0d121f;
  --bg-subtle: rgba(0, 0, 0, 0.3);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-medium: rgba(255, 255, 255, 0.18);
  --border-focus: rgba(56, 189, 248, 0.5);
  --border-glow: rgba(99, 102, 241, 0.4);

  /* Typography Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  /* Brand Accents & Gradients */
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-indigo: #6366f1;
  --accent-violet: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
  --accent-gradient-hover: linear-gradient(135deg, #22d3ee 0%, #60a5fa 50%, #a78bfa 100%);

  /* Status Colors */
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);

  /* Image Stage Checkerboard */
  --checker-base: #05070a;
  --checker-tile: #0e1422;

  /* Shadows */
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 16px -2px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 25px rgba(6, 182, 212, 0.25);

  /* Ambient Glow Orbs in Dark Mode */
  --glow-opacity: 0.25;

  /* Modals */
  --modal-overlay-bg: rgba(4, 7, 13, 0.85);
}

:root {
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Common Metrics */
  --glass-blur: blur(16px);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

/* Base Reset & Styling */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Links & Hyperlinks (Bold without underlines) */
a {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--accent-cyan);
  text-decoration: none;
}

/* Ambient Glow Background Orbs */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: var(--glow-opacity);
  animation: floatOrb 18s ease-in-out infinite alternate;
  transition: opacity 0.3s ease;
}

.glow-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent-cyan) 0%, transparent 70%);
  top: -100px;
  left: -100px;
}

.glow-2 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-violet) 0%, transparent 70%);
  bottom: -150px;
  right: -100px;
  animation-delay: -7s;
}

.glow-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -12s;
}

@keyframes floatOrb {
  0% { transform: translateY(0px) scale(1); }
  50% { transform: translateY(30px) scale(1.08); }
  100% { transform: translateY(-20px) scale(0.95); }
}

/* App Layout */
.app-layout {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 28px;
  gap: 20px;
  flex-wrap: wrap;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-container {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: #081226; /* Deep Rich Navy Background */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 5px;
  border: 1.5px solid rgba(14, 165, 233, 0.45);
  box-shadow: 0 4px 18px rgba(8, 18, 38, 0.35), 0 0 12px rgba(14, 165, 233, 0.15);
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-container:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 24px rgba(8, 18, 38, 0.5), 0 0 18px rgba(14, 165, 233, 0.3);
}

.brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--text-main);
}

.brand-text h1 span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-pill {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-subtle);
  color: var(--accent-blue);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

/* Stats Pill Bar */
.header-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  padding: 6px 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.stat-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 10px;
  border-right: 1px solid var(--border-subtle);
}

.stat-pill:last-child {
  border-right: none;
}

.stat-label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.text-accent {
  color: var(--accent-blue) !important;
}

.text-success {
  color: var(--success) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.font-mono {
  font-family: var(--font-mono);
}

/* Header Actions & Theme Toggle */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle-btn {
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

/* In Light Mode: Show moon icon, hide sun icon */
[data-theme="light"] .theme-toggle-btn .icon-sun,
:root:not([data-theme="dark"]) .theme-toggle-btn .icon-sun {
  display: none;
}
[data-theme="light"] .theme-toggle-btn .icon-moon,
:root:not([data-theme="dark"]) .theme-toggle-btn .icon-moon {
  display: block;
}

/* In Dark Mode: Show sun icon, hide moon icon */
[data-theme="dark"] .theme-toggle-btn .icon-sun {
  display: block;
  color: #fbbf24;
}
[data-theme="dark"] .theme-toggle-btn .icon-moon {
  display: none;
}

/* Upload Dropzone */
.upload-section {
  margin-bottom: 24px;
}

.dropzone {
  position: relative;
  background: var(--bg-card);
  border: 2px dashed var(--border-medium);
  border-radius: var(--radius-xl);
  backdrop-filter: var(--glass-blur);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.dropzone:hover, .dropzone.drag-active {
  border-color: var(--accent-blue);
  background: var(--bg-subtle);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.dropzone.drag-active .pulse-ring {
  animation: pulseRings 1.2s infinite ease-out;
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 680px;
  margin: 0 auto;
}

.dropzone-icon-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.dropzone-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-blue);
  transition: all 0.3s ease;
  box-shadow: var(--shadow-sm);
}

.dropzone:hover .dropzone-icon {
  transform: scale(1.08);
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
}

.pulse-ring {
  position: absolute;
  top: -8px;
  left: -8px;
  right: -8px;
  bottom: -8px;
  border-radius: 50%;
  border: 2px solid var(--accent-blue);
  opacity: 0;
  pointer-events: none;
}

@keyframes pulseRings {
  0% { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.4); opacity: 0; }
}

.dropzone-title {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 8px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent-blue);
  font-size: inherit;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease;
}

.btn-link:hover {
  color: var(--accent-cyan);
  text-decoration: none;
}

.dropzone-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}

.dot-sep {
  margin: 0 4px;
  color: var(--text-dim);
}

.features-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.feature-tag svg {
  color: var(--accent-blue);
}

.dropzone-legal-note {
  margin-top: 16px;
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
  position: relative;
  z-index: 2;
}

.legal-inline-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--accent-blue);
  text-decoration: none;
  font-size: inherit;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s ease;
  display: inline;
}

.legal-inline-link:hover {
  color: var(--accent-cyan);
  text-decoration: none;
}

/* Toolbar & Batch Controls */
.toolbar-section {
  margin-bottom: 24px;
  animation: fadeIn 0.3s ease-out;
}

.glass-panel {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.toolbar-card {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quality-controls, .resize-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.form-select {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.form-select:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--border-glow);
}

.form-select-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.form-input {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: var(--font-mono);
  outline: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--border-glow);
}

.form-input-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
  width: 90px;
}

.input-with-affix {
  display: flex;
  align-items: center;
  position: relative;
}

.input-with-affix .affix {
  position: absolute;
  right: 10px;
  font-size: 0.78rem;
  color: var(--text-dim);
  pointer-events: none;
}

.dimensions-lock-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.times-sep {
  color: var(--text-dim);
  font-weight: 600;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-slider {
  accent-color: var(--accent-blue);
  cursor: pointer;
  width: 120px;
}

.slider-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent-blue);
  min-width: 36px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* Master Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: var(--font-sans);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.82rem;
}

.btn-xs {
  padding: 5px 9px;
  font-size: 0.74rem;
  font-weight: 600;
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.btn-icon.btn-sm {
  width: 32px;
  height: 32px;
}

.btn-icon:hover, .btn-icon.active {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--accent-blue);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-gradient-hover);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.38);
  transform: translateY(-1px);
}

.btn-glow {
  position: relative;
}

.btn-glow::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--accent-gradient);
  z-index: -1;
  filter: blur(8px);
  opacity: 0.4;
  transition: opacity 0.3s;
}

.btn-glow:hover::after {
  opacity: 0.75;
}

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

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

.btn-outline {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.btn-outline:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--accent-blue);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--danger);
}

.btn-danger-outline:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 4px 6px;
  border-radius: 4px;
}

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

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Batch Progress Bar */
.progress-bar-container {
  margin-bottom: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  box-shadow: var(--shadow-sm);
}

.progress-bar-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.84rem;
  font-weight: 500;
}

.progress-percent {
  font-family: var(--font-mono);
  color: var(--accent-blue);
  font-weight: 600;
}

.progress-track {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.25s ease-out;
}

/* Queue Section */
.queue-section {
  margin-bottom: 40px;
  animation: fadeIn 0.4s ease-out;
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.queue-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.queue-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: block;
}

.queue-view-options {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==================== IMAGE CARDS (REDESIGNED) ==================== */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 20px;
}

.image-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  box-shadow: var(--shadow-sm);
}

.image-card:hover {
  border-color: var(--border-medium);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.image-card.status-converting {
  border-color: var(--accent-blue);
}

.image-card.status-done {
  border-color: rgba(5, 150, 105, 0.4);
}

/* Checkerboard Thumbnail Area */
.card-top {
  position: relative;
  height: 190px;
  background-color: var(--checker-base);
  background-image: 
    linear-gradient(45deg, var(--checker-tile) 25%, transparent 25%), 
    linear-gradient(-45deg, var(--checker-tile) 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, var(--checker-tile) 75%), 
    linear-gradient(-45deg, transparent 75%, var(--checker-tile) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 0 9px, 9px -9px, -9px 0px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
}

.card-thumbnail {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.3s ease;
}

.image-card:hover .card-thumbnail {
  transform: scale(1.03);
}

/* Badges on Thumbnail */
.card-badge-format {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-badge-savings {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--success);
  color: #fff;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.35);
}

.card-badge-status {
  position: absolute;
  bottom: 8px;
  left: 10px;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.8);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 5px;
}

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

.status-dot.converting {
  background: var(--accent-blue);
  animation: pulseRings 1s infinite;
}

.status-dot.done {
  background: var(--success);
}

/* Card Body & Metadata */
.card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
}

.card-filename {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
}

.card-metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
}

.metric-item {
  display: flex;
  flex-direction: column;
}

.metric-item .label {
  font-size: 0.68rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.metric-item .val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-main);
}

.metric-item .val.highlight {
  color: var(--accent-blue);
}

/* 2-Tier Action Layout to Prevent Overflows */
.card-tools-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  margin-top: auto;
}

.card-tools-row .btn-remove {
  margin-left: auto;
}

.card-main-action {
  display: flex;
}

.btn-action-full {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 600;
}

.btn-action-full .btn-dl-size {
  font-size: 0.74rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.22);
  padding: 1px 7px;
  border-radius: 12px;
  margin-left: 2px;
}

/* List View Layout Overrides */
.image-grid.view-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.image-grid.view-list .image-card {
  flex-direction: row;
  align-items: center;
  height: 94px;
}

.image-grid.view-list .card-top {
  width: 110px;
  height: 100%;
  flex-shrink: 0;
  border-bottom: none;
  border-right: 1px solid var(--border-subtle);
}

.image-grid.view-list .card-body {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  gap: 16px;
}

.image-grid.view-list .card-filename {
  max-width: 180px;
}

.image-grid.view-list .card-metrics-grid {
  display: flex;
  gap: 20px;
  background: transparent;
  border: none;
  padding: 0;
}

.image-grid.view-list .card-tools-row {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.image-grid.view-list .card-main-action {
  min-width: 180px;
}

/* ==================== MODALS ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay-bg);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.modal-dialog {
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-md { max-width: 520px; }
.modal-lg { max-width: 820px; }
.modal-xl { max-width: 1100px; }

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

.modal-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: block;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s;
}

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

.modal-body {
  padding: 24px;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--bg-subtle);
}

/* Cropper Workspace Styles */
.cropper-container-wrapper {
  width: 100%;
  height: 440px;
  background-color: #030508;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cropper-img-stage {
  max-width: 100%;
  max-height: 100%;
}

.cropper-img-stage img {
  display: block;
  max-width: 100%;
  max-height: 440px;
}

.crop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.crop-control-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toolbar-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
}

.button-toggle-group {
  display: flex;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  border: 1px solid var(--border-subtle);
}

.btn-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-toggle.active {
  background: var(--accent-gradient);
  color: #fff;
}

.btn-group {
  display: flex;
  gap: 4px;
}

.crop-dimensions-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--accent-blue);
  font-weight: 600;
}

/* Resize Modal Form */
.resize-modal-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dimensions-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.form-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.aspect-link-btn-wrap {
  display: flex;
  align-items: center;
  padding-top: 22px;
}

.quick-scale-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.label-sm {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 600;
}

.resize-info-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.84rem;
}

.info-row {
  display: flex;
  justify-content: space-between;
}

/* ==================== COMPARE MODAL (SPLIT SLIDER) ==================== */
.compare-modal-body {
  padding: 18px 24px;
}

.compare-stage {
  position: relative;
  width: 100%;
  height: 480px;
  background-color: #030508;
  background-image: 
    linear-gradient(45deg, #0b0f19 25%, transparent 25%), 
    linear-gradient(-45deg, #0b0f19 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #0b0f19 75%), 
    linear-gradient(-45deg, transparent 75%, #0b0f19 75%);
  background-size: 24px 24px;
  border-radius: var(--radius-md);
  overflow: hidden;
  user-select: none;
  touch-action: none;
}

.compare-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.compare-layer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.compare-layer-orig {
  clip-path: polygon(0 0, 50% 0, 50% 100%, 0 100%);
  z-index: 2;
}

.compare-layer-webp {
  z-index: 1;
}

.compare-badge {
  position: absolute;
  bottom: 16px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 10;
}

.badge-orig {
  left: 16px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
}

.badge-webp {
  right: 16px;
  background: rgba(37, 99, 235, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  text-align: right;
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  z-index: 5;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
  cursor: ew-resize;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
  cursor: ew-resize;
  border: 3px solid var(--accent-blue);
}

.compare-controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  flex-wrap: wrap;
  gap: 12px;
}

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

.compare-summary-metrics {
  display: flex;
  align-items: center;
  gap: 10px;
}

.metric-pill {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
}

.metric-arrow {
  color: var(--text-dim);
}

.badge-saved {
  background: var(--success-bg) !important;
  color: var(--success) !important;
  border-color: rgba(5, 150, 105, 0.3) !important;
  font-weight: 700;
}

/* Help Modal Body */
.help-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.help-body h4 {
  color: var(--text-main);
  font-size: 1rem;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.help-heading-icon {
  color: var(--accent-blue);
  flex-shrink: 0;
}

.help-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  color: var(--text-main);
  font-size: 0.86rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: slideToast 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  max-width: 380px;
}

.toast.toast-success {
  border-left: 4px solid var(--success);
}

.toast.toast-error {
  border-left: 4px solid var(--danger);
}

.toast.toast-info {
  border-left: 4px solid var(--accent-blue);
}

@keyframes slideToast {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Footer */
.app-footer {
  margin-top: auto;
  padding: 32px 0 24px 0;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.footer-privacy-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-blue);
  font-weight: 500;
  font-size: 0.8rem;
  background: var(--bg-subtle);
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border-subtle);
}

.footer-legal-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-link-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  text-decoration: none;
}

.footer-link-btn:hover {
  color: var(--accent-blue);
  background: var(--bg-subtle);
  text-decoration: none;
}

.footer-sep {
  color: var(--text-dim);
  font-size: 0.75rem;
}

.footer-agreement-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin: 12px 0 6px 0;
  width: 100%;
}

.footer-agreement-notice svg {
  flex-shrink: 0;
  color: var(--accent-blue);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.copyright-text strong {
  color: var(--text-main);
  font-weight: 600;
}

.company-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.company-link:hover {
  color: var(--accent-cyan);
  opacity: 0.95;
  text-decoration: none;
}

.footer-tech-specs {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Legal Modals Styling */
.legal-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.legal-badge-banner {
  background: rgba(5, 150, 105, 0.08);
  border: 1px solid rgba(5, 150, 105, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--success);
  font-size: 0.82rem;
}

.legal-badge-banner svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.legal-alert-box {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: var(--danger);
  font-size: 0.82rem;
}

.legal-alert-box svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.legal-notice-subtext {
  margin-top: 5px;
  font-size: 0.77rem;
  font-weight: 500;
  opacity: 0.92;
  line-height: 1.4;
}

.modal-footer-disclaimer {
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-right: auto;
  font-style: italic;
}

.legal-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.legal-section h4 {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.legal-section p {
  color: var(--text-muted);
}

.legal-section strong {
  color: var(--text-main);
}

.legal-bullet-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

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

/* ==================== RESPONSIVE DESIGN (TABLETS & MOBILE) ==================== */

/* Tablets & Small Laptops (<= 1024px) */
@media (max-width: 1024px) {
  .app-container {
    padding: 0 20px;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
  }

  .toolbar-card {
    gap: 14px;
    padding: 14px 18px;
  }

  .cropper-container-wrapper, 
  .compare-stage {
    height: 380px;
  }
}

/* Medium Tablets & Landscape Phones (<= 860px) */
@media (max-width: 860px) {
  .app-header {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
  }

  .header-left {
    flex: 1 1 auto;
  }

  .header-actions {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .header-stats {
    order: 3;
    width: 100%;
    justify-content: space-around;
    padding: 8px 12px;
    margin-top: 4px;
  }

  .toolbar-card {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .toolbar-actions {
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
  }

  .toolbar-actions .btn {
    flex: 1 1 calc(50% - 10px);
    min-width: 140px;
  }

  .image-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .cropper-container-wrapper, 
  .compare-stage {
    height: 340px;
  }
}

/* Portrait Tablets & Large Phones (<= 768px) */
@media (max-width: 768px) {
  .app-container {
    padding: 0 16px;
  }

  .logo-container {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    padding: 4px;
  }

  .brand-text h1 {
    font-size: 1.55rem;
  }

  .stat-pill {
    padding: 0 8px;
  }

  .stat-value {
    font-size: 0.82rem;
  }

  .dropzone {
    padding: 34px 18px;
  }

  .dropzone-icon {
    width: 60px;
    height: 60px;
  }

  .dropzone-title {
    font-size: 1.2rem;
  }

  .quality-controls, 
  .resize-controls {
    flex-wrap: wrap;
    width: 100%;
  }

  .form-select {
    width: 100%;
  }

  .modal-dialog {
    max-height: 94vh;
    margin: 10px;
  }

  .footer-top {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  .footer-brand-info {
    justify-content: center;
    text-align: center;
  }

  .footer-legal-links {
    justify-content: center;
    flex-wrap: wrap;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 10px;
  }

  .footer-tech-specs {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Standard Mobile Phones (<= 640px) */
@media (max-width: 640px) {
  .app-container {
    padding: 0 12px;
  }

  .app-header {
    padding: 12px 0;
    gap: 12px;
    margin-bottom: 16px;
  }

  .logo-container {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    padding: 4px;
  }

  .brand-text h1 {
    font-size: 1.35rem;
  }

  .badge-pill {
    font-size: 0.62rem;
    padding: 1px 6px;
  }

  .header-actions {
    gap: 6px;
  }

  .header-actions .btn-icon {
    width: 36px;
    height: 36px;
  }

  /* 2x2 Grid for Header Stats on Mobile */
  .header-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
  }

  .stat-pill {
    border-right: none;
    padding: 4px 6px;
    align-items: flex-start;
  }

  .stat-pill:nth-child(1),
  .stat-pill:nth-child(2) {
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 6px;
  }

  .stat-label {
    font-size: 0.64rem;
  }

  .stat-value {
    font-size: 0.82rem;
  }

  /* Dropzone Mobile */
  .dropzone {
    padding: 24px 12px;
    border-radius: var(--radius-lg);
  }

  .dropzone-icon {
    width: 52px;
    height: 52px;
    margin-bottom: 10px;
  }

  .dropzone-icon svg {
    width: 28px;
    height: 28px;
  }

  .dropzone-title {
    font-size: 1.1rem;
    line-height: 1.35;
  }

  .dropzone-subtitle {
    font-size: 0.8rem;
    margin-bottom: 14px;
    line-height: 1.45;
  }

  .features-pill-row {
    gap: 5px;
  }

  .feature-tag {
    font-size: 0.72rem;
    padding: 4px 9px;
  }

  .dropzone-legal-note {
    font-size: 0.74rem;
    margin-top: 14px;
  }

  /* Toolbar Mobile */
  .toolbar-card {
    padding: 14px;
    border-radius: var(--radius-md);
  }

  .toolbar-actions {
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .toolbar-actions .btn {
    width: 100%;
    min-height: 42px;
    font-size: 0.86rem;
  }

  .dimensions-lock-row {
    width: 100%;
    justify-content: space-between;
  }

  .form-input-sm {
    width: calc(50% - 24px);
  }

  /* Image Queue Cards Mobile */
  .queue-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .queue-title {
    font-size: 1.15rem;
  }

  .queue-view-options {
    width: 100%;
    justify-content: space-between;
  }

  .image-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .card-top {
    height: 170px;
  }

  .card-body {
    padding: 14px;
  }

  .card-tools-row {
    flex-wrap: wrap;
    gap: 6px;
  }

  .btn-tool {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
    padding: 7px 8px;
    font-size: 0.76rem;
  }

  .card-main-action .btn {
    width: 100%;
    justify-content: center;
    min-height: 40px;
  }

  /* List view adapts gracefully on mobile */
  .image-grid.view-list {
    grid-template-columns: 1fr;
  }

  .image-grid.view-list .image-card {
    flex-direction: column;
    height: auto;
  }

  .image-grid.view-list .card-top {
    width: 100%;
    height: 160px;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .image-grid.view-list .card-body {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px;
  }

  .image-grid.view-list .card-filename {
    max-width: 100%;
  }

  .image-grid.view-list .card-metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }

  .image-grid.view-list .card-main-action {
    width: 100%;
    min-width: 0;
  }

  /* Modals Mobile */
  .modal-overlay {
    padding: 8px;
  }

  .modal-dialog {
    max-height: 96vh;
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 12px 14px;
  }

  .modal-title {
    font-size: 1.05rem;
  }

  .modal-subtitle {
    font-size: 0.72rem;
  }

  .modal-body {
    padding: 14px;
    -webkit-overflow-scrolling: touch;
  }

  .modal-footer {
    padding: 10px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .modal-footer-disclaimer {
    text-align: center;
    margin-right: 0;
    margin-bottom: 4px;
  }

  .cropper-container-wrapper {
    height: 250px;
  }

  .compare-stage {
    height: 250px;
  }

  .crop-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .crop-control-group {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .button-toggle-group {
    width: 100%;
    display: flex;
  }

  .btn-toggle {
    flex: 1;
    text-align: center;
    padding: 6px 4px;
    font-size: 0.72rem;
  }

  .dimensions-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .aspect-link-btn-wrap {
    padding-top: 0;
    align-self: center;
  }

  .quick-scale-row {
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
  }

  .quick-scale-row .btn-scale-quick {
    flex: 1;
    text-align: center;
    padding: 5px 6px;
  }

  .footer-agreement-notice {
    font-size: 0.74rem;
    padding: 8px 10px;
  }

  .footer-agreement-notice svg {
    margin-top: 1px;
    align-self: flex-start;
  }
}

/* Very Small Mobile (< 380px) */
@media (max-width: 380px) {
  .brand-text h1 {
    font-size: 1.2rem;
  }

  .logo-container {
    width: 44px;
    height: 44px;
  }

  .header-stats {
    grid-template-columns: 1fr;
  }

  .stat-pill:nth-child(1),
  .stat-pill:nth-child(2),
  .stat-pill:nth-child(3) {
    border-bottom: 1px solid var(--border-subtle);
  }
}
