/* Base light theme variables */
:root {
  --bg: #f8fafc;
  --text: #1e293b;
  --card: #ffffff;
  --muted: #94a3b8;
  --primary: #1e3a8a;
  --accent: #2563eb;
  --surface: #e2e8f0;
  --panel: #f1f5f9;
}

:root.dark {
  --bg: #0b1220;
  --text: #e5e7eb;
  --card: #111827;
  --muted: #64748b;
  --primary: #334155;
  --accent: #60a5fa;
  --surface: #1f2937;
  --panel: #111827;
}

html { background: var(--bg); }
body {
  font-family: system-ui, sans-serif;
  background: var(--bg);
  margin: 0;
  color: var(--text);
}

/* Header */
header {
  background: var(--primary);
  color: white;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { font-size: 1.2rem; margin: 0; }
nav a {
  color: white;
  margin-left: 1rem;
  text-decoration: none;
  font-weight: 500;
}
nav a:hover { text-decoration: underline; }
#theme-toggle {
  margin-left: 1rem;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.35);
  color: white;
  padding: .35rem .6rem;
  border-radius: 8px;
  cursor: pointer;
}

/* Main layout */
main { padding: 2rem; max-width: 900px; margin: auto; }
.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--card);
  padding: 1.5rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-4px); box-shadow: 0 4px 12px rgba(0,0,0,0.25); }

/* Upload Form */
.upload-card {
  background: var(--card);
  padding: 2rem;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

#drop-zone {
  border: 2px dashed var(--muted);
  border-radius: 10px;
  padding: 2rem;
  margin-bottom: 1rem;
  transition: border-color 0.3s, background 0.3s;
}
#drop-zone.dragover { border-color: var(--accent); background: rgba(37, 99, 235, 0.08); }

.privacy-note { margin: 0 0 1rem; color: #0f766e; font-weight: 600; }

.progress-container {
  margin-top: 1rem;
  background: var(--surface);
  border-radius: 6px;
  height: 12px;
  overflow: hidden;
  display: none;
}
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.2s; }

.message { margin-top: .6rem; min-height: 1.2rem; }

/* ===== Download History Panel ===== */
#history-panel {
  position: fixed;
  bottom: 10px;
  right: 10px;
  width: 260px;
  background: var(--card);
  border: 1px solid var(--surface);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  font-size: 0.9rem;
  transition: transform 0.3s;
  overflow: hidden;
  z-index: 999;
}
#history-panel.collapsed { transform: translateY(calc(100% - 30px)); }
#history-header {
  background: var(--primary);
  color: white;
  padding: 6px 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
#toggle-history {
  background: transparent;
  color: white;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
}
#history-list { max-height: 200px; overflow-y: auto; padding: 8px; list-style: none; margin: 0; }
#history-list li { border-bottom: 1px solid var(--surface); padding: 4px 0; }
#clear-history {
  width: 100%;
  border: none;
  background: var(--panel);
  padding: 6px;
  cursor: pointer;
  border-top: 1px solid var(--surface);
  color: var(--text);
}
#clear-history:hover { filter: brightness(1.1); }
