/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f10;
  --surface: #1a1a1e;
  --surface2: #242428;
  --border: #2e2e34;
  --text: #f0f0f2;
  --text-muted: #8a8a94;
  --accent: #6c63ff;
  --accent-hover: #7d75ff;
  --danger: #e05555;
  --danger-hover: #e86767;
  --green: #3ecf8e;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
}

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ──────────────────────────────────────────────── */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.3px;
}
.brand:hover { text-decoration: none; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  white-space: nowrap;
  font-family: inherit;
}
.btn-primary  { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost    { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover  { background: var(--border); }
.btn-danger   { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm       { padding: 5px 11px; font-size: 12.5px; }
.btn-full     { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Page content ─────────────────────────────────────────── */
.page-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* ── Inbox header ─────────────────────────────────────────── */
.inbox-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 1.25rem;
}
.page-title { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.5px; }
.item-count { font-size: 14px; color: var(--text-muted); }

/* ── Search bar ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 0.9rem;
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 11px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  transition: border-color 0.15s;
  min-width: 0;
}
.search-input:focus { outline: none; border-color: var(--accent); }
.search-input::placeholder { color: var(--text-muted); }
.search-input[type="search"] { flex: 1 1 260px; }
.search-creator { flex: 0 1 180px; }
.search-category { flex: 0 1 180px; }
.search-date    { flex: 0 0 145px; color-scheme: dark; }

/* ── Filter pills ─────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.pill {
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.15s;
}
.pill:hover { color: var(--text); text-decoration: none; }
.pill-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Card grid ────────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.15s;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* Thumbnail */
.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  background: var(--surface2);
  overflow: hidden;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
  font-weight: 700;
}

/* Platform badge */
.platform-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.platform-tiktok    { background: #010101; color: #fff; }
.platform-instagram { background: #c13584; color: #fff; }
.platform-facebook  { background: #1877f2; color: #fff; }
.platform-youtube   { background: #ff0000; color: #fff; }
.platform-web       { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }

/* Card body */
.card-body {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.card-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  word-break: break-word;
}
.card-creator  { font-size: 12.5px; color: var(--accent); }
.card-category { font-size: 12px; color: var(--text-muted); }
.card-note     { font-size: 12.5px; color: var(--text-muted); font-style: italic; }
.card-date     { font-size: 11.5px; color: var(--text-muted); margin-top: auto; padding-top: 6px; }

/* Status badge */
.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.3px;
}
.status-pendingenrichment { background: #2e2a00; color: #f5c518; }
.status-enriched, .status-ready { background: #0d2b1a; color: var(--green); }
.status-enrichmentfailed  { background: #2b0d0d; color: var(--danger); }

/* Card actions */
.card-actions {
  display: flex;
  gap: 8px;
  padding: 10px 16px 14px;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 2rem;
}
.page-info { font-size: 13.5px; color: var(--text-muted); }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 5rem 1rem;
  color: var(--text-muted);
}
.empty-icon  { font-size: 3.5rem; margin-bottom: 1rem; }
.empty-state h2 { font-size: 1.2rem; color: var(--text); margin-bottom: 0.5rem; }
.empty-state p  { font-size: 14px; }

/* ── Alert ────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 7px; font-size: 13.5px; margin-bottom: 1rem; }
.alert-error { background: #2b0d0d; color: var(--danger); border: 1px solid var(--danger); }

/* ── Auth page ────────────────────────────────────────────── */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}
.auth-logo  { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 1.5rem; }
.auth-title { font-size: 1.2rem; font-weight: 600; text-align: center; margin-bottom: 1.5rem; }
.auth-form  { display: flex; flex-direction: column; gap: 12px; }
.auth-footer { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 1.25rem; }

/* ── Card title link ─────────────────────────────────────── */
.card-title-link { color: inherit; }
.card-title-link:hover { color: var(--accent); text-decoration: none; }

/* ── Category chips on cards ─────────────────────────────── */
.card-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.cat-chip {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.cat-chip:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ── Edit modal ─────────────────────────────────────────── */
.edit-modal {
  width: min(560px, 92vw);
  max-height: 86vh;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  box-shadow: 0 12px 48px rgba(0,0,0,0.55);
}
.edit-modal::backdrop {
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(2px);
}
.edit-modal form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 1.5rem 1.5rem 1.25rem;
  max-height: 86vh;
  overflow-y: auto;
}
.modal-title { font-size: 1.15rem; font-weight: 600; }
.modal-item-title {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 6px; word-break: break-word;
  max-height: 3em; overflow: hidden;
}
.cat-checklist {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 14px;
  max-height: 240px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
}
.cat-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  cursor: pointer;
}
.cat-checkbox input { accent-color: var(--accent); }
.cat-checkbox .muted { color: var(--text-muted); font-size: 11.5px; }
.cat-new-row { display: flex; gap: 8px; align-items: center; }
.cat-new-row .field-input { flex: 1; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}
.muted { color: var(--text-muted); font-size: 13px; }

/* ── Item detail page ────────────────────────────────────── */
.detail-back { margin-bottom: 1rem; }

.detail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  max-width: 960px;
}
@media (min-width: 820px) {
  .detail { grid-template-columns: 360px 1fr; }
}

.detail-media {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16/9;
}
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-thumb-empty { font-size: 4rem; }

.detail-body {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.detail-title { font-size: 1.5rem; font-weight: 700; line-height: 1.3; word-break: break-word; }
.detail-creator { font-size: 14px; color: var(--text-muted); }
.detail-creator a { color: var(--accent); }
.detail-description { font-size: 14px; color: var(--text-muted); line-height: 1.55; }

.detail-note {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
}
.detail-note-label {
  display: block;
  font-style: normal;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  margin-bottom: 4px;
}

.detail-meta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
}
.meta-row { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: baseline; }
.meta-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
}
.meta-url { word-break: break-all; color: var(--accent); font-family: ui-monospace, monospace; font-size: 12.5px; }

.detail-debug { color: var(--text-muted); font-size: 13px; }
.detail-debug summary { cursor: pointer; margin-bottom: 6px; }
.detail-debug dl { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; }
.detail-debug dt { font-weight: 600; color: var(--text-muted); }
.detail-debug dd { word-break: break-word; color: var(--text); font-family: ui-monospace, monospace; font-size: 12px; }

.detail-actions { display: flex; gap: 10px; margin-top: 0.5rem; }

/* Form fields */
.field-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.field-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 9px 13px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s;
}
.field-input:focus {
  outline: none;
  border-color: var(--accent);
}
