/* ==========================================================================
   MarkItDown Studio - Modern Glassmorphism & High-Performance Design System
   ========================================================================== */

:root {
  /* Color Palette - Dark Premium Theme */
  --bg-main: #090d16;
  --bg-card: rgba(17, 24, 39, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --bg-surface: #0f172a;
  --bg-surface-secondary: #1e293b;
  --bg-input: rgba(15, 23, 42, 0.8);
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(99, 102, 241, 0.35);
  --border-active: rgba(139, 92, 246, 0.5);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #090d16;

  /* Accent Gradients & Colors */
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --gradient-cyan: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
  --gradient-emerald: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%);
  --glow-primary: 0 0 25px rgba(99, 102, 241, 0.25);
  --glow-accent: 0 0 35px rgba(139, 92, 246, 0.3);

  /* Typography */
  --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;

  /* Layout & Sizing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables */
[data-theme="light"] {
  --bg-main: #f8fafc;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-card-hover: rgba(255, 255, 255, 0.95);
  --bg-surface: #ffffff;
  --bg-surface-secondary: #f1f5f9;
  --bg-input: #ffffff;
  
  --border-color: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(99, 102, 241, 0.4);
  --border-active: rgba(99, 102, 241, 0.6);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #ffffff;

  --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(241, 245, 249, 0.8) 100%);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
}

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

html, body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background Ambient Glow */
.ambient-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.glow-orb-1 {
  position: absolute;
  top: -10%;
  left: 15%;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  filter: blur(80px);
  animation: floatOrb 18s ease-in-out infinite alternate;
}

.glow-orb-2 {
  position: absolute;
  bottom: 10%;
  right: 10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
  filter: blur(90px);
  animation: floatOrb 22s ease-in-out infinite alternate-reverse;
}

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

/* Layout Container */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.logo-badge {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--glow-primary);
  flex-shrink: 0;
}

.logo-badge svg {
  width: 26px;
  height: 26px;
}

.brand-titles h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

[data-theme="light"] .brand-titles h1 {
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-titles p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
}

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

.engine-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 9999px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 8px var(--accent-emerald);
  animation: pulseDot 2s infinite;
}

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

.icon-button {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-surface-secondary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-button:hover {
  color: var(--text-primary);
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

/* Mode Navigation Tabs */
.mode-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 1.5rem;
  width: fit-content;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab-btn svg {
  width: 18px;
  height: 18px;
}

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

.tab-btn.active {
  background: var(--bg-surface-secondary);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-hover);
}

.tab-badge {
  font-size: 0.7rem;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-primary);
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-weight: 700;
}

/* Conversion Panels Area */
.panel-content {
  display: none;
}

.panel-content.active {
  display: block;
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Upload Dropzone */
.dropzone-wrapper {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-xl);
  padding: 3.5rem 2rem;
  text-align: center;
  transition: all var(--transition-normal);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

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

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

.dropzone-icon-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  transition: all var(--transition-normal);
}

.dropzone-wrapper:hover .dropzone-icon-circle {
  transform: scale(1.1);
  background: rgba(99, 102, 241, 0.2);
}

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

.dropzone-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.dropzone-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
  background: var(--bg-surface-secondary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

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

/* Format Tags List */
.format-pills-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 1rem;
}

.format-pill {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

[data-theme="light"] .format-pill {
  background: rgba(0, 0, 0, 0.04);
}

.format-pill.featured {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-primary);
  border-color: rgba(99, 102, 241, 0.25);
}

/* Quick Samples Bar */
.quick-samples {
  margin-top: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sample-link {
  color: var(--accent-cyan);
  text-decoration: none;
  font-weight: 600;
  background: rgba(6, 182, 212, 0.1);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(6, 182, 212, 0.2);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.sample-link:hover {
  background: rgba(6, 182, 212, 0.2);
  transform: translateY(-1px);
}

/* URL Converter Card */
.url-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.url-input-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.input-icon-wrapper {
  position: relative;
  flex: 1;
}

.input-icon-wrapper svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--text-muted);
}

.app-input {
  width: 100%;
  padding: 0.8rem 1rem 0.8rem 2.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  transition: all var(--transition-fast);
}

.app-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Progress / Loading Overlay */
.loading-indicator {
  display: none;
  padding: 2rem;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  margin-top: 1.5rem;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(99, 102, 241, 0.15);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ==========================================================================
   Results & Markdown Viewer (Split / Rendered / Raw)
   ========================================================================== */

.results-wrapper {
  display: none;
  margin-top: 2rem;
}

.results-wrapper.visible {
  display: block;
  animation: fadeIn 0.4s ease;
}

/* Metrics & Actions Bar */
.metrics-toolbar {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.doc-info-meta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.doc-type-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.doc-name-title {
  font-size: 1rem;
  font-weight: 700;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-stats-grid {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

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

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

.stat-value {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.stat-value.highlight-token {
  color: var(--accent-cyan);
}

.stat-value.highlight-time {
  color: var(--accent-emerald);
}

.results-action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* View Layout Controls */
.view-mode-toggle {
  display: flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.2rem;
  margin-right: 0.5rem;
}

.view-toggle-btn {
  padding: 0.35rem 0.65rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  transition: all var(--transition-fast);
}

.view-toggle-btn.active {
  background: var(--bg-surface-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-hover);
}

/* Preview Panes (Dual Split) */
.preview-panes-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  min-height: 600px;
}

.preview-panes-container.mode-rendered {
  grid-template-columns: 1fr;
}
.preview-panes-container.mode-rendered .pane-raw {
  display: none;
}

.preview-panes-container.mode-raw {
  grid-template-columns: 1fr;
}
.preview-panes-container.mode-raw .pane-rendered {
  display: none;
}

.preview-pane {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.pane-header {
  padding: 0.65rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
}

[data-theme="light"] .pane-header {
  background: rgba(241, 245, 249, 0.8);
}

.pane-header-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pane-body {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: 700px;
  flex: 1;
}

/* Rendered Markdown Styling */
.rendered-markdown {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-primary);
}

.rendered-markdown h1,
.rendered-markdown h2,
.rendered-markdown h3,
.rendered-markdown h4 {
  color: var(--text-primary);
  margin-top: 1.4rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.rendered-markdown h1 { font-size: 1.6rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.4rem; }
.rendered-markdown h2 { font-size: 1.35rem; }
.rendered-markdown h3 { font-size: 1.15rem; }

.rendered-markdown p {
  margin-bottom: 1rem;
}

.rendered-markdown ul, .rendered-markdown ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.rendered-markdown li {
  margin-bottom: 0.35rem;
}

.rendered-markdown table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.88rem;
  overflow-x: auto;
  display: block;
}

.rendered-markdown th, .rendered-markdown td {
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-color);
  text-align: left;
}

.rendered-markdown th {
  background: rgba(99, 102, 241, 0.08);
  font-weight: 700;
  color: var(--text-primary);
}

.rendered-markdown tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

.rendered-markdown blockquote {
  border-left: 3px solid var(--accent-primary);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-secondary);
  font-style: italic;
  background: rgba(99, 102, 241, 0.03);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.rendered-markdown code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent-cyan);
}

[data-theme="light"] .rendered-markdown code {
  background: rgba(0, 0, 0, 0.06);
  color: #0284c7;
}

.rendered-markdown pre {
  margin: 1rem 0;
  border-radius: var(--radius-md);
  background: #0b0f17 !important;
  border: 1px solid var(--border-color);
  overflow-x: auto;
}

.rendered-markdown pre code {
  display: block;
  padding: 1rem;
  background: transparent;
  color: #e2e8f0;
  font-size: 0.85rem;
  line-height: 1.5;
}

.rendered-markdown img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin: 1rem 0;
  box-shadow: var(--shadow-md);
  display: block;
}

/* Raw Code Viewer */
.raw-markdown-textarea {
  width: 100%;
  height: 100%;
  min-height: 550px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  resize: none;
  outline: none;
}

/* ==========================================================================
   Batch Mode & Queue Manager
   ========================================================================== */

.batch-queue-container {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.batch-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.batch-table {
  width: 100%;
  border-collapse: collapse;
}

.batch-table th {
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.batch-table td {
  padding: 0.85rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-color);
}

.batch-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.status-pending { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.status-converting { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); }
.status-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.status-error { background: rgba(244, 63, 94, 0.15); color: var(--accent-rose); }

/* ==========================================================================
   Modal Dialogs & Drawers (Settings, Formats, History)
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

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

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-help {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.switch-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  animation: slideToast 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.toast.toast-success { border-color: var(--accent-emerald); color: var(--accent-emerald); }
.toast.toast-error { border-color: var(--accent-rose); color: var(--accent-rose); }

/* Responsive Media Queries */
@media (max-width: 900px) {
  .app-container { padding: 1rem; }
  .preview-panes-container { grid-template-columns: 1fr !important; }
  .metrics-toolbar { flex-direction: column; align-items: flex-start; }
  .results-action-buttons { width: 100%; justify-content: space-between; }
  .url-input-group { flex-direction: column; }
}
