/* Ink Experts — App Content admin. Light, clean, WordPress-adjacent. */

:root {
  --pink: #ec008c;
  --purple: #7a2ff7;

  --bg: #f5f6f8;
  --surface: #fff;
  --sidebar: #14141a;
  --border: #e4e6ea;
  --border-strong: #d3d6dc;

  --text: #16181d;
  --text-2: #4a5058;
  --muted: #858c96;

  --green: #0f9d58;
  --red: #d93025;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  --shadow: 0 1px 2px rgba(16, 18, 22, 0.06), 0 1px 3px rgba(16, 18, 22, 0.04);
  --shadow-lg: 0 12px 32px rgba(16, 18, 22, 0.16);

  color-scheme: light;
}

* { box-sizing: border-box; }

/* Elements below set display:grid/flex, which would otherwise beat the browser's
   [hidden] { display:none } and leave the modal/login visible. Keep this first. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 1.3rem; }
h2 { font-size: 1rem; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hint { margin: 0 0 8px; font-size: 0.84rem; color: var(--muted); }

/* ------------------------------------------------------------------ */
/* login                                                              */
/* ------------------------------------------------------------------ */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(1200px 500px at 50% -10%, #fdeaf6 0%, var(--bg) 60%);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}
.login-brand {
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pink);
  margin-bottom: 10px;
}
.login-card h1 { margin-bottom: 4px; }
.login-card p { margin: 0 0 20px; }

/* ------------------------------------------------------------------ */
/* layout                                                             */
/* ------------------------------------------------------------------ */

.layout { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--sidebar);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.logo {
  color: #fff;
  font-weight: 700;
  padding: 0 10px 22px;
  line-height: 1.25;
}
.logo span {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pink);
  margin-top: 2px;
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-radius: var(--r-sm);
  color: #a6adb8;
  font: inherit;
  font-weight: 550;
  padding: 10px 12px;
  cursor: pointer;
}
.nav:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav.active { background: rgba(255, 255, 255, 0.1); color: #fff; }
.nav .ico { width: 16px; text-align: center; opacity: 0.8; font-size: 0.9rem; }
.badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.74rem;
  font-weight: 700;
}
.nav.active .badge { background: var(--pink); color: #fff; }
.muted-nav { margin-top: auto; font-weight: 500; }

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: rgba(245, 246, 248, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }
.dirty {
  font-size: 0.82rem;
  font-weight: 600;
  color: #9a6b00;
  background: #fff5db;
  border: 1px solid #f0dfae;
  border-radius: 999px;
  padding: 4px 12px;
}

.content { padding: 24px 28px 80px; max-width: 940px; }

/* ------------------------------------------------------------------ */
/* cards + forms                                                      */
/* ------------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.card-head:last-child { border: 0; margin: 0; padding: 0; }

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--text);
  font: inherit;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input::placeholder { color: #aeb4bd; }
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--pink);
  box-shadow: 0 0 0 3px rgba(236, 0, 140, 0.12);
}

.input-media { display: flex; align-items: center; gap: 12px; }
.thumb { border-radius: var(--r-sm); object-fit: cover; background: #eef0f3; flex: none; border: 1px solid var(--border); }
.thumb.sq { width: 42px; height: 42px; }
.thumb.wide { width: 84px; height: 48px; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: #f7f8fa; border-color: #c2c6cd; }
.btn.primary {
  border: 0;
  color: #fff;
  background: linear-gradient(93deg, var(--pink), var(--purple));
  box-shadow: 0 1px 2px rgba(236, 0, 140, 0.3);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { opacity: 0.6; cursor: default; filter: none; }
.btn.ghost { border: 0; background: none; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: #f1f2f5; }
.btn.sm { padding: 5px 10px; font-size: 0.84rem; }
.btn.danger { color: var(--red); border-color: #f0c6c2; }
.btn.danger:hover { background: #fdf1f0; }
.btn.block { width: 100%; justify-content: center; margin-top: 18px; padding: 10px; }

/* checkbox grid */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.check {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 550;
}
.check:hover { border-color: var(--border-strong); }
.check input { width: auto; margin: 0; accent-color: var(--pink); }
.check.on { border-color: var(--pink); background: #fff5fb; }

/* ------------------------------------------------------------------ */
/* repeaters                                                          */
/* ------------------------------------------------------------------ */

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 8px; }

.item {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
  overflow: hidden;
}
.item.open { border-color: var(--border-strong); box-shadow: var(--shadow); }

.item-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  background: #fff;
}
.item-head:hover { background: #fafbfc; }
.item-head .thumb.v { width: 72px; height: 41px; }
.item-title { flex: 1; min-width: 0; }
.item-title strong {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-title .meta { font-size: 0.79rem; color: var(--muted); }
.chev { color: var(--muted); font-size: 0.8rem; flex: none; }

.tag {
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef0f3;
  color: var(--text-2);
}
.tag.hot { background: #fff0f8; color: var(--pink); }

.item-body { padding: 4px 16px 16px; border-top: 1px solid var(--border); }
.item-body .field { margin-top: 14px; margin-bottom: 0; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.item-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* drag to sort */
.handle {
  flex: none;
  cursor: grab;
  color: #c3c8cf;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 2px;
  user-select: none;
}
.handle:hover { color: var(--muted); }
.handle:active { cursor: grabbing; }
.handle.sm { font-size: 0.85rem; }
.item.dragging, .chip.dragging { opacity: 0.4; }
.item.over { border-color: var(--pink); box-shadow: 0 -3px 0 -1px var(--pink) inset; }
.chip.over { border-color: var(--pink); }

/* videos nested inside a category */
.subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
}
.subhead label { margin: 0; }
.subvideos { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.item.sub { background: #fafbfc; }
.item.sub .item-head { padding: 7px 10px; background: transparent; }
.item.sub .item-head:hover { background: #f2f4f6; }
.item.sub .thumb.v { width: 58px; height: 33px; }
.item.sub .item-title strong { font-size: 0.87rem; }
.item.sub .item-body { background: #fff; }
.empty.small { padding: 14px 0; font-size: 0.85rem; }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar input { flex: 1; }
.toolbar select { width: 200px; }

.empty { text-align: center; color: var(--muted); padding: 28px 0; font-size: 0.9rem; }

/* product chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 6px 4px 4px;
  background: #fff;
  max-width: 100%;
}
.chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; border: 1px solid var(--border); }
.chip .txt { min-width: 0; line-height: 1.15; }
.chip .txt b {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 190px;
}
.chip .txt i { font-style: normal; font-size: 0.75rem; font-weight: 700; color: var(--pink); }
.chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; padding: 0 4px; line-height: 1; }
.chip button:hover { color: var(--red); }

/* ------------------------------------------------------------------ */
/* products tab                                                       */
/* ------------------------------------------------------------------ */

.stat-row { display: flex; gap: 12px; margin: 16px 0 20px; }
.stat {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  background: #fafbfc;
}
.stat-num { display: block; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 0.78rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }

/* table (products) */
.table-wrap { border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; margin-top: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
  text-align: left;
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: #fafbfc;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td { padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
td.img { width: 52px; }
td.img img { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; border: 1px solid var(--border); display: block; background: #eef0f3; }
td.name { font-weight: 600; }
td.name .sku { display: block; font-size: 0.75rem; font-weight: 500; color: var(--muted); }
td.price { font-weight: 700; color: var(--pink); white-space: nowrap; }
td.cats { color: var(--muted); font-size: 0.82rem; }
.pillt {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 8px;
  background: #e8f6ee;
  color: var(--green);
  white-space: nowrap;
}
.pillt.out { background: #fdf1f0; color: var(--red); }
.table-foot { padding: 10px 14px; color: var(--muted); font-size: 0.82rem; background: #fafbfc; border-top: 1px solid var(--border); }

/* ------------------------------------------------------------------ */
/* modal + toast                                                      */
/* ------------------------------------------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(16, 18, 22, 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 16px;
  overflow: auto;
}
.modal-card {
  width: 100%;
  max-width: 540px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 20px;
}
.picker-results { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; max-height: 54vh; overflow: auto; }
.hit {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: #fff;
  padding: 7px;
  cursor: pointer;
  font: inherit;
}
.hit:hover { border-color: var(--pink); background: #fffafd; }
.hit.added { opacity: 0.5; cursor: default; }
.hit img { width: 40px; height: 40px; border-radius: var(--r-sm); object-fit: cover; flex: none; border: 1px solid var(--border); }
.hit .txt { flex: 1; min-width: 0; line-height: 1.25; }
.hit .txt b { display: block; font-size: 0.85rem; font-weight: 600; }
.hit .txt i { font-style: normal; font-size: 0.8rem; font-weight: 700; color: var(--pink); }
.hit .add { font-size: 0.78rem; font-weight: 700; color: var(--muted); flex: none; }

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  background: #16181d;
  color: #fff;
  border-radius: var(--r-md);
  padding: 11px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
}
.toast.ok { background: var(--green); }
.toast.bad { background: var(--red); }

.alert { border-radius: var(--r-sm); padding: 9px 12px; font-size: 0.86rem; margin-top: 14px; }
.alert.error { background: #fdf1f0; color: var(--red); border: 1px solid #f0c6c2; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; }
  .sidebar nav { flex-direction: row; }
  .logo { display: none; }
  .muted-nav { margin: 0; }
  .grid-2 { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 60px; }
  .topbar { padding: 14px 16px; }
}

/* banner sub-editor */
.banner { margin-top: 4px; }

/* trending picker: show category muted, not as a price */
.hit .txt i.cat { color: var(--muted); font-weight: 500; }

.head-tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* subtle panels to separate sub-sections inside an editor */
.banner {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
}
.subvideos {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px;
  margin-top: 8px;
}
.subvideos .item.sub { background: #fff; }
/* give each editor field-group a hair of separation */
.item-body > .field + .field { padding-top: 2px; }
.item.full .item-head { padding: 10px 12px; }

/* field busy state (YouTube lookup in flight) */
input.loading {
  background-image: linear-gradient(90deg, transparent, rgba(236, 0, 140, 0.08), transparent);
  background-size: 200% 100%;
  animation: shimmer 1s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
