[data-theme="dark"] #textSelectionPanel h3,
[data-theme="dark"] .text-selection-heading,
[data-theme="dark"] #textSelectionPanel .text-lg.font-semibold {
  color: #fff !important;
}
[data-theme="dark"] .optional-inputs-label,
[data-theme="dark"] .doc-item .text-slate-700,
[data-theme="dark"] .text-selection-label,
[data-theme="dark"] .text-selection-label.text-slate-600,
[data-theme="dark"] .text-selection-label.text-slate-400 {
  color: #fff !important;
}

/* currentDocName and pageCount inherit text color from Tailwind theme */
/* Modern CSS Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
}

/* ═══════════════════════════════════════
   LIGHT THEME (default)
═══════════════════════════════════════ */
:root {
  --primary: #e8234a;
  --primary-hover: #c41535;
  --primary-light: rgba(232, 35, 74, 0.1);
  --secondary: #64748b;
  --success: #10b981;
  --success-light: #d1fae5;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --info: #3b82f6;
  --info-light: #dbeafe;

  --bg-primary: #ffffff;
  --bg-secondary: #f4f6f9;
  --bg-tertiary: #edf0f5;
  --bg-accent: #e2e7ef;
  --bg-surface: #ffffff;

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

  --border-primary: rgba(0, 0, 0, 0.08);
  --border-secondary: rgba(0, 0, 0, 0.05);
  --border-accent: #e8234a;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-md:
    0 10px 15px -3px rgb(0 0 0 / 0.07), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-lg:
    0 20px 25px -5px rgb(0 0 0 / 0.08), 0 10px 10px -5px rgb(0 0 0 / 0.04);
  --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.12);
  --shadow-2xl: 0 50px 100px -20px rgb(0 0 0 / 0.14);

  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 1rem;
  --radius-3xl: 1.5rem;

  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;

  /* Orbit brand variables */
  --orbit-bg: #edf0f5;
  --orbit-surface: #ffffff;
  --orbit-surface-2: #f4f6f9;
  --orbit-surface-soft: rgba(0, 0, 0, 0.03);
  --orbit-border: rgba(0, 0, 0, 0.09);
  --orbit-border-strong: rgba(0, 0, 0, 0.15);
  --orbit-text: #0f172a;
  --orbit-muted: #64748b;
  --orbit-accent: #e8234a;
  --orbit-accent-dark: #c41535;
  --orbit-shadow: 0 24px 60px rgba(0, 0, 0, 0.1);
}

/* ═══════════════════════════════════════
   DARK THEME
═══════════════════════════════════════ */
[data-theme="dark"] {
  --primary: #e8234a;
  --primary-hover: #c41535;
  --primary-light: rgba(232, 35, 74, 0.15);
  --secondary: #94a3b8;
  --success: #34d399;
  --success-light: #065f46;
  --danger: #f87171;
  --danger-light: #7f1d1d;
  --warning: #fbbf24;
  --warning-light: #92400e;
  --info: #60a5fa;
  --info-light: #1e3a8a;

  --bg-primary: #0a0a0f;
  --bg-secondary: #0d0d14;
  --bg-tertiary: #13131c;
  --bg-accent: #1a1a26;
  --bg-surface: #1e1e2a;

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #7c8ba6;
  --text-inverse: #ffffff;

  --border-primary: rgba(255, 255, 255, 0.08);
  --border-secondary: rgba(255, 255, 255, 0.05);
  --border-accent: #e8234a;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-md:
    0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-lg:
    0 20px 25px -5px rgb(0 0 0 / 0.3), 0 10px 10px -5px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 25px 50px -12px rgb(0 0 0 / 0.4);
  --shadow-2xl: 0 50px 100px -20px rgb(0 0 0 / 0.4);

  --orbit-bg: #0a0a0f;
  --orbit-surface: #0d0d14;
  --orbit-surface-2: #13131c;
  --orbit-surface-soft: rgba(255, 255, 255, 0.04);
  --orbit-border: rgba(255, 255, 255, 0.07);
  --orbit-border-strong: rgba(255, 255, 255, 0.11);
  --orbit-text: #e2e8f0;
  --orbit-muted: #94a3b8;
  --orbit-accent: #e8234a;
  --orbit-accent-dark: #c41535;
  --orbit-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* ═══════════════════════════════════════
   BASE STYLES
═══════════════════════════════════════ */
body {
  font-family:
    "Inter",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  color: var(--text-primary);
  background: var(--orbit-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition:
    background 0.3s ease,
    color 0.3s ease;
  overflow-x: hidden;
}

/* ── Tailwind slate overrides are in index.html <style> block after Tailwind CDN ── */
/* (Kept here as fallback for non-Tailwind contexts) */
.text-white {
  color: #ffffff !important;
}

button,
input,
select,
textarea {
  transition: all 0.18s ease;
}
button:hover:not(:disabled) {
  transform: translateY(-1px);
}

/* ── Sidebar explicit background ── */
aside.sidebar,
#sidebar {
  background: var(--bg-secondary) !important;
  border-right-color: var(--border-primary) !important;
}

/* ── Light mode panel depth — cards get shadow instead of just border ── */
[data-theme="light"] .bg-slate-800,
[data-theme="light"] .bg-slate-900 {
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.07),
    0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

[data-theme="light"] aside.sidebar,
[data-theme="light"] #sidebar {
  background: #ffffff !important;
  border-right: 1px solid rgba(0, 0, 0, 0.09) !important;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.06) !important;
}

[data-theme="light"] header {
  background: #ffffff !important;
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.08) !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07) !important;
}

[data-theme="light"] #themeToggle {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

/* ── Secondary / utility buttons ── */
button.bg-slate-700,
button.bg-slate-800,
button.bg-slate-900,
#deleteSelectedBtn,
#themeToggle,
#selectAllBtn,
#clearSelectionBtn,
#resetIndexBtn,
#uploadBtn,
.nav-workspace,
.nav-analysis,
.nav-media {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-primary) !important;
  box-shadow: none !important;
}

#uploadBtn:hover,
#selectAllBtn:hover,
#clearSelectionBtn:hover,
#resetIndexBtn:hover,
#themeToggle:hover {
  background: var(--bg-accent) !important;
}

#cancelAnalyzeBtn {
  background: #a11f2d !important;
  color: #ffffff !important;
}

/* ── Primary CTA buttons — red gradient ── */
#insightsBtn,
#podcastBtn,
#analyzeBtn {
  background: linear-gradient(135deg, #e8234a 0%, #c41535 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 8px 24px rgba(232, 35, 74, 0.25) !important;
}

#insightsBtn:hover,
#podcastBtn:hover,
#analyzeBtn:hover {
  background: linear-gradient(135deg, #ff2d58 0%, #d51843 100%) !important;
  box-shadow: 0 12px 32px rgba(232, 35, 74, 0.35) !important;
}

#deleteSelectedBtn {
  background: rgba(232, 35, 74, 0.1) !important;
  color: #e8234a !important;
  border-color: rgba(232, 35, 74, 0.2) !important;
}

/* ── Sidebar nav ── */
.nav-workspace.active,
.nav-analysis.active,
.nav-media.active {
  color: var(--text-primary) !important;
  background: rgba(232, 35, 74, 0.12) !important;
  border-left-width: 4px !important;
  border-left-color: #e8234a !important;
}

.nav-workspace,
.nav-analysis,
.nav-media {
  color: var(--text-secondary) !important;
}

.nav-workspace:hover,
.nav-analysis:hover,
.nav-media:hover {
  background: var(--bg-tertiary) !important;
  color: var(--text-primary) !important;
}

/* ── Background glow orbs ── */
.fixed.inset-0 .bg-gradient-to-br {
  background: radial-gradient(
    circle at top right,
    rgba(232, 35, 74, 0.08),
    transparent 55%
  ) !important;
}

.fixed.inset-0 .bg-gradient-to-tr {
  background: radial-gradient(
    circle at bottom left,
    rgba(196, 21, 53, 0.06),
    transparent 55%
  ) !important;
}

.page-content {
  background: transparent !important;
}

/* Kill lingering blue/purple gradients */
.bg-gradient-to-br.from-blue-500.to-purple-500,
.bg-gradient-to-br.from-purple-500.to-purple-600 {
  background-image: linear-gradient(
    135deg,
    var(--bg-tertiary),
    var(--bg-accent)
  ) !important;
}

.bg-blue-500,
.bg-purple-500 {
  background-color: var(--bg-accent) !important;
}
.bg-blue-500\/20,
.bg-emerald-500\/20,
.bg-purple-500\/20 {
  background-color: var(--bg-tertiary) !important;
}
.border-blue-500\/30,
.border-emerald-500\/30,
.border-purple-500\/30 {
  border-color: var(--border-primary) !important;
}
.border-red-900\/30 {
  border-color: rgba(232, 35, 74, 0.2) !important;
}

.bg-red-500 {
  background-color: #e8234a !important;
}
.text-red-300 {
  color: #e8234a !important;
}

.text-xs,
.text-sm,
.text-lg,
.font-medium,
.font-semibold,
.font-bold {
  color: inherit !important;
}

/* ── Inputs ── */
input,
textarea,
select {
  background: var(--bg-primary) !important;
  border-color: var(--border-primary) !important;
  color: var(--text-primary) !important;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted) !important;
}
button[disabled] {
  opacity: 0.45 !important;
}

/* ── Progress bar ── */
#progressBar,
#uploadProgressBar {
  background: linear-gradient(135deg, #e8234a 0%, #c41535 100%) !important;
  background-size: 200% 100%;
  animation: gradientShift 2s ease-in-out infinite;
}

#uploadProgressBar.success {
  background: linear-gradient(90deg, #10b981 0%, #34d399 100%) !important;
  animation: none;
}

#uploadProgressBar.error {
  background: linear-gradient(90deg, #ef4444 0%, #f87171 100%) !important;
  animation: none;
}

#uploadProgressPercent {
  font-weight: 600;
  color: #e8234a;
  transition: all 0.3s ease-out;
}

pre {
  color: var(--text-primary) !important;
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-success,
[data-theme="dark"] .btn-danger {
  box-shadow: var(--shadow-lg) !important;
}

/* ═══════════════════════════════════════
   TYPOGRAPHY
═══════════════════════════════════════ */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--spacing-md);
  color: var(--text-primary);
}
h1 {
  font-size: 2.25rem;
}
h2 {
  font-size: 1.75rem;
}
h3 {
  font-size: 1.5rem;
}
h4 {
  font-size: 1.25rem;
}
h5 {
  font-size: 1.125rem;
}
h6 {
  font-size: 1rem;
}

#orbitTitle {
  position: absolute;
  left: 100px;
  top: 15px;
}
#adobeLogo {
  position: absolute;
  left: 30px;
  width: 30px;
  height: 30px;
}

.card-title,
.card-header h2,
.card-header h3 {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.card-content,
.card-body,
.card-content *,
.card-body * {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.card-tabs,
.card-tabs .tab,
.section-header {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
}

.card-tabs .tab.active,
.section-header.active {
  border-bottom: 2px solid #e8234a;
  background: rgba(232, 35, 74, 0.08);
}

button,
.btn {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 600;
  font-size: 1rem;
}

.header-title,
.main-title,
h1.header-title {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: #e8234a;
}

footer,
.footer {
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  font-size: 0.95rem;
}

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   LAYOUT
═══════════════════════════════════════ */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Header */
header {
  background: var(--orbit-surface);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--orbit-border);
  position: sticky;
  top: 0;
  z-index: 50;
  transition:
    background 0.3s ease,
    border-color 0.3s ease;
  box-shadow: var(--shadow-md);
}

main {
  min-height: 0;
  padding: 0;
  position: relative;
  z-index: 1;
}

.grid {
  display: grid;
  gap: var(--spacing-xl);
}
.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}
.grid-cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

@media (min-width: 1280px) {
  .xl\:grid-cols-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .xl\:col-span-2 {
    grid-column: span 2 / span 2;
  }
  .xl\:col-span-3 {
    grid-column: span 3 / span 3;
  }
}

/* ═══════════════════════════════════════
   CARD
═══════════════════════════════════════ */
.card {
  background: var(--orbit-surface);
  border: 1px solid var(--orbit-border);
  border-radius: var(--radius-3xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transition: var(--transition-bounce);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}

.card:hover {
  box-shadow: var(--shadow-2xl);
  transform: translateY(-2px);
}

.card-header {
  padding: var(--spacing-xl);
  border-bottom: 1px solid var(--orbit-border);
  background: var(--orbit-surface-soft);
}

.card-body {
  padding: var(--spacing-xl);
}

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid transparent;
  border-radius: var(--radius-xl);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-bounce);
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
}

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

.btn-primary {
  background: linear-gradient(135deg, #e8234a 0%, #c41535 100%);
  color: #ffffff;
  border-color: #e8234a;
  box-shadow: 0 8px 24px rgba(232, 35, 74, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #ff2d58 0%, #d51843 100%);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 12px 32px rgba(232, 35, 74, 0.35);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border-color: var(--border-primary);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-accent);
  transform: translateY(-1px) scale(1.02);
}

.btn-success {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  color: #ffffff;
  border-color: var(--success);
  box-shadow: var(--shadow-lg);
}
.btn-success:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-xl);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: #ffffff;
  border-color: var(--danger);
  box-shadow: var(--shadow-lg);
}
.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-xl);
}

/* ═══════════════════════════════════════
   INPUTS
═══════════════════════════════════════ */
.input {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: var(--transition-bounce);
}

.input:focus {
  outline: none;
  border-color: #e8234a;
  box-shadow: 0 0 0 3px rgba(232, 35, 74, 0.15);
  transform: scale(1.01);
}

.input::placeholder {
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   BADGES
═══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}
.badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}
.badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}
.badge-danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

/* ═══════════════════════════════════════
   DOCUMENT LIST
═══════════════════════════════════════ */
.doc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.doc-item {
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.375rem;
  background: var(--orbit-surface);
  border: 1px solid var(--orbit-border);
  border-radius: calc(var(--radius-xl) - 8px);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.doc-item:hover {
  background: var(--bg-tertiary);
  border-color: rgba(232, 35, 74, 0.25);
  transform: translateX(2px);
  box-shadow: 0 2px 12px rgba(232, 35, 74, 0.08);
}

.doc-item.selected {
  background: rgba(232, 35, 74, 0.08);
  border-color: rgba(232, 35, 74, 0.4);
}

.doc-item.selected:hover {
  background: rgba(232, 35, 74, 0.12);
}

/* ═══════════════════════════════════════
   DRAG & DROP
═══════════════════════════════════════ */
.group\/upload.dragover,
.upload-area.dragover {
  border-color: #e8234a;
  background: rgba(232, 35, 74, 0.06);
  transform: scale(1.02);
  box-shadow: var(--shadow-xl);
}

/* ═══════════════════════════════════════
   MODALS — Upload + Delete
═══════════════════════════════════════ */
#uploadProgressModal,
#deleteConfirmationModal {
  animation: fadeIn 0.3s ease-out;
}

#uploadProgressModal .bg-white,
#uploadProgressModal .dark\:bg-slate-800,
#deleteConfirmationModal .bg-white,
#deleteConfirmationModal .dark\:bg-slate-800 {
  animation: scaleIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  background: var(--orbit-surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--orbit-border) !important;
}

#deleteConfirmationModal button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
#deleteConfirmationModal button:disabled:hover {
  transform: none;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

/* ═══════════════════════════════════════
   SECTION & SNIPPET ITEMS
═══════════════════════════════════════ */
.section-item,
.snippet-item {
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  background: var(--orbit-surface);
  border: 1px solid var(--orbit-border);
  border-radius: var(--radius-xl);
  transition: var(--transition-bounce);
  position: relative;
  overflow: hidden;
}

.section-item::before,
.snippet-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #e8234a, #c41535);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.section-item:hover::before,
.snippet-item:hover::before {
  transform: scaleX(1);
}

.section-item:hover,
.snippet-item:hover {
  background: var(--bg-tertiary);
  border-color: rgba(232, 35, 74, 0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.section-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  font-size: 1.1rem;
}
.section-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-sm);
  font-weight: 500;
}
.section-content {
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ═══════════════════════════════════════
   RELATED ITEMS
═══════════════════════════════════════ */
.related-sections {
  margin-top: var(--spacing-md);
  padding-top: var(--spacing-md);
  border-top: 1px solid var(--orbit-border);
}

.related-item {
  display: inline-block;
  margin: var(--spacing-xs) var(--spacing-xs) 0 0;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--orbit-border);
  border-radius: var(--radius-lg);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-bounce);
}

.related-item:hover {
  background: rgba(232, 35, 74, 0.1);
  border-color: rgba(232, 35, 74, 0.3);
  color: #e8234a;
  transform: translateY(-1px) scale(1.03);
}

/* ═══════════════════════════════════════
   UPLOAD AREA
═══════════════════════════════════════ */
.upload-area {
  border: 2px dashed var(--orbit-border-strong);
  border-radius: var(--radius-2xl);
  padding: var(--spacing-3xl);
  text-align: center;
  transition: var(--transition-bounce);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.upload-area::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(232, 35, 74, 0.04) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}
.upload-area:hover::before {
  opacity: 1;
}

.upload-area:hover {
  border-color: rgba(232, 35, 74, 0.4);
  background: rgba(232, 35, 74, 0.03);
  transform: scale(1.01);
  box-shadow:
    0 0 0 1px rgba(232, 35, 74, 0.1),
    var(--shadow-lg);
}

.upload-icon {
  font-size: 3rem;
  color: var(--text-muted);
  margin-bottom: var(--spacing-lg);
  transition: var(--transition-bounce);
}
.upload-area:hover .upload-icon {
  color: #e8234a;
  transform: scale(1.1);
}

/* ═══════════════════════════════════════
   PDF VIEWER
═══════════════════════════════════════ */
#pdf-viewer-container {
  width: 100% !important;
  height: 70vh !important;
  min-height: 500px !important;
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  overflow: auto !important;
  box-shadow: var(--shadow-2xl);
  border: 1px solid var(--border-primary);
  position: relative;
}

.pdf-loading,
.pdf-error,
.pdf-no-document {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--bg-primary), 0.9);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

#pdf-canvas {
  display: block;
  margin: 0 auto;
  max-width: none;
  height: auto;
}

#text-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

#text-layer .text-layer-page {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
  -webkit-user-select: text;
  user-select: text;
}

#text-layer span {
  position: absolute;
  white-space: pre;
  cursor: text;
  color: transparent !important;
  background: transparent;
  border: none;
  outline: none;
  z-index: 2;
}

#pdf-viewer-container::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
#pdf-viewer-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}
#pdf-viewer-container::-webkit-scrollbar-thumb {
  background: rgba(232, 35, 74, 0.4);
  border-radius: 4px;
}
#pdf-viewer-container::-webkit-scrollbar-thumb:hover {
  background: rgba(232, 35, 74, 0.65);
}

/* Adobe viewer */
#adobe-dc-view {
  width: 100% !important;
  height: 70vh !important;
  min-height: 600px !important;
  position: relative;
}
#adobe-dc-view iframe {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
#adobe-dc-view .adobe-dc-view-content {
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}
#adobe-dc-view > div,
#adobe-dc-view > div > div {
  width: 100% !important;
  height: 100% !important;
}
#adobe-dc-view .adobe-dc-view {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  background: var(--bg-primary) !important;
  color: var(--text-primary) !important;
}
#adobe-dc-view .adobe-dc-view-toolbar {
  background: var(--orbit-surface) !important;
  color: var(--text-primary) !important;
}

/* ═══════════════════════════════════════
   TOOLBAR
═══════════════════════════════════════ */
.toolbar {
  padding: var(--spacing-xl);
  background: var(--orbit-surface);
  border-bottom: 1px solid var(--orbit-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--spacing-lg);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
}
.toolbar-divider {
  width: 1px;
  height: 2.5rem;
  background: var(--orbit-border);
}

/* Search */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: var(--spacing-md);
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: var(--transition);
}
.search-input {
  padding-left: 3rem;
  width: 18rem;
  transition: var(--transition-bounce);
}
.search-input:focus + .search-icon {
  color: #e8234a;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}
.page-input {
  width: 5rem;
  text-align: center;
  font-weight: 600;
}
.zoom-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
}
.zoom-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════
   TOASTS
═══════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  max-width: 28rem;
}

.toast {
  padding: var(--spacing-lg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-2xl);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  animation: slideInRight 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  border: 1px solid;
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  background: var(--orbit-surface);
  transition: var(--transition-bounce);
}
.toast:hover {
  transform: translateX(-4px) scale(1.02);
}

.toast-info {
  color: var(--info);
  border-color: rgba(59, 130, 246, 0.25);
}
.toast-success {
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.25);
}
.toast-warning {
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.25);
}
.toast-error {
  color: #e8234a;
  border-color: rgba(232, 35, 74, 0.3);
}

.toast-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════
   LOADING OVERLAY
═══════════════════════════════════════ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease-out;
}

.loading-content {
  background: var(--orbit-surface);
  border-radius: var(--radius-3xl);
  padding: var(--spacing-2xl);
  box-shadow: var(--shadow-2xl);
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  border: 1px solid var(--orbit-border);
  animation: scaleIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(232, 35, 74, 0.15);
  border-top-color: #e8234a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ═══════════════════════════════════════
   CUSTOM SCROLLBAR
═══════════════════════════════════════ */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #e8234a 0%, #c41535 100%);
  border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #ff2d58 0%, #e8234a 100%);
}

/* ═══════════════════════════════════════
   ANIMATIONS
═══════════════════════════════════════ */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes slideInUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
@keyframes scaleIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 1280px) {
  .xl\:grid-cols-5 {
    grid-template-columns: 1fr;
  }
  .xl\:col-span-2,
  .xl\:col-span-3 {
    grid-column: span 1;
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }
  .toolbar-left,
  .toolbar-right {
    justify-content: center;
    flex-wrap: wrap;
  }
  .search-input {
    width: 100%;
    max-width: 18rem;
  }
}

@media (max-width: 768px) {
  main {
    padding: 0;
  }
  .card-header,
  .card-body {
    padding: var(--spacing-lg);
  }
  .btn {
    padding: var(--spacing-sm);
    font-size: 0.8rem;
  }
  .input {
    font-size: 0.8rem;
  }
  .upload-area {
    padding: var(--spacing-xl);
  }
  .toolbar {
    padding: var(--spacing-lg);
  }

  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 40;
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
  }

  .grid-cols-12 {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }
  .col-span-3,
  .col-span-6 {
    grid-column: span 1 !important;
  }
  #pdf-viewer-container {
    height: 60vh;
  }
  header .flex-1.max-w-2xl .flex {
    flex-wrap: wrap;
    gap: 6px;
  }
  header .flex-1.max-w-2xl .flex > * {
    flex: 1 1 140px;
  }
}

/* ═══════════════════════════════════════
   UTILITIES
═══════════════════════════════════════ */
.hidden {
  display: none;
}
.block {
  display: block;
}
.flex {
  display: flex;
}
.inline-flex {
  display: inline-flex;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.space-x-2 > * + * {
  margin-left: var(--spacing-sm);
}
.space-x-4 > * + * {
  margin-left: var(--spacing-md);
}
.space-y-2 > * + * {
  margin-top: var(--spacing-sm);
}
.space-y-4 > * + * {
  margin-top: var(--spacing-md);
}
.space-y-6 > * + * {
  margin-top: var(--spacing-lg);
}
.w-full {
  width: 100%;
}
.h-full {
  height: 100%;
}
.min-h-screen {
  min-height: 100vh;
}
.rounded {
  border-radius: var(--radius);
}
.rounded-lg {
  border-radius: var(--radius-lg);
}
.rounded-xl {
  border-radius: var(--radius-xl);
}
.rounded-2xl {
  border-radius: var(--radius-2xl);
}
.rounded-3xl {
  border-radius: var(--radius-3xl);
}
.shadow {
  box-shadow: var(--shadow);
}
.shadow-lg {
  box-shadow: var(--shadow-lg);
}
.shadow-xl {
  box-shadow: var(--shadow-xl);
}
.shadow-2xl {
  box-shadow: var(--shadow-2xl);
}
.border {
  border: 1px solid var(--border-primary);
}
.transition {
  transition: var(--transition);
}
.transform {
  transform: translateZ(0);
}
.hover\:scale-105:hover {
  transform: scale(1.05);
}
.hover\:shadow-lg:hover {
  box-shadow: var(--shadow-lg);
}
.hover\:scale-\[1\.02\]:hover {
  transform: scale(1.02);
}
.hover\:scale-\[1\.01\]:hover {
  transform: scale(1.01);
}

.focus\:ring-2:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(232, 35, 74, 0.2);
}
.focus\:border-transparent:focus {
  border-color: transparent;
}
.disabled\:opacity-50:disabled {
  opacity: 0.5;
}
.disabled\:cursor-not-allowed:disabled {
  cursor: not-allowed;
}
.disabled\:transform-none:disabled {
  transform: none !important;
}

@media print {
  .no-print {
    display: none !important;
  }
}
@media (prefers-contrast: high) {
  :root {
    --border-primary: rgba(0, 0, 0, 0.3);
    --shadow: none;
    --shadow-lg: none;
    --shadow-xl: none;
    --shadow-2xl: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Toast Animations */
.toast-item {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.toast-item.translate-x-0 {
  transform: translateX(0);
}
.toast-item.translate-x-full {
  transform: translateX(100%);
}
.toast-item.opacity-0 {
  opacity: 0;
}
.toast-item.opacity-100 {
  opacity: 1;
}
.toast-item * {
  transition: all 0.2s ease-in-out;
}

/* ═══════════════════════════════════════
   PDF TEXT LAYER
═══════════════════════════════════════ */
.pdf-page-container {
  position: relative;
  display: inline-block;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  overflow: hidden;
}

.textLayer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0.2;
  line-height: 1;
  -webkit-user-select: text;
  user-select: text;
  pointer-events: auto;
}

.textLayer > span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  pointer-events: auto;
}

.textLayer .highlight {
  margin: -1px;
  padding: 1px;
  background-color: rgba(232, 35, 74, 0.2);
  border-radius: 4px;
}
.textLayer .highlight.begin {
  border-radius: 4px 0 0 4px;
}
.textLayer .highlight.end {
  border-radius: 0 4px 4px 0;
}
.textLayer .highlight.middle {
  border-radius: 0;
}
.textLayer .highlight.selected {
  background-color: rgba(232, 35, 74, 0.35);
}

.textLayer span::selection {
  background: rgba(232, 35, 74, 0.35);
}
.textLayer span::-moz-selection {
  background: rgba(232, 35, 74, 0.35);
}

.text-layer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  opacity: 0.2;
  line-height: 1;
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

.text-layer > span {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  pointer-events: auto;
}

.text-layer ::selection {
  background: rgba(232, 35, 74, 0.35);
  color: transparent;
}
.text-layer ::-moz-selection {
  background: rgba(232, 35, 74, 0.35);
  color: transparent;
}
.text-layer .selected {
  background-color: rgba(232, 35, 74, 0.25);
  color: transparent;
  border-radius: 2px;
}

#text-selection-toolbar {
  animation: slideInUp 0.2s ease-out;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(232, 35, 74, 0.2);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
  background: var(--orbit-surface);
}

#text-selection-toolbar button {
  transition: all 0.15s ease-in-out;
}
#text-selection-toolbar button:hover {
  transform: translateY(-1px);
}

.page-wrapper {
  position: relative;
}
.page-wrapper .text-layer {
  z-index: 2;
}
.page-wrapper .page-canvas {
  position: relative;
  z-index: 1;
}
#pdf-viewer-container .text-layer {
  z-index: 2;
}

#single-page-text-layer {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
}

.text-selection-hint {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #e8234a;
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(232, 35, 74, 0.3);
  z-index: 1000;
  animation: fadeInUp 0.3s ease-out;
}
