/* ============================================================
   SHADCN-STYLE DESIGN SYSTEM — /site/assets/shadcn-theme.css
   ============================================================
   Ported from the uploaded shadcn-admin (React + Tailwind + shadcn/ui)
   template's src/styles/theme.css — same oklch color tokens, same
   0.625rem radius, same component shapes (card, sidebar, nav groups,
   user menu, badges, tables) — reimplemented as plain CSS classes
   since this CMS has no build step / React runtime. Only the view
   layer changed here; nothing about how forms submit or how the PHP
   pages work underneath is different from before.

   Light mode only for now — the source template also ships a .dark
   variant (same file, .dark block) if a toggle is wanted later.
   ============================================================ */

:root {
  --sc-radius: 0.625rem;
  --sc-background: oklch(1 0 0);
  --sc-foreground: oklch(0.129 0.042 264.695);
  --sc-card: oklch(1 0 0);
  --sc-card-foreground: oklch(0.129 0.042 264.695);
  --sc-primary: oklch(0.208 0.042 265.755);
  --sc-primary-foreground: oklch(0.984 0.003 247.858);
  --sc-secondary: oklch(0.968 0.007 247.896);
  --sc-secondary-foreground: oklch(0.208 0.042 265.755);
  --sc-muted: oklch(0.968 0.007 247.896);
  --sc-muted-foreground: oklch(0.554 0.046 257.417);
  --sc-accent: oklch(0.968 0.007 247.896);
  --sc-accent-foreground: oklch(0.208 0.042 265.755);
  --sc-destructive: oklch(0.577 0.245 27.325);
  --sc-destructive-foreground: oklch(0.984 0.003 247.858);
  --sc-border: oklch(0.929 0.013 255.508);
  --sc-input: oklch(0.929 0.013 255.508);
  --sc-ring: oklch(0.704 0.04 256.788);
  --sc-success: oklch(0.723 0.219 149.6);
  --sc-success-foreground: oklch(0.98 0.02 145);
}

.sc-root { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--sc-background); color: var(--sc-foreground); }
.sc-root * { box-sizing: border-box; }
.sc-root a { color: inherit; }

/* ── Card ─────────────────────────────────────────────────── */
.sc-card { background: var(--sc-card); color: var(--sc-card-foreground); border: 1px solid var(--sc-border); border-radius: var(--sc-radius); box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.sc-card-header { padding: 24px 24px 0; }
.sc-card-title { font-size: 1.15rem; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
.sc-card-description { font-size: 0.9rem; color: var(--sc-muted-foreground); line-height: 1.6; margin: 0; }
.sc-card-content { padding: 20px 24px; }
.sc-card-footer { padding: 0 24px 24px; }

/* ── Buttons ──────────────────────────────────────────────── */
.sc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: calc(var(--sc-radius) - 2px);
  font-size: 0.85rem; font-weight: 500; border: 1px solid transparent;
  cursor: pointer; transition: all 0.15s ease; text-decoration: none; white-space: nowrap;
}
.sc-btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* !important on color here specifically: .sc-root a { color: inherit; }
   is a class+element selector (specificity 0,1,1), which beats a plain
   single-class selector like .sc-btn-primary (0,1,0) regardless of
   source order — so any button-styled <a> tag (not just this one)
   silently lost its intended text color back to the inherited dark
   text, producing dark-text-on-dark-background whenever a .sc-btn-*
   variant was applied to a link instead of a <button> element. This
   affects every variant below equally, so all of them need it. */
.sc-btn-primary { background: var(--sc-primary); color: var(--sc-primary-foreground) !important; }
.sc-btn-primary:hover { opacity: 0.9; }
.sc-btn-outline { background: var(--sc-card); border-color: var(--sc-input); color: var(--sc-foreground) !important; }
.sc-btn-outline:hover { background: var(--sc-accent); }
.sc-btn-ghost { background: transparent; color: var(--sc-foreground) !important; }
.sc-btn-ghost:hover { background: var(--sc-accent); }
.sc-btn-destructive { background: var(--sc-destructive); color: var(--sc-destructive-foreground) !important; }
.sc-btn-destructive:hover { opacity: 0.9; }
.sc-btn-sm { height: 34px; padding: 0 14px; font-size: 0.82rem; }
.sc-btn-full { width: 100%; }

/* ── Form fields ──────────────────────────────────────────── */
.sc-field { margin-bottom: 16px; }
.sc-label { display: block; font-size: 0.82rem; font-weight: 500; margin-bottom: 6px; color: var(--sc-foreground); }
.sc-input, .sc-select, .sc-textarea {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--sc-input);
  border-radius: calc(var(--sc-radius) - 2px); font-size: 0.85rem; font-family: inherit;
  background: var(--sc-card); color: var(--sc-foreground); outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.sc-textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 96px; }
.sc-input:focus, .sc-select:focus, .sc-textarea:focus { border-color: var(--sc-ring); box-shadow: 0 0 0 3px oklch(0.704 0.04 256.788 / 20%); }
.sc-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sc-hint { font-size: 0.78rem; color: var(--sc-muted-foreground); margin-top: 6px; }

/* ── Alerts ───────────────────────────────────────────────── */
.sc-alert { border-radius: calc(var(--sc-radius) - 2px); padding: 11px 14px; font-size: 0.83rem; margin-bottom: 16px; border: 1px solid; display: flex; align-items: flex-start; gap: 8px; }
.sc-alert-destructive { background: oklch(0.577 0.245 27.325 / 8%); border-color: oklch(0.577 0.245 27.325 / 25%); color: oklch(0.45 0.2 27); }
.sc-alert-success { background: oklch(0.723 0.219 149.6 / 16%); border-color: oklch(0.723 0.219 149.6 / 38%); color: oklch(0.42 0.17 149.6); }

/* ── Badge ────────────────────────────────────────────────── */
.sc-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 600; border: 1px solid transparent; }
.sc-badge-default { background: var(--sc-primary); color: var(--sc-primary-foreground); }
.sc-badge-secondary { background: var(--sc-secondary); color: var(--sc-secondary-foreground); }
.sc-badge-outline { background: transparent; border-color: var(--sc-border); color: var(--sc-foreground); }
.sc-badge-success { background: oklch(0.723 0.219 149.6 / 20%); color: oklch(0.42 0.17 149.6); }
.sc-badge-destructive { background: oklch(0.577 0.245 27.325 / 12%); color: oklch(0.5 0.2 27); }

/* ── Avatar ───────────────────────────────────────────────── */
.sc-avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--sc-primary); color: var(--sc-primary-foreground); display: flex; align-items: center; justify-content: center; font-size: 0.78rem; font-weight: 600; flex-shrink: 0; }

/* ── Table ────────────────────────────────────────────────── */
.sc-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.sc-table th { text-align: left; padding: 13px 16px; font-size: 0.78rem; font-weight: 600; color: var(--sc-muted-foreground); border-bottom: 1px solid var(--sc-border); text-transform: none; }
.sc-table td { padding: 16px; border-bottom: 1px solid var(--sc-border); color: var(--sc-foreground); }
.sc-table tr:last-child td { border-bottom: none; }
.sc-table tr:hover td { background: var(--sc-muted); }
.sc-empty { text-align: center; padding: 48px 20px; color: var(--sc-muted-foreground); font-size: 0.85rem; }

/* ── Auth layout (login / signup / forgot-password) ──────────── */
.sc-auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--sc-background); }
.sc-auth-wrap { width: 100%; max-width: 380px; }
.sc-auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 24px; }
.sc-auth-brand-logo { width: 28px; height: 28px; border-radius: 6px; background: var(--sc-primary); display: flex; align-items: center; justify-content: center; }
.sc-auth-brand h1 { font-size: 1.1rem; font-weight: 600; margin: 0; }
.sc-auth-footer-text { font-size: 0.78rem; color: var(--sc-muted-foreground); text-align: center; padding: 0 20px; line-height: 1.6; }
.sc-auth-footer-text a { text-decoration: underline; text-underline-offset: 3px; }
.sc-auth-footer-text a:hover { color: var(--sc-primary); }
.sc-link { color: var(--sc-primary); text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }

/* ── App shell (sidebar + topbar) ─────────────────────────── */
.sc-shell { min-height: 100vh; display: flex; background: var(--sc-background); }
.sc-sidebar {
  width: 260px; flex-shrink: 0; background: var(--sc-card); border-right: 1px solid var(--sc-border);
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 100; display: flex; flex-direction: column;
}
.sc-sidebar-header { padding: 14px 12px; border-bottom: 1px solid var(--sc-border); }
.sc-sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: calc(var(--sc-radius) - 2px); }
/* Matches get_logo_html()'s own built-in cap exactly (max-height:44px;
   max-width:180px, hardcoded on the <img> itself when a real logo is
   uploaded) — same numbers the admin panel's sidebar already renders
   at unmodified, since .admin-logo has no size override of its own at
   all. Previous values here (40px/170px) were a close approximation,
   not the same numbers, which is why it still looked slightly off
   next to the admin panel using the identical logo file. !important is
   still needed because get_logo_html() sets its own inline
   max-height/max-width on the <img> itself, and an inline style needs
   an equally-forceful override, not just a wrapping div's own
   constraints (which an inner element's inline style ignores). */
.sc-sidebar-logo-wrap { display: flex; align-items: center; flex-shrink: 0; }
.sc-sidebar-logo-wrap img { max-height: 44px !important; max-width: 180px !important; width: auto !important; height: auto !important; }
.sc-sidebar-brand-logo { width: 32px; height: 32px; border-radius: 8px; background: var(--sc-primary); color: var(--sc-primary-foreground); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.sc-sidebar-brand-text { min-width: 0; }
.sc-sidebar-brand-text .name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-sidebar-brand-text .plan { font-size: 0.72rem; color: var(--sc-muted-foreground); white-space: nowrap; }
.sc-sidebar-content { flex: 1; overflow-y: auto; padding: 12px 8px; }
/* Sits between the nav (flex:1, absorbs the empty space above this)
   and the user-menu footer — same placement convention as the
   upgrade/upsell cards in Notion, Linear, Vercel's own sidebars, rather
   than floating a CTA in the topbar where it would compete with the
   page title for attention. */
.sc-sidebar-promo { margin: 0 8px 12px; padding: 14px; border: 1px solid var(--sc-border); border-radius: calc(var(--sc-radius) - 2px); background: var(--sc-muted); }
.sc-sidebar-promo .title { font-size: 0.82rem; font-weight: 600; margin-bottom: 3px; }
.sc-sidebar-promo .desc { font-size: 0.76rem; color: var(--sc-muted-foreground); line-height: 1.4; margin-bottom: 10px; }
.sc-nav-group { margin-bottom: 16px; }
.sc-nav-group-label { font-size: 0.7rem; font-weight: 500; color: var(--sc-muted-foreground); padding: 0 10px 6px; letter-spacing: 0.02em; }
.sc-nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: calc(var(--sc-radius) - 2px); font-size: 0.84rem; font-weight: 500; color: var(--sc-foreground); text-decoration: none; margin-bottom: 4px; transition: background 0.12s; }
.sc-nav-item:hover { background: var(--sc-accent); }
.sc-nav-item.active { background: var(--sc-accent); font-weight: 600; }
.sc-nav-item .icon { width: 16px; height: 16px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sc-nav-item .badge-count { margin-left: auto; background: var(--sc-destructive); color: #fff; border-radius: 999px; font-size: 0.65rem; font-weight: 700; padding: 1px 6px; min-width: 17px; text-align: center; }
.sc-sidebar-footer { padding: 10px 8px; border-top: 1px solid var(--sc-border); position: relative; }
.sc-user-trigger { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border-radius: calc(var(--sc-radius) - 2px); background: transparent; border: none; cursor: pointer; text-align: left; }
.sc-user-trigger:hover { background: var(--sc-accent); }
.sc-user-trigger .info { flex: 1; min-width: 0; }
.sc-user-trigger .info .name { font-size: 0.83rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-user-trigger .info .email { font-size: 0.74rem; color: var(--sc-muted-foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-user-trigger .chevron { color: var(--sc-muted-foreground); flex-shrink: 0; }
.sc-user-dropdown {
  position: absolute; bottom: calc(100% + 6px); left: 8px; right: 8px; background: var(--sc-card);
  border: 1px solid var(--sc-border); border-radius: var(--sc-radius); box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  padding: 6px; display: none; z-index: 200;
}
.sc-user-dropdown.open { display: block; }
.sc-user-dropdown a, .sc-user-dropdown button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: calc(var(--sc-radius) - 4px); font-size: 0.83rem; color: var(--sc-foreground); text-decoration: none; background: none; border: none; cursor: pointer; text-align: left; font-family: inherit; }
.sc-user-dropdown a:hover, .sc-user-dropdown button:hover { background: var(--sc-accent); }
.sc-user-dropdown .sep { height: 1px; background: var(--sc-border); margin: 5px 0; }
.sc-user-dropdown .danger { color: var(--sc-destructive); }

.sc-main { margin-left: 260px; flex: 1; min-width: 0; }
.sc-header { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 20px; border-bottom: 1px solid var(--sc-border); position: sticky; top: 0; background: var(--sc-background); z-index: 50; }
.sc-header-sep { width: 1px; height: 20px; background: var(--sc-border); }
.sc-header-title { font-size: 1.05rem; font-weight: 600; }
.sc-content { max-width: 860px; margin: 0 auto; padding: 32px 24px; }

/* Mobile sidebar toggle */
.sc-mobile-toggle { display: none; background: var(--sc-card); border: 1px solid var(--sc-border); border-radius: calc(var(--sc-radius) - 2px); width: 32px; height: 32px; align-items: center; justify-content: center; cursor: pointer; }
@media (max-width: 900px) {
  .sc-sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 0 0 0 9999px rgba(0,0,0,0); }
  .sc-sidebar.open { transform: translateX(0); box-shadow: 0 0 0 9999px rgba(0,0,0,0.3); }
  .sc-main { margin-left: 0; }
  .sc-mobile-toggle { display: flex; }
  .sc-field-row { grid-template-columns: 1fr; }
}
