/* Modern Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html:focus-within { scroll-behavior: smooth; }
html, body { height: 100%; }

/* Catppuccin Mocha + shadcn-like tokens */
:root {
  /* Catppuccin Mocha base palette */
  --ctp-rosewater: #f5e0dc;
  --ctp-flamingo: #f2cdcd;
  --ctp-pink: #f5c2e7;
  --ctp-mauve: #cba6f7;
  --ctp-red: #f38ba8;
  --ctp-maroon: #eba0ac;
  --ctp-peach: #fab387;
  --ctp-yellow: #f9e2af;
  --ctp-green: #a6e3a1;
  --ctp-teal: #94e2d5;
  --ctp-sky: #89dceb;
  --ctp-sapphire: #74c7ec;
  --ctp-blue: #89b4fa;
  --ctp-lavender: #b4befe;
  --ctp-text: #cdd6f4;
  --ctp-subtext1: #bac2de;
  --ctp-subtext0: #a6adc8;
  --ctp-overlay2: #9399b2;
  --ctp-overlay1: #7f849c;
  --ctp-overlay0: #6c7086;
  --ctp-surface2: #585b70;
  --ctp-surface1: #45475a;
  --ctp-surface0: #313244;
  --ctp-base: #1e1e2e;
  --ctp-mantle: #181825;
  --ctp-crust: #11111b;

  /* shadcn-like design tokens */
  --background: var(--ctp-base);
  --foreground: var(--ctp-text);

  --card: var(--ctp-mantle);
  --card-foreground: var(--ctp-text);

  --popover: var(--ctp-mantle);
  --popover-foreground: var(--ctp-text);

  --primary: var(--ctp-blue);
  --primary-foreground: var(--ctp-crust);

  --secondary: var(--ctp-surface1);
  --secondary-foreground: var(--ctp-text);

  --muted: var(--ctp-surface1);
  --muted-foreground: var(--ctp-subtext0);

  --accent: var(--ctp-mauve);
  --accent-foreground: var(--ctp-crust);

  --destructive: var(--ctp-red);
  --destructive-foreground: var(--ctp-crust);

  --border: var(--ctp-surface0);
  --input: var(--ctp-surface0);
  --ring: var(--ctp-blue);

  --radius: 12px;
  --shadow-soft: 0 1px 0 rgba(0,0,0,0.06), 0 2px 10px rgba(0,0,0,0.25);
  --shadow-hover: 0 8px 30px rgba(0,0,0,0.35);
  --transition: all 180ms ease;
  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}

/* Base */
body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--foreground);
  background:
    radial-gradient(1200px 600px at -10% -20%, rgba(137,180,250,0.08), transparent 60%),
    radial-gradient(800px 400px at 120% 10%, rgba(203,166,247,0.08), transparent 60%),
    var(--background);
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* App shell: sidebar + content */
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; background: var(--background); }
.sidebar { position: sticky; top: 0; align-self: start; height: 100vh; padding: 18px; background: var(--ctp-mantle); border-right: 1px solid var(--border); }
.sidebar .logo { display: block; margin-bottom: 12px; font-size: 1.35rem; }
.nav-vertical { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.nav-vertical a, .nav-vertical span { color: var(--muted-foreground); text-decoration: none; padding: 8px 10px; border-radius: calc(var(--radius) - 8px); border: 1px solid transparent; transition: var(--transition); }
.nav-vertical a:hover { background: var(--ctp-surface0); border-color: var(--border); color: var(--foreground); }

.content { padding: 32px; }

/* Header / Navbar */
.header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(120%) blur(10px);
  background: color-mix(in oklab, var(--ctp-mantle) 80%, transparent);
  border-bottom: 1px solid var(--border);
}

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
}

.logo {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--foreground);
  text-decoration: none;
  font-size: 1.25rem;
}

.nav-links { display: flex; gap: 10px; align-items: center; }
.nav-links a, .nav-links span {
  color: var(--muted-foreground);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: calc(var(--radius) - 6px);
  border: 1px solid transparent;
  transition: var(--transition);
}
.nav-links a:hover {
  background: var(--ctp-surface0);
  border-color: var(--border);
  color: var(--foreground);
}

/* Main */
.main { padding: 40px 0 64px; }

/* Hero */
.hero { text-align: center; margin-bottom: 36px; }
.hero h1 {
  font-size: clamp(2rem, 1.4rem + 2vw, 3rem);
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 10px;
}
.hero p { color: var(--muted-foreground); max-width: 640px; margin: 0 auto 18px; }

/* Card */
.card {
  background: var(--card);
  color: var(--card-foreground);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 24px;
  transition: var(--transition);
}
.card + .card { margin-top: 16px; }
.card:hover { box-shadow: var(--shadow-hover); }
.card h2 { font-size: 1.25rem; margin-bottom: 8px; }
.card p { color: var(--muted-foreground); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center; justify-content: center;
  gap: 8px;
  font-weight: 600;
  border-radius: calc(var(--radius) - 4px);
  padding: 7px 11px; /* 30% smaller */
  font-size: 0.7rem; /* 30% smaller */
  border: 1px solid var(--border);
  background: transparent; /* outline by default */
  color: var(--muted-foreground);
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  user-select: none;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { filter: brightness(0.98); }
.btn:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }

.btn-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary); color: var(--primary-foreground); box-shadow: 0 6px 22px rgba(137,180,250,0.25); }

.btn-secondary { background: transparent; color: var(--muted-foreground); border-color: var(--secondary); }
.btn-secondary:hover { background: var(--secondary); color: var(--secondary-foreground); }

.btn-success { background: transparent; color: var(--ctp-green); border-color: var(--ctp-green); }
.btn-success:hover { background: var(--ctp-green); color: var(--ctp-crust); }

.btn-danger { background: transparent; color: var(--destructive); border-color: var(--destructive); }
.btn-danger:hover { background: var(--destructive); color: var(--destructive-foreground); }

.btn-lg { padding: 10px 14px; font-size: 0.735rem; }

/* Upload */
.upload-area {
  border: 2px dashed var(--primary);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  background: rgba(137,180,250,0.06);
  transition: var(--transition);
  cursor: pointer;
}
.upload-area:hover { background: rgba(137,180,250,0.12); }
.upload-area.dragover { border-color: var(--ctp-green); background: rgba(166,227,161,0.10); }
.upload-icon { font-size: 2.5rem; color: var(--primary); margin-bottom: 8px; }
.upload-text { font-size: 1.05rem; font-weight: 600; }
.upload-subtext { color: var(--muted-foreground); }
.file-input { display: none; }

/* Progress */
.progress { background: var(--ctp-surface0); border-radius: 999px; height: 10px; overflow: hidden; margin: 14px 0; border: 1px solid var(--border); }
.progress-bar { background: var(--primary); height: 100%; border-radius: inherit; transition: width 180ms ease; }

/* File list & items */
.file-list { margin-top: 16px; display: grid; gap: 12px; }
.files-list { margin-top: 16px; display: grid; gap: 12px; }
.file-item {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px;
  background: var(--ctp-surface0);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  transition: var(--transition);
}
.file-item:hover { background: var(--ctp-surface1); }
.file-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.file-icon { font-size: 1.5rem; flex-shrink: 0; }
.file-details { flex: 1; min-width: 0; }
.file-name { font-weight: 700; color: var(--foreground); font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { display: flex; gap: 12px; color: var(--muted-foreground); font-size: .9rem; flex-wrap: wrap; }
.file-size, .file-date { white-space: nowrap; }
.file-actions { display: flex; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }
.file-actions .btn { padding: 6px 7px; font-size: 0.63rem; }

/* Download link section */
.download-link { background: var(--card); border: 1px solid var(--border); color: var(--foreground); padding: 14px; border-radius: calc(var(--radius) - 4px); margin: 14px 0; }
.download-url { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; background: var(--ctp-surface0); padding: 8px 10px; border-radius: 8px; margin: 10px 0; word-break: break-all; border: 1px solid var(--border); display: inline-block; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: calc(var(--radius) - 4px); margin-bottom: 14px; border: 1px solid var(--border); }
.alert-success { background: rgba(166,227,161,0.1); color: var(--ctp-green); border-color: color-mix(in oklab, var(--ctp-green) 40%, var(--border)); }
.alert-danger { background: rgba(243,139,168,0.12); color: var(--ctp-red); border-color: color-mix(in oklab, var(--ctp-red) 35%, var(--border)); }
.alert-warning { background: rgba(249,226,175,0.10); color: var(--ctp-yellow); border-color: color-mix(in oklab, var(--ctp-yellow) 35%, var(--border)); }

/* Features */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin: 28px 0; }
.feature { text-align: left; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; transition: var(--transition); box-shadow: var(--shadow-soft); }
.feature:hover { box-shadow: var(--shadow-hover); }
.feature-icon { font-size: 1.75rem; color: var(--primary); margin-bottom: 8px; }
.feature h3 { font-size: 1.1rem; margin-bottom: 6px; }
.feature p { color: var(--muted-foreground); }

/* Empty state */
.empty-state { text-align: center; padding: 24px 12px; background: rgba(49,50,68,0.4); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-state .empty-icon { font-size: 2.25rem; color: var(--primary); margin-bottom: 6px; }

.loading { text-align: center; padding: 40px; color: var(--muted-foreground); font-size: 1.05rem; }

/* Footer removed in new layout */

/* Utilities */
.fade-in { animation: fadeIn .35s ease-out; }
.fade-out { animation: fadeOut .25s ease-out forwards; }
@keyframes fadeIn { from{ opacity:0; transform: translateY(6px);} to{ opacity:1; transform: translateY(0);} }
@keyframes fadeOut { from{ opacity:1; transform: translateY(0);} to{ opacity:0; transform: translateY(-6px);} }

.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.25); border-radius: 50%; border-top-color: var(--foreground); animation: spin 1s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.copy-btn { background: transparent; color: var(--primary); border: 1px solid var(--primary); padding: 6px 9px; border-radius: 8px; cursor: pointer; transition: var(--transition); font-size: 0.63rem; }
.copy-btn:hover { background: var(--primary); color: var(--primary-foreground); box-shadow: 0 6px 22px rgba(137,180,250,0.25); }
.copy-btn.copied { background: var(--ctp-green); color: var(--ctp-crust); border-color: color-mix(in oklab, var(--ctp-green) 70%, black); }

/* Files page (remove light overrides, keep consistent dark) */
.files-page .file-item { background: var(--ctp-surface0); border: 1px solid var(--border); }
.files-page .file-item:hover { background: var(--ctp-surface1); }
.files-page .file-name { color: var(--foreground); }
.files-page .file-meta { color: var(--muted-foreground); }
.files-page .file-icon { color: var(--primary); }
.files-page .empty-state { color: var(--muted-foreground); }
.files-page .empty-state h3 { color: var(--foreground); }
.files-page .loading { color: var(--muted-foreground); }

/* Files header */
.files-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }

/* Responsive */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .nav-vertical { flex-direction: row; flex-wrap: wrap; }
  .content { padding: 20px; }
}
@media (max-width: 768px) {
  .hero h1 { font-size: 2rem; }
  .hero p { font-size: 1rem; }
  .card { padding: 18px; }
  .upload-area { padding: 28px 16px; }
  .file-item { flex-direction: column; align-items: stretch; text-align: left; gap: 12px; }
  .file-actions { justify-content: center; }
}
