/* categories.css — Full page styles (light/dark)
   Works standalone. If you already have a global style.css,
   this file can still run by itself for the Categories page.
*/

/* ---------- Base / tokens ---------- */
:root{
  --bg: #f6f7f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --muted-200:#e5e7eb;
  --muted-300:#d1d5db;
  --muted-700:#374151;
  --border:#e5e7eb;
  --brand-50:#eef6ff;
  --brand-100:#dbeeff;
  --brand-500:#137fec;
  --brand-600:#0a6dd0;
  --brand-700:#095fb7;
  --danger-500:#e11d48;
  --danger-600:#be123c;
  --shadow: 0 1px 0 rgba(0,0,0,.04);
  --radius:12px;
}
.dark{
  --bg:#101922;
  --panel:#0b1220;
  --ink:#e5e7eb;
  --muted:#9ca3af;
  --muted-200:#243141;
  --muted-300:#2d3b4f;
  --muted-700:#cbd5e1;
  --border:#1f2937;
  --brand-50:#0c1f33;
  --brand-100:#0f2a46;
  --brand-500:#3ba0ff;
  --brand-600:#2b88e4;
  --brand-700:#1e6ac0;
  --danger-500:#f43f5e;
  --danger-600:#e11d48;
  --shadow: 0 1px 0 rgba(255,255,255,.06);
}

/* ---------- Reset-ish ---------- */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--ink);
  background:var(--bg);
  line-height:1.4;
}
a{ color:inherit; text-decoration:none; }
button{ font:inherit; color:inherit; background:none; border:0; padding:0; cursor:pointer; }
input,select,textarea{ font:inherit; color:inherit; }

/* ---------- Utilities ---------- */
.hide-sm{ display:none; }
@media (min-width:640px){ .hide-sm{ display:flex; } }
.muted{ color:var(--muted); }
.row{ display:flex; align-items:center; gap:8px; }
.grid{ display:grid; }
.gap{ gap:12px; }
.text-sm{ font-size:.9rem; }
.text-xs, .xs{ font-size:.78rem; }
.semibold{ font-weight:600; }
.cursor-pointer{ cursor:pointer; }
.mt-3{ margin-top:12px; }

/* ---------- Page shell ---------- */
.page{ min-height:100vh; }
.app{ display:flex; height:100vh; overflow:hidden; position:relative; }
.overlay{
  position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:40;
}
.skiplink{
  position:absolute; left:-9999px; top:auto; width:1px; height:1px; overflow:hidden;
}
.skiplink:focus{
  position:fixed; left:12px; top:12px; z-index:1000; width:auto; height:auto;
  padding:8px 10px; border-radius:10px; background:var(--panel); border:1px solid var(--border);
}

/* ---------- Sidebar ---------- */
.sidebar{
  position:fixed; left:0; top:0; bottom:0; z-index:50;
  width:256px; transform:translateX(-100%);
  background:var(--panel); border-right:1px solid var(--border);
  transition:transform .28s ease, width .28s ease;
}
.sidebar.is-open{ transform:translateX(0); }
@media (min-width:1024px){ .sidebar{ transform:none; } }

.sidebar__inner{ height:100%; display:flex; flex-direction:column; }
.brand{
  display:flex; align-items:center; gap:10px;
  padding:16px 20px; border-bottom:1px solid var(--border);
  color:var(--ink);
}
.brand__icon{ width:28px; height:28px; color:var(--brand-500); }
.brand__name{ font-size:1.05rem; font-weight:800; letter-spacing:-.01em; }

.nav{ display:flex; flex-direction:column; padding:10px; gap:6px; }
.nav__item{
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px;
  color:var(--muted); transition:background .15s ease, color .15s ease;
}
.nav__item:hover{ background:var(--brand-50); color:var(--brand-700); }
.nav__item--active{ background:rgba(19,127,236,.12); color:var(--brand-700); }
.nav__text{ font-size:.95rem; font-weight:600; }
.nav--footer{ margin-top:auto; padding-top:8px; border-top:1px solid var(--border); }

.material-symbols-outlined{ font-variation-settings:'OPSZ' 24; }

/* ---------- Content ---------- */
.content{
  display:flex; flex-direction:column; flex:1 1 auto;
  margin-left:0; transition:margin-left .28s ease;
}
@media (min-width:1024px){ .content{ margin-left:256px; } }
.content--collapsed{ margin-left:80px; }
.content--expanded{ margin-left:256px; }

.container{ max-width:1200px; margin:0 auto; padding:20px 16px; }

/* ---------- Header ---------- */
.header{
  position:sticky; top:0; z-index:30;
  display:flex; align-items:center; justify-content:space-between;
  padding:10px 16px; background:var(--panel);
  border-bottom:1px solid var(--border);
  box-shadow:var(--shadow);
}
.header__left, .header__right{ display:flex; align-items:center; gap:10px; }
.header__title{ font-size:1.1rem; font-weight:800; letter-spacing:-.01em; }

.icon-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; border-radius:10px;
  background:var(--brand-50); color:var(--ink);
}
.icon-btn:hover{ background:rgba(19,127,236,.12); }
.icon-btn.ghost{ background:transparent; }

.avatar{
  --size:40px; --avatar:url('https://picsum.photos/seed/user/80');
  width:var(--size); height:var(--size); border-radius:50%;
  background: center/cover no-repeat var(--avatar);
  border:1px solid var(--border);
}

/* search */
.search{
  display:flex; align-items:center; gap:8px;
  background:var(--bg); border:1px solid var(--border);
  padding:6px 10px; border-radius:10px;
}
.search__icon{ color:var(--muted); }
.search__input{
  border:0; outline:0; background:transparent; min-width:220px;
  color:var(--ink);
}

/* ---------- Toolbar ---------- */
.toolbar{
  display:flex; align-items:center; justify-content:space-between;
  margin:10px 0 16px; gap:10px;
}
.toolbar__right, .toolbar__left{ display:flex; align-items:center; gap:8px; }

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:6px;
  padding:9px 12px; border-radius:10px; border:1px solid var(--border);
  background:var(--panel); color:var(--ink); font-weight:600;
}
.btn:hover{ background:var(--brand-50); }
.btn:disabled{ opacity:.6; cursor:not-allowed; }

.btn--primary{
  background:var(--brand-500); border-color:transparent; color:#fff;
}
.btn--primary:hover{ background:var(--brand-600); }
.btn--danger{
  background:var(--danger-500); border-color:transparent; color:#fff;
}
.btn--danger:hover{ background:var(--danger-600); }
.btn--ghost{
  background:transparent; border-color:var(--border); color:var(--ink);
}
.btn--flat{ background:transparent; border-color:transparent; }

/* ---------- Inputs ---------- */
.input, .select, .textarea{
  width:100%; padding:9px 10px; border-radius:10px;
  border:1px solid var(--border); background:var(--panel); color:var(--ink);
  outline:none;
}
.input:focus, .select:focus, .textarea:focus{
  border-color:var(--brand-500); box-shadow:0 0 0 3px rgba(19,127,236,.16);
}
.textarea{ resize:vertical; }

/* ---------- Cards / page blocks ---------- */
.card{
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:var(--panel);
  padding:16px;
  box-shadow:var(--shadow);
}
.card__head{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
.card__title{ font-weight:700; }

/* ---------- Categories grid ---------- */
.cat-grid{
  --gap:16px;
  display:grid;
  grid-template-columns:repeat(12, minmax(0,1fr));
  gap:var(--gap);
  align-content:start;
  min-height:120px;
}
@media (max-width:640px){
  .cat-grid{ grid-template-columns:repeat(1, minmax(0,1fr)); }
}
@media (min-width:641px) and (max-width:1023px){
  .cat-grid{ grid-template-columns:repeat(6, minmax(0,1fr)); }
}

.cat-grid.is-loading{ place-items:center; }

.grid-loading{
  grid-column:1 / -1;
  display:grid; place-items:center; gap:8px; padding:32px 0;
}
.grid-loading .spinner{
  width:28px; height:28px; border-radius:9999px;
  border:3px solid var(--muted-200); border-top-color:var(--brand-500);
  animation:spin .9s linear infinite;
}
@keyframes spin{ to { transform:rotate(360deg);} }

.cat-card{
  grid-column:span 4;
  display:flex; flex-direction:column; gap:10px;
  padding:16px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  background:var(--panel);
  box-shadow:var(--shadow);
  transition:transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.cat-card:hover{
  transform:translateY(-1px);
  border-color:var(--muted-300);
  box-shadow:0 4px 22px rgba(0,0,0,.06);
}
.cat-card__head{
  display:flex; align-items:baseline; justify-content:space-between; gap:12px;
}
.cat-card__title{ font-size:1rem; font-weight:800; letter-spacing:-.01em; }
.cat-card__slug{
  font-size:.75rem; padding:2px 8px; border-radius:999px;
  background:var(--brand-50); color:var(--muted);
}
.cat-card__desc{ font-size:.92rem; line-height:1.45; color:var(--muted-700); }
.dark .cat-card__desc{ color:var(--muted); }
.cat-card__foot{ display:flex; justify-content:flex-end; gap:8px; margin-top:4px; }

/* Empty state */
.empty{
  grid-column:1 / -1;
  display:grid; place-items:center; gap:10px; padding:40px 0;
  border:1px dashed var(--border); border-radius:var(--radius); background:var(--panel);
}
.empty__icon{
  width:44px; height:44px; display:grid; place-items:center;
  border-radius:10px; background:rgba(19,127,236,.1); color:var(--brand-500);
}
.empty__text{ color:var(--muted); }

/* ---------- Modal (shared) ---------- */
.modal-scrim{
  position:fixed; inset:0; display:grid; place-items:center;
  background:rgba(2,8,23,.46); z-index:80;
}
.modal{
  width:min(720px, calc(100vw - 24px));
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:16px;
  box-shadow:0 20px 60px rgba(0,0,0,.28);
  max-height:80vh; overflow:auto;
}
.modal--panel{ display:flex; flex-direction:column; }
.modal__head{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; border-bottom:1px solid var(--border);
}
.modal__title{ font-weight:800; font-size:1rem; }
.modal__body{ padding:16px; }
.modal__foot{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px; border-top:1px solid var(--border); gap:10px;
}

/* form inside modal */
.form.grid.gap{ gap:12px; }
.field .field__label{
  display:block; font-size:.85rem; color:var(--muted); margin-bottom:6px;
}
.field .req{ color:#d22; margin-left:2px; }

/* ---------- Badges (you may reuse elsewhere) ---------- */
.badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:2px 8px; border-radius:999px; font-size:.78rem; font-weight:700;
}
.badge--pri{ background:#fee2e2; color:#b91c1c; }
.badge--sec{ background:#fff7ed; color:#c2410c; }
.badge--low{ background:#ecfdf5; color:#047857; }
.dark .badge--pri{ background:rgba(190,18,60,.18); color:#fecaca; }
.dark .badge--sec{ background:rgba(234,88,12,.18); color:#fed7aa; }
.dark .badge--low{ background:rgba(5,150,105,.18); color:#bbf7d0; }








