/* ═══════════════════════════════════════════════════════════════
   QuickClip — Styles
   Palette:   #0D0F14 bg  |  #1E2130 card  |  #6366F1 indigo
              #10B981 emerald  |  #F59E0B amber  |  #F0F2FF text
   Type:      Space Grotesk (display) + Inter (body)
═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

/* ── Reset & Tokens ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0D0F14;
  --bg2:      #12151D;
  --card:     #1E2130;
  --card2:    #252A3A;
  --border:   #2E3450;
  --indigo:   #6366F1;
  --indigo-d: #4F52C5;
  --indigo-g: rgba(99,102,241,.12);
  --emerald:  #10B981;
  --amber:    #F59E0B;
  --red:      #EF4444;
  --text:     #F0F2FF;
  --muted:    #8892B0;
  --radius:   14px;
  --shadow:   0 4px 24px rgba(0,0,0,.45);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 0 0 80px;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,15,20,.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-dot {
  width: 8px; height: 8px;
  background: var(--indigo);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--indigo);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%,100% { box-shadow: 0 0 6px var(--indigo); opacity: 1; }
  50%      { box-shadow: 0 0 16px var(--indigo); opacity: .7; }
}

.header-actions { display: flex; align-items: center; gap: 10px; }

/* ── Stats Bar ──────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.stats-bar::-webkit-scrollbar { display: none; }

.stat-item {
  flex: 0 0 auto;
  padding: 8px 18px 8px 0;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .76rem;
  color: var(--muted);
  border-right: 1px solid var(--border);
  margin-right: 18px;
  white-space: nowrap;
}
.stat-item:last-child { border-right: none; }

.stat-val {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: .9rem;
  color: var(--text);
  transition: color .3s;
}
.stat-val.flash { color: var(--emerald); }

/* ── Main ────────────────────────────────────────────────────── */
.main { max-width: 680px; margin: 0 auto; padding: 20px 20px 0; }

.section-label {
  font-family: 'Space Grotesk', sans-serif;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

/* ── Compose Card (merged input + upload) ───────────────────── */
.compose-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 14px 12px;
  margin-bottom: 18px;
  position: relative;
  transition: border-color .2s, box-shadow .2s;
}

/* drag-over state on the whole card */
.compose-card.drag-over {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
}
.compose-card.drag-over .drag-hint { opacity: 1; pointer-events: none; }

/* Floating "Drop file" label that appears over the card */
.drag-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--amber);
  background: rgba(13,15,20,.72);
  border-radius: var(--radius);
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
  letter-spacing: .5px;
}
.drag-hint::before {
  content: '📎  ';
}

textarea#clipInput {
  width: 100%;
  background: var(--bg2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: .92rem;
  line-height: 1.6;
  padding: 10px 12px;
  resize: none;          /* height fixed — feed visible without scroll */
  height: 76px;
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}
textarea#clipInput::placeholder { color: var(--muted); font-size: .84rem; }
textarea#clipInput:focus {
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(99,102,241,.14);
}

/* ── Controls row ────────────────────────────────────────────── */
.controls {
  display: flex;
  gap: 7px;
  margin-top: 10px;
  align-items: center;
}

/* Upload progress sits between textarea and buttons */
.upload-progress {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin: 8px 0 0;
  overflow: hidden;
  display: none;
}
.upload-progress.active { display: block; }
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--indigo), var(--emerald));
  border-radius: 2px;
  transition: width .2s ease;
  position: relative;
  overflow: hidden;
}
.upload-progress-bar::after {
  content: '';
  position: absolute;
  right: -40px; top: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.4));
  animation: shimmer 1s linear infinite;
}
@keyframes shimmer { to { transform: translateX(80px); } }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 14px;
  border: none;
  border-radius: 8px;
  font-family: 'Inter', sans-serif;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s, opacity .15s, box-shadow .15s;
  user-select: none;
  white-space: nowrap;
}
.btn:active  { transform: scale(.94); opacity: .85; }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-indigo { background: var(--indigo); color: #fff; }
.btn-indigo:hover:not(:disabled) { background: var(--indigo-d); box-shadow: 0 4px 14px rgba(99,102,241,.4); }

.btn-ghost {
  background: var(--card2);
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { color: var(--text); border-color: var(--muted); }

.btn-amber { background: var(--amber); color: #000; font-weight: 700; }
.btn-amber:hover:not(:disabled) { background: #d97706; box-shadow: 0 4px 14px rgba(245,158,11,.35); }

.btn-sm { padding: 5px 10px; font-size: .76rem; border-radius: 6px; }

/* Header reload button */
#reloadBtn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  display: flex; align-items: center; gap: 5px;
  font-size: .76rem; font-family: 'Inter', sans-serif; font-weight: 600;
}
#reloadBtn:hover { color: var(--text); border-color: var(--indigo); }
#reloadBtn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Install button */
#installBtn {
  background: linear-gradient(135deg, var(--indigo), #8B5CF6);
  color: #fff;
  border: none;
  font-size: .76rem;
}
#installBtn:hover { box-shadow: 0 4px 14px rgba(139,92,246,.4); }

/* ── Unified Feed ────────────────────────────────────────────── */
.feed-section { margin-bottom: 20px; }

.feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.clip-count {
  font-family: 'Space Grotesk', sans-serif;
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 2px 9px;
  border-radius: 20px;
}

.feed-list { display: flex; flex-direction: column; gap: 9px; }

/* ── Shared feed-item base ───────────────────────────────────── */
.feed-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
  transition: border-color .2s, transform .1s;
  animation: slide-in .28s ease;
}

/* type badge — top-right corner pill */
.feed-type-badge {
  position: absolute;
  top: 10px; right: 12px;
  display: flex; align-items: center; gap: 4px;
  font-size: .62rem; font-weight: 700;
  letter-spacing: .8px; text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 20px;
  pointer-events: none;
}
.badge-clip   { background: rgba(99,102,241,.15); color: var(--indigo); }
.badge-upload { background: rgba(245,158,11,.13); color: var(--amber); }

/* ── Clip cards ──────────────────────────────────────────────── */
.clip-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--indigo);
  border-radius: 2px 0 0 2px;
  transition: width .25s cubic-bezier(.4,0,.2,1);
}
.clip-item:hover { border-color: var(--indigo); transform: translateX(2px); }
.clip-item:hover::before { width: 100%; opacity: .065; }
.clip-item:hover .clip-content { position: relative; z-index: 1; }
.clip-item:active { transform: scale(.985); }

.clip-content {
  font-size: .875rem;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  cursor: pointer;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* leave space for the badge */
  padding-right: 54px;
}
.clip-item.expanded .clip-content { -webkit-line-clamp: unset; }

.clip-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.clip-time    { font-size: .68rem; color: var(--muted); }
.clip-actions { display: flex; gap: 6px; align-items: center; }

.expand-btn {
  font-size: .68rem; color: var(--indigo);
  background: none; border: none; cursor: pointer;
  font-family: 'Inter', sans-serif; font-weight: 600;
  transition: opacity .15s;
}
.expand-btn:hover { opacity: .7; }

/* ── Upload cards ────────────────────────────────────────────── */
.upload-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--amber);
  border-radius: 2px 0 0 2px;
}
.upload-item:hover { border-color: var(--amber); }

.upload-row {
  display: flex;
  align-items: center;
  gap: 11px;
  /* leave space for badge */
  padding-right: 48px;
}
.upload-icon {
  width: 34px; height: 34px;
  background: var(--card2);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}
.upload-info { flex: 1; min-width: 0; }
.upload-name {
  font-size: .84rem; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.upload-meta { font-size: .7rem; color: var(--muted); margin-top: 2px; }
.upload-actions { display: flex; gap: 5px; flex-shrink: 0; }

/* ── Empty State ─────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px; color: var(--muted);
}
.empty-icon  { font-size: 2.2rem; margin-bottom: 10px; opacity: .45; }
.empty-title { font-family: 'Space Grotesk', sans-serif; font-size: .95rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.empty-sub   { font-size: .8rem; line-height: 1.6; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(18px);
  background: var(--card2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 18px;
  border-radius: 30px;
  font-size: .8rem; font-weight: 600;
  opacity: 0; pointer-events: none;
  z-index: 999;
  transition: opacity .22s, transform .22s;
  white-space: nowrap;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 7px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes slide-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .controls { gap: 5px; }
  .btn { padding: 8px 10px; font-size: .78rem; }
  textarea#clipInput { height: 70px; }
}
