/* THE ARCHIVE — Core Styles + Tailwind Utilities */

/* Tailwind base */
*, ::before, ::after { box-sizing: border-box; }
html { line-height: 1.5; -webkit-text-size-adjust: 100%; }
body { margin: 0; line-height: 1.5; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* Layout */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.contents { display: contents; }

/* Flex */
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.flex-none { flex: none; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.space-y-0\.5 > * + * { margin-top: 0.125rem; }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* Grid */
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Sizing */
.w-full { width: 100%; }
.w-56 { width: 14rem; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-8 { width: 2rem; }
.w-14 { width: 3.5rem; }
.w-20 { width: 5rem; }
.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-\[85vh\] { max-width: 85vh; }
.max-h-\[85vh\] { max-height: 85vh; }
.max-h-96 { max-height: 24rem; }
.max-h-\[32rem\] { max-height: 32rem; }
.h-3 { height: 0.75rem; }
.h-4 { height: 1rem; }
.h-8 { height: 2rem; }
.h-14 { height: 3.5rem; }
.min-h-screen { min-height: 100vh; }
.min-h-0 { min-height: 0; }
.min-w-0 { min-width: 0; }
.min-w-max { min-width: max-content; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Spacing */
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.ml-1 { margin-left: 0.25rem; }
.mr-1 { margin-left: 0.25rem; }
.mr-2 { margin-left: 0.5rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.-translate-y-0\.5 { transform: translateY(-0.125rem); }

/* Positioning */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.sticky { position: sticky; }
.z-\[900\] { z-index: 900; }
.z-\[999\] { z-index: 999; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.text-\[2xl\] { font-size: 2rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-extrabold { font-weight: 800; }
.uppercase { text-transform: uppercase; }
.capitalize { text-transform: capitalize; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-widest { letter-spacing: 0.1em; }
.leading-relaxed { line-height: 1.625; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.whitespace-pre-wrap { white-space: pre-wrap; }

/* Colors */
.text-white { color: #fff; }
.text-slate-100 { color: #f1f5f9; }
.text-slate-200 { color: #e2e8f0; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-400 { color: #94a3b8; }
.text-slate-500 { color: #64748b; }
.text-slate-600 { color: #475569; }
.text-slate-700 { color: #334155; }
.text-ink { color: #0b0d12; }
.text-accent { color: #7c5cff; }
.text-accent2 { color: #22d3ee; }
.text-emerald-400 { color: #34d399; }
.text-red-300 { color: #fca5a5; }
.text-red-400 { color: #f87171; }
.bg-white { background-color: #fff; }
.bg-black { background-color: #000; }
.bg-ink { background-color: #0b0d12; }
.bg-panel { background-color: #12151c; }
.bg-panel2 { background-color: #171b24; }
.bg-accent { background-color: #7c5cff; }
.bg-accent\/10 { background-color: rgba(124,92,255,0.1); }
.bg-accent\/15 { background-color: rgba(124,92,255,0.15); }
.bg-accent\/20 { background-color: rgba(124,92,255,0.2); }
.bg-accent\/80 { background-color: rgba(124,92,255,0.8); }
.bg-white\/5 { background-color: rgba(255,255,255,0.05); }
.bg-white\/10 { background-color: rgba(255,255,255,0.1); }
.bg-black\/30 { background-color: rgba(0,0,0,0.3); }
.bg-black\/70 { background-color: rgba(0,0,0,0.7); }
.bg-emerald-400\/15 { background-color: rgba(52,211,153,0.15); }
.bg-red-500\/15 { background-color: rgba(239,68,68,0.15); }
.bg-yellow-500\/15 { background-color: rgba(234,179,8,0.15); }
.bg-orange-500\/15 { background-color: rgba(249,115,22,0.15); }
.bg-slate-400\/15 { background-color: rgba(148,163,184,0.15); }
.bg-transparent { background-color: transparent; }
.bg-\[\#1c212b\] { background-color: #1c212b; }
.bg-\[\#2a3040\] { background-color: #2a3040; }
.bg-\[\#0f1319\] { background-color: #0f1319; }
.bg-\[\#232833\] { background-color: #232833; }
.border-0 { border-width: 0; }
.border { border-width: 1px; }
.border-b { border-bottom-width: 1px; }
.border-t { border-top-width: 1px; }
.border-r { border-right-width: 1px; }
.border-l-2 { border-left-width: 2px; }
.border-accent { border-color: #7c5cff; }
.border-accent\/30 { border-color: rgba(124,92,255,0.3); }
.border-accent\/50 { border-color: rgba(124,92,255,0.5); }
.border-red-500 { border-color: #f87171; }
.border-slate-600 { border-color: #64748b; }
.border-\[\#1c212b\] { border-color: #1c212b; }
.border-\[\#232833\] { border-color: #232833; }
.border-\[\#2a3040\] { border-color: #2a3040; }
.border-white\/10 { border-color: rgba(255,255,255,0.1); }
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-2xl { border-radius: 1rem; }
.rounded-full { border-radius: 9999px; }
.rounded-\[15px\] { border-radius: 15px; }
.shadow-xl { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1); }

/* Transitions */
.transition { transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-all { transition: all 150ms; }
.duration-200 { transition-duration: 200ms; }

/* Focus */
.ring-2 { box-shadow: 0 0 0 2px var(--tw-ring-inset), 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); }
.ring-accent { --tw-ring-color: #7c5cff; }
.focus\:ring-0:focus { box-shadow: none; }

/* Hover */
.hover\:text-white:hover { color: #fff; }
.hover\:text-red-400:hover { color: #f87171; }
.hover\:text-red-300:hover { color: #fca5a5; }
.hover\:border-accent:hover { border-color: #7c5cff; }
.hover\:bg-accent\/80:hover { background-color: rgba(124,92,255,0.8); }
.hover\:bg-white\/5:hover { background-color: rgba(255,255,255,0.05); }
.hover\:bg-accent\/10:hover { background-color: rgba(124,92,255,0.1); }
.hover\:underline { text-decoration: underline; }
.hover\:shadow-xl:hover { box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1); }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.select-all { user-select: all; }

/* Animations */
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Other utilities */
.opacity-0 { opacity: 0; }
.backdrop-blur { backdrop-filter: blur(8px); }
.opacity-50 { opacity: 0.5; }
.group:hover .group-hover\:opacity-100 { opacity: 1; }
.group:hover .group-hover\:-translate-y-0\.5 { transform: translateY(-0.125rem); }
.list-disc { list-style-type: disc; }
.list-decimal { list-style-type: decimal; }
.list-inside { list-style-position: inside; }

/* Media queries */
@media (min-width: 768px) {
  .md\:flex { display: flex; }
  .md\:flex-col { flex-direction: column; }
  .md\:p-8 { padding: 2rem; }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .lg\:col-span-2 { grid-column: span 2 / span 2; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (pointer: coarse) {
  button, .provider-chip, .nav-link, .badge, input, textarea, select, .card, .evidence-card { min-height: 48px; min-width: 48px; }
  .card > *, .evidence-card > * { padding: 8px; }
  button:active, .card:active, .evidence-card:active { background: rgba(124,92,255,0.1) !important; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  .card, .evidence-card { padding: 12px; }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  .fade-in, .spinner, .nav-link,
  .provider-chip, .badge,
  .evidence-card {
    transition: none !important;
  }
}

/* Font loading */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

html, body { height: 100%; }
body { min-height: 100vh; font-family: 'Inter', system-ui, sans-serif; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: #3a3f4b #12151c; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #12151c; }
::-webkit-scrollbar-thumb { background: #3a3f4b; border-radius: 8px; }

/* Basic utilities */
.glow-border {
  background: linear-gradient(135deg, rgba(124,92,255,0.5), rgba(34,211,238,0.35));
  padding: 1px;
  border-radius: 16px;
}
.glow-border > * { border-radius: 15px; }

.gradient-text {
  background: linear-gradient(90deg, #7c5cff, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.card {
  background: #12151c;
  border: 1px solid #232833;
  border-radius: 14px;
}

/* Evidence card mark styles */
.evidence-card mark {
  background: rgba(124, 92, 255, 0.35);
  color: #e5d9ff;
  padding: 0 2px;
  border-radius: 3px;
}

/* Fade-in animation */
.fade-in { animation: fadeIn .25s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: translateY(0);} }

/* Spinner */
.spinner {
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: #7c5cff;
  border-radius: 50%;
  width: 16px; height: 16px;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 2px 8px; border-radius: 999px;
  text-transform: uppercase;
}
.badge-synced { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-syncing { background: rgba(124,92,255,0.15); color: #a78bfa; }
.badge-auth { background: rgba(234,179,8,0.15); color: #facc15; }
.badge-rate { background: rgba(249,115,22,0.15); color: #fb923c; }
.badge-error { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-paused { background: rgba(148,163,184,0.15); color: #94a3b8; }
.badge-none { background: rgba(100,116,139,0.15); color: #64748b; }

/* Provider chips */
.provider-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 10px;
  border: 1px solid #232833; background: #171b24;
  font-size: 13px; font-weight: 500;
}

/* Nav links */
.nav-link { transition: all .15s ease; }
.nav-link.active { color: #fff; background: rgba(124,92,255,0.15); }

/* Timeline */
.timeline-line { background: linear-gradient(180deg, #7c5cff, transparent); width: 2px; }

/* Input styles */
input[type=text], input[type=password], input[type=search], textarea, select {
  background: #0f1319;
  border: 1px solid #262b36;
  color: #e5e7eb;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #7c5cff;
  box-shadow: 0 0 0 3px rgba(124,92,255,0.15);
}

/* Touch target optimization for mobile */
@media (pointer: coarse) {
  button,
  .provider-chip,
  .nav-link,
  .badge,
  input[type=text],
  input[type=password],
  input[type=search],
  textarea,
  select,
  .card,
  .evidence-card {
    min-height: 48px;
    min-width: 48px;
  }
  
  .card > *,
  .evidence-card > * {
    padding: 8px;
  }
  
  button:active,
  .card:active,
  .evidence-card:active {
    background: rgba(124,92,255,0.1) !important;
  }
  
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  
  .card,
  .evidence-card {
    padding: 12px;
  }
}

/* Skeleton loading states */
.skeleton {
  animation: shimmer 2s infinite ease-in-out;
  background: linear-gradient(90deg, #1a212b 25%, #2a3040 50%, #1a212b 75%);
  background-size: 200% 100%;
}

/* Skeleton shimmer animation */
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Mobile-specific skeleton sizing */
@media (pointer: coarse) {
  .skeleton { min-height: 24px; }
}

/* Enhanced evidence card hover effects */
.evidence-card.group:hover {
  box-shadow: 0 4px 12px rgba(34, 197, 94, 0.1), 0 0 0 1px rgba(124, 92, 255, 0.05);
  transform: none;
}

/* Accessibility Contrast Enhancements */
@media (prefers-contrast: more) {
  .evidence-card {
    border-color: #2a2a2a;
    border-width: 2px;
    box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
  }
  .evidence-card h4 { color: #e0e0e0; font-weight: 500; }
  .evidence-card p { color: #d0d0d0; line-height: 1.6; }
}

/* Enhanced error card for better visibility */
.error-card {
  text-align: center;
  transition: all 0.2s ease;
}

.error-card:hover {
  transform: scale(1.01);
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.2);
}

/* Mobile-optimized transition durations */
@media (max-width: 768px) {
  .evidence-card {
    transition-duration: 200ms;
    will-change: transform, box-shadow, opacity;
  }
  
  .evidence-card:hover {
    transition-duration: 150ms;
    transform: none;
  }
  
  .fade-in {
    transition-duration: 200ms;
  }
}