/* LibreScope — Application Stylesheet
   Design: dark admin panel, indigo accent, Inter-like sans-serif
   No external CDN — all self-hosted via system fonts + CSS
*/

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

:root {
  --color-bg: #030712;
  --color-surface: #111827;
  --color-surface-2: #1f2937;
  --color-border: #1f2937;
  --color-border-2: #374151;
  --color-text: #f3f4f6;
  --color-text-muted: #9ca3af;
  --color-text-faint: #4b5563;
  --color-accent: #4f46e5;
  --color-accent-hover: #4338ca;
  --color-accent-light: #818cf8;
  --color-success: #059669;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.3);
}

html { font-size: 14px; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout utilities ────────────────────────────────────── */
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; }
.gap-1\.5 { gap: 6px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.gap-x-2 { column-gap: 8px; }
.gap-x-3 { column-gap: 12px; }
.gap-x-4 { column-gap: 16px; }
.gap-y-1 { row-gap: 4px; }
.min-w-0 { min-width: 0; }
.flex-wrap { flex-wrap: wrap; }
.h-full { height: 100%; }
.w-full { width: 100%; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.col-span-2 { grid-column: span 2; }
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:col-span-2 { grid-column: span 2; }
}
@media (min-width: 768px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:col-span-2 { grid-column: span 2; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:col-span-2 { grid-column: span 2; }
}

/* ── Spacing ─────────────────────────────────────────────── */
.px-2 { padding-inline: 8px; }
.px-3 { padding-inline: 12px; }
.px-4 { padding-inline: 16px; }
.px-5 { padding-inline: 20px; }
.px-6 { padding-inline: 24px; }
.py-1 { padding-block: 4px; }
.py-0\.5 { padding-block: 2px; }
.py-2 { padding-block: 8px; }
.py-3 { padding-block: 12px; }
.py-4 { padding-block: 16px; }
.py-6 { padding-block: 24px; }
.py-12 { padding-block: 48px; }
.py-16 { padding-block: 64px; }
.mt-0\.5 { margin-top: 2px; }
.mt-1 { margin-top: 4px; }
.mt-1\.5 { margin-top: 6px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }
.pb-3 { padding-bottom: 12px; }
.mx-4 { margin-inline: 16px; }
.mx-auto { margin-inline: auto; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }

/* ── Typography ──────────────────────────────────────────── */
.text-xs { font-size: 11px; }
.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.break-all { word-break: break-all; }
.leading-tight { line-height: 1.3; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
.tracking-tight { letter-spacing: -0.02em; }
.tracking-wide { letter-spacing: 0.05em; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Colors ──────────────────────────────────────────────── */
.text-white { color: #ffffff; }
.text-gray-100 { color: #f3f4f6; }
.text-gray-200 { color: #e5e7eb; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-indigo-300 { color: #a5b4fc; }
.text-indigo-400 { color: #818cf8; }
.text-amber-300 { color: #fcd34d; }
.text-amber-400 { color: #fbbf24; }
.text-amber-600 { color: #d97706; }
.text-green-300 { color: #6ee7b7; }
.text-green-400 { color: #34d399; }
.text-red-300 { color: #fca5a5; }
.text-red-400 { color: #f87171; }
.bg-gray-800 { background: #1f2937; }
.bg-gray-900 { background: #111827; }
.bg-gray-950 { background: #030712; }
.bg-indigo-600 { background: #4f46e5; }
.bg-indigo-800 { background: #3730a3; }
.bg-indigo-900 { background: #312e81; }
.bg-amber-900 { background: rgba(120, 53, 15, .3); }
.bg-amber-950\/30 { background: rgba(69, 26, 3, .3); }
.bg-green-900 { background: rgba(6, 78, 59, .4); }
.bg-red-900 { background: rgba(127, 29, 29, .4); }
.bg-red-950 { background: rgba(69, 10, 10, .4); }
.bg-green-950 { background: rgba(2, 44, 34, .4); }
.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-r { border-right-width: 1px; }
.border-t { border-top-width: 1px; }
.border-gray-700 { border-color: #374151; }
.border-gray-800 { border-color: #1f2937; }
.border-red-800 { border-color: rgba(153, 27, 27, .5); }
.border-amber-800 { border-color: rgba(146, 64, 14, .5); }
.border-green-800 { border-color: rgba(6, 95, 70, .5); }
.last\:border-0:last-child { border-width: 0; }

/* ── Sizing ──────────────────────────────────────────────── */
.w-4 { width: 16px; } .h-4 { height: 16px; }
.w-5 { width: 20px; } .h-5 { height: 20px; }
.w-6 { width: 24px; } .h-6 { height: 24px; }
.w-7 { width: 28px; } .h-7 { height: 28px; }
.w-8 { width: 32px; } .h-8 { height: 32px; }
.w-12 { width: 48px; } .h-12 { height: 48px; }
.w-14 { width: 56px; } .h-14 { height: 56px; }
.w-20 { height: 80px; }
.h-20 { height: 80px; }
.w-56 { width: 224px; }
.max-w-sm { max-width: 384px; }
.max-w-xs { max-width: 320px; }
.max-w-6xl { max-width: 1152px; }

/* ── Borders & Radius ────────────────────────────────────── */
.rounded { border-radius: var(--radius-sm); }
.rounded-full { border-radius: 9999px; }
.rounded-lg { border-radius: var(--radius); }
.rounded-xl { border-radius: var(--radius-lg); }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* ── Misc ────────────────────────────────────────────────── */
.fixed { position: fixed; }
.inset-0 { inset: 0; }
.z-50 { z-index: 50; }
.hidden { display: none; }
.inline-block { display: inline-block; }
.inline-flex { display: inline-flex; }
.cursor-pointer { cursor: pointer; }
.object-cover { object-fit: cover; }
.list-disc { list-style-type: disc; }
.list-inside { list-style-position: inside; }
.space-y-1 > * + * { margin-top: 4px; }
.table { display: table; }
.w-full.table { width: 100%; border-collapse: collapse; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 0; }

/* ── Components ──────────────────────────────────────────── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-hover {
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-decoration: none;
  color: inherit;
  display: flex;
}
.card-hover:hover {
  border-color: var(--color-border-2);
  background: var(--color-surface-2);
}

.input {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border-2);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: var(--color-text);
  font-size: 13px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}
.input:focus {
  border-color: var(--color-accent-light);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.input::placeholder { color: var(--color-text-faint); }
select.input { cursor: pointer; }
.input:disabled { opacity: .5; cursor: not-allowed; }

.label {
  font-size: 12px;
  font-weight: 500;
  color: var(--color-text-muted);
  letter-spacing: .01em;
}

.checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--color-accent);
  cursor: pointer;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--color-accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .1s;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--color-accent-hover); }
.btn-primary:active { transform: scale(.98); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border-2);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
  text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
}
.btn-secondary:hover { background: #374151; color: var(--color-text); }

.btn-warning {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  background: rgba(180, 83, 9, .25);
  color: #fbbf24;
  border: 1px solid rgba(180, 83, 9, .4);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.btn-warning:hover { background: rgba(180, 83, 9, .4); }

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  background: rgba(127, 29, 29, .25);
  color: #f87171;
  border: 1px solid rgba(127, 29, 29, .4);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover { background: rgba(127, 29, 29, .4); }

/* ── Navigation ──────────────────────────────────────────── */
.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: var(--radius);
  color: var(--color-text-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-link:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}
.nav-link.active {
  background: rgba(79, 70, 229, .15);
  color: var(--color-accent-light);
}
.nav-link.hover\:text-red-400:hover { color: #f87171; }

/* ── Status badges ───────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 500;
  text-transform: capitalize;
  white-space: nowrap;
}
.status-queued { background: rgba(55, 65, 81, .5); color: #9ca3af; }
.status-running,
.status-downloading,
.status-extracting,
.status-moving { background: rgba(49, 46, 129, .5); color: #a5b4fc; }
.status-completed { background: rgba(6, 78, 59, .4); color: #6ee7b7; }
.status-failed { background: rgba(127, 29, 29, .4); color: #fca5a5; }
.status-duplicate_found { background: rgba(120, 53, 15, .4); color: #fcd34d; }
.status-cancelled { background: rgba(55, 65, 81, .4); color: #6b7280; }

/* ── Animations ──────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }

/* ── Scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4b5563; }
