/* FeedCentral Design System — primitives.
   UI Foundation phase. The shared component vocabulary (buttons, forms, cards, tables, badges,
   nav, app shell) built on tokens.css. Prefixed "fc-" throughout — distinct from News.Web's
   existing "mk-" marketing-page classes (left untouched this phase; marketing.css now sources
   its own --mk-* palette FROM these --fc-* tokens instead of hardcoding its own, so there is one
   real palette even though the two class vocabularies stay separate for now — see project memory
   for the "two vocabularies, one token source" note).

   No icon font, no SPA framework, no build pipeline — plain CSS, one small vanilla JS file
   (app-shell.js) for the two interactive behaviors this phase actually needs: a mobile nav
   toggle and a dropdown menu. */

*, *::before, *::after { box-sizing: border-box; }

.fc-root {
  background: var(--fc-bg);
  color: var(--fc-text);
  font: var(--fc-text-body);
  -webkit-font-smoothing: antialiased;
}

.fc-root h1, .fc-root h2, .fc-root h3 { font-family: var(--fc-font-display); margin: 0; text-wrap: balance; }
.fc-h1 { font: var(--fc-text-h1); }
.fc-h2 { font: var(--fc-text-h2); }
.fc-h3 { font: var(--fc-text-h3); font-family: var(--fc-font-body); }
.fc-text-muted { color: var(--fc-text-muted); }
.fc-text-faint { color: var(--fc-text-faint); }
.fc-text-danger { color: var(--fc-danger); }
.fc-text-warning { color: var(--fc-warning); }
.fc-text-success { color: var(--fc-success); }
.fc-text-small { font: var(--fc-text-small); }
.fc-text-mono { font-family: var(--fc-font-mono); }
.fc-stat { font: var(--fc-text-stat); font-variant-numeric: tabular-nums; }

a.fc-link { color: var(--fc-primary); text-decoration: none; }
a.fc-link:hover { text-decoration: underline; }

:focus-visible { outline: none; box-shadow: var(--fc-focus-ring); border-radius: var(--fc-radius-sm); }

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

.fc-container { max-width: var(--fc-content-width); margin: 0 auto; padding: 0 var(--fc-space-5); }
.fc-stack { display: flex; flex-direction: column; }
.fc-row { display: flex; align-items: center; }
.fc-gap-1 { gap: var(--fc-space-1); } .fc-gap-2 { gap: var(--fc-space-2); }
.fc-gap-3 { gap: var(--fc-space-3); } .fc-gap-4 { gap: var(--fc-space-4); } .fc-gap-5 { gap: var(--fc-space-5); }
.fc-grid { display: grid; gap: var(--fc-space-4); }
.fc-grid-2 { grid-template-columns: repeat(2, 1fr); }
.fc-grid-3 { grid-template-columns: repeat(3, 1fr); }
.fc-grid-4 { grid-template-columns: repeat(4, 1fr); }
.fc-grid-auto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 900px) { .fc-grid-3, .fc-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .fc-grid-2, .fc-grid-3, .fc-grid-4 { grid-template-columns: 1fr; } }

/* ---- section header -------------------------------------------------------------------------- */

.fc-section-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--fc-space-4); margin-bottom: var(--fc-space-4); flex-wrap: wrap; }
.fc-section-header h1, .fc-section-header h2 { margin: 0 0 var(--fc-space-1); }
.fc-section-header p { margin: 0; color: var(--fc-text-muted); font-size: 0.92rem; }
.fc-section-actions { display: flex; gap: var(--fc-space-2); flex-wrap: wrap; }

/* ---- breadcrumbs ----------------------------------------------------------------------------- */

.fc-breadcrumbs { display: flex; align-items: center; gap: var(--fc-space-1); font-size: 0.82rem; color: var(--fc-text-muted); margin-bottom: var(--fc-space-3); flex-wrap: wrap; }
.fc-breadcrumbs a { color: var(--fc-text-muted); text-decoration: none; }
.fc-breadcrumbs a:hover { color: var(--fc-text); text-decoration: underline; }
.fc-breadcrumbs .fc-crumb-sep { color: var(--fc-text-faint); }
.fc-breadcrumbs .fc-crumb-current { color: var(--fc-text); font-weight: 600; }

/* ---- buttons --------------------------------------------------------------------------------- */

.fc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--fc-space-2);
  font: inherit; font-weight: 600; font-size: 0.9rem; padding: 0.55rem 1.05rem;
  border-radius: var(--fc-radius-sm); border: 1px solid transparent; cursor: pointer;
  text-decoration: none; transition: background var(--fc-transition-fast), border-color var(--fc-transition-fast), opacity var(--fc-transition-fast);
  white-space: nowrap;
}
.fc-btn svg { width: 16px; height: 16px; flex: none; }
.fc-btn-primary { background: var(--fc-primary); color: var(--fc-text-on-accent); }
.fc-btn-primary:hover { background: var(--fc-primary-strong); }
.fc-btn-secondary { background: var(--fc-surface); color: var(--fc-text); border-color: var(--fc-border-strong); }
.fc-btn-secondary:hover { background: var(--fc-hover-overlay); }
.fc-btn-ghost { background: transparent; color: var(--fc-text-muted); }
.fc-btn-ghost:hover { background: var(--fc-hover-overlay); color: var(--fc-text); }
.fc-btn-danger { background: var(--fc-danger); color: #fff; }
.fc-btn-danger:hover { filter: brightness(0.92); }
.fc-btn-sm { padding: 0.35rem 0.75rem; font-size: 0.82rem; }
.fc-btn-block { width: 100%; }
.fc-btn:disabled, .fc-btn[aria-disabled="true"] { opacity: var(--fc-disabled-opacity); cursor: not-allowed; }

/* ---- forms ----------------------------------------------------------------------------------- */

.fc-field { margin-bottom: var(--fc-space-4); }
.fc-field label { display: block; font-weight: 600; font-size: 0.85rem; margin-bottom: var(--fc-space-1); }
.fc-field .fc-hint { display: block; color: var(--fc-text-faint); font-size: 0.78rem; margin-top: var(--fc-space-1); }
.fc-input, .fc-select, .fc-textarea {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--fc-border-strong); border-radius: var(--fc-radius-sm);
  background: var(--fc-surface); color: var(--fc-text); font: inherit; font-size: 0.92rem;
  transition: border-color var(--fc-transition-fast);
}
.fc-input:focus, .fc-select:focus, .fc-textarea:focus { border-color: var(--fc-primary); }
.fc-textarea { resize: vertical; min-height: 6rem; }
.fc-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 18px) center, calc(100% - 13px) center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 2rem; color: var(--fc-text-muted); }
.fc-checkbox-row { display: flex; align-items: center; gap: var(--fc-space-2); font-size: 0.9rem; flex-wrap: wrap; }
.fc-checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--fc-primary); }
.fc-field-error { color: var(--fc-danger); font-size: 0.82rem; margin-top: var(--fc-space-1); }
.fc-input:disabled, .fc-select:disabled, .fc-textarea:disabled { opacity: var(--fc-disabled-opacity); background: var(--fc-surface-sunken); }

/* ---- alerts / notices ------------------------------------------------------------------------ */

.fc-alert { display: flex; gap: var(--fc-space-3); align-items: flex-start; padding: var(--fc-space-3) var(--fc-space-4); border-radius: var(--fc-radius-md); border: 1px solid var(--fc-border); background: var(--fc-surface); font-size: 0.9rem; }
.fc-alert svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.fc-alert-info { border-color: color-mix(in srgb, var(--fc-info) 35%, var(--fc-border)); background: var(--fc-info-soft); color: var(--fc-info); }
.fc-alert-success { border-color: color-mix(in srgb, var(--fc-success) 35%, var(--fc-border)); background: var(--fc-success-soft); color: var(--fc-success); }
.fc-alert-warning { border-color: color-mix(in srgb, var(--fc-warning) 35%, var(--fc-border)); background: var(--fc-warning-soft); color: var(--fc-warning); }
.fc-alert-danger { border-color: color-mix(in srgb, var(--fc-danger) 35%, var(--fc-border)); background: var(--fc-danger-soft); color: var(--fc-danger); }
.fc-alert-body { color: var(--fc-text); }

/* ---- badges / status pills -------------------------------------------------------------------- */

.fc-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: var(--fc-radius-pill); font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.fc-badge-neutral { background: var(--fc-surface-sunken); color: var(--fc-text-muted); }
.fc-badge-primary { background: var(--fc-primary-soft); color: var(--fc-primary); }
.fc-badge-success { background: var(--fc-success-soft); color: var(--fc-success); }
.fc-badge-warning { background: var(--fc-warning-soft); color: var(--fc-warning); }
.fc-badge-danger { background: var(--fc-danger-soft); color: var(--fc-danger); }
.fc-badge-info { background: var(--fc-info-soft); color: var(--fc-info); }
.fc-badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- cards ------------------------------------------------------------------------------------ */

.fc-card { background: var(--fc-surface-raised); border: 1px solid var(--fc-border); border-radius: var(--fc-radius-md); box-shadow: var(--fc-shadow-sm); }
.fc-card-pad { padding: var(--fc-space-5); }
.fc-card-header { display: flex; align-items: center; justify-content: space-between; padding: var(--fc-space-4) var(--fc-space-5); border-bottom: 1px solid var(--fc-border); }
.fc-card-header h3 { margin: 0; }
.fc-card-body { padding: var(--fc-space-5); }

.fc-stat-card { background: var(--fc-surface-raised); border: 1px solid var(--fc-border); border-radius: var(--fc-radius-md); padding: var(--fc-space-4) var(--fc-space-5); box-shadow: var(--fc-shadow-sm); }
.fc-stat-card .fc-stat-label { display: flex; align-items: center; gap: var(--fc-space-2); font: var(--fc-text-label); text-transform: uppercase; letter-spacing: 0.04em; color: var(--fc-text-faint); margin-bottom: var(--fc-space-2); }
.fc-stat-card .fc-stat-label svg { width: 15px; height: 15px; }
.fc-stat-card .fc-stat-sub { color: var(--fc-text-muted); font-size: 0.82rem; margin-top: var(--fc-space-1); }
.fc-stat-bar { height: 6px; border-radius: var(--fc-radius-pill); background: var(--fc-surface-sunken); overflow: hidden; margin-top: var(--fc-space-3); }
.fc-stat-bar > span { display: block; height: 100%; background: var(--fc-primary); border-radius: inherit; }
.fc-stat-bar.fc-stat-bar-warning > span { background: var(--fc-warning); }
.fc-stat-bar.fc-stat-bar-danger > span { background: var(--fc-danger); }

/* ---- empty states -------------------------------------------------------------------------- */

.fc-empty { text-align: center; padding: var(--fc-space-7) var(--fc-space-4); color: var(--fc-text-muted); border: 1px dashed var(--fc-border-strong); border-radius: var(--fc-radius-md); }
.fc-empty svg { width: 32px; height: 32px; color: var(--fc-text-faint); margin-bottom: var(--fc-space-3); }
.fc-empty h3 { color: var(--fc-text); margin-bottom: var(--fc-space-1); }
.fc-empty p { margin: 0; max-width: 40ch; margin-inline: auto; }

/* ---- tables ------------------------------------------------------------------------------------ */

.fc-table-wrap { overflow-x: auto; border: 1px solid var(--fc-border); border-radius: var(--fc-radius-md); background: var(--fc-surface-raised); }
.fc-table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.fc-table th, .fc-table td { text-align: left; padding: 0.65rem 1rem; border-bottom: 1px solid var(--fc-border); vertical-align: middle; }
.fc-table thead th { background: var(--fc-surface-sunken); font-size: 0.7rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fc-text-faint); font-weight: 700; }
.fc-table tbody tr:last-child td { border-bottom: none; }
.fc-table tbody tr:hover { background: var(--fc-hover-overlay); }
.fc-table td.fc-num, .fc-table th.fc-num { text-align: right; font-variant-numeric: tabular-nums; }

/* card-per-row transform for small screens — a deliberate structural change, not a shrink */
@media (max-width: 640px) {
  .fc-table-responsive-cards thead { display: none; }
  .fc-table-responsive-cards, .fc-table-responsive-cards tbody, .fc-table-responsive-cards tr, .fc-table-responsive-cards td { display: block; width: 100%; }
  .fc-table-responsive-cards tr { border-bottom: 1px solid var(--fc-border); padding: var(--fc-space-3) var(--fc-space-4); }
  .fc-table-responsive-cards td { border: none; padding: 3px 0; }
  .fc-table-responsive-cards td[data-label]::before { content: attr(data-label); display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fc-text-faint); font-weight: 700; }
}

/* ---- pagination -------------------------------------------------------------------------------- */

.fc-pagination { display: flex; align-items: center; gap: var(--fc-space-2); font-size: 0.85rem; }
.fc-pagination a, .fc-pagination span { padding: 0.35rem 0.65rem; border-radius: var(--fc-radius-sm); color: var(--fc-text-muted); text-decoration: none; }
.fc-pagination a:hover { background: var(--fc-hover-overlay); color: var(--fc-text); }
.fc-pagination .fc-page-current { background: var(--fc-primary-soft); color: var(--fc-primary); font-weight: 700; }
.fc-pagination .fc-page-disabled { opacity: var(--fc-disabled-opacity); }

/* ---- tabs -------------------------------------------------------------------------------------- */

.fc-tabs { display: flex; gap: var(--fc-space-4); border-bottom: 1px solid var(--fc-border); margin-bottom: var(--fc-space-4); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.fc-tab { padding: 0.6rem 0.1rem; color: var(--fc-text-muted); text-decoration: none; font-size: 0.9rem; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; flex: none; }
.fc-tab:hover { color: var(--fc-text); }
.fc-tab[aria-current="page"], .fc-tab.fc-tab-active { color: var(--fc-primary); border-color: var(--fc-primary); }

/* ---- dropdown ---------------------------------------------------------------------------------- */

.fc-dropdown { position: relative; }
.fc-dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--fc-surface-raised); border: 1px solid var(--fc-border); border-radius: var(--fc-radius-md); box-shadow: var(--fc-shadow-lg); padding: var(--fc-space-2); z-index: 40; display: none; }
.fc-dropdown[data-open="true"] .fc-dropdown-menu { display: block; }
.fc-dropdown-menu a, .fc-dropdown-menu button { display: flex; align-items: center; gap: var(--fc-space-2); width: 100%; text-align: left; padding: 0.5rem 0.65rem; border-radius: var(--fc-radius-sm); color: var(--fc-text); text-decoration: none; font: inherit; font-size: 0.87rem; background: none; border: none; cursor: pointer; }
.fc-dropdown-menu a:hover, .fc-dropdown-menu button:hover { background: var(--fc-hover-overlay); }
.fc-dropdown-menu .fc-dropdown-sep { height: 1px; background: var(--fc-border); margin: var(--fc-space-2) 0; }
.fc-dropdown-trigger { display: flex; align-items: center; gap: var(--fc-space-2); background: none; border: none; cursor: pointer; color: inherit; font: inherit; padding: var(--fc-space-1); border-radius: var(--fc-radius-sm); }
.fc-dropdown-trigger:hover { background: var(--fc-hover-overlay); }

/* ================================================================================================
   APPLICATION SHELL — shared sidebar + topbar layout for Portal and Admin. News.Web keeps its own
   horizontal marketing nav (a genuinely different context — see the audit's own §7 recommendation)
   and does not use these classes.
   ================================================================================================ */

.fc-app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--fc-sidebar-width) 1fr; grid-template-areas: "sidebar main"; }

/* Pre-auth centered card (login/activate/forgot/reset/signup) — shared across every app's
   unauthenticated pages. Previously only defined in News.Portal's own site.css; News.Admin's
   AuthPage template referenced these same class names on the assumption they were already shared
   DesignSystem primitives, which they weren't — its wordmark rendered as a raw, unstyled browser
   link as a result. Moved here so both apps get one real definition instead of a silently-false
   assumption in one of them. */
.fc-auth-shell {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--fc-space-5);
  background: var(--fc-surface-sunken);
}
.fc-auth-card { width: 100%; max-width: 26rem; }
.fc-auth-wordmark {
  display: block; text-align: center; font-family: var(--fc-font-display); font-weight: 700;
  font-size: 1.2rem; color: var(--fc-text); text-decoration: none; margin-bottom: var(--fc-space-5);
}
.fc-auth-wordmark span { color: var(--fc-primary); }

.fc-sidebar {
  grid-area: sidebar; background: var(--fc-surface-raised); border-right: 1px solid var(--fc-border);
  display: flex; flex-direction: column; height: 100vh; position: sticky; top: 0; overflow-y: auto;
}
.fc-sidebar-brand { display: flex; align-items: center; gap: var(--fc-space-2); padding: var(--fc-space-4) var(--fc-space-5); font-family: var(--fc-font-display); font-weight: 700; font-size: 1.05rem; color: var(--fc-text); text-decoration: none; border-bottom: 1px solid var(--fc-border); }
.fc-sidebar-brand span { color: var(--fc-primary); }
.fc-sidebar-nav { padding: var(--fc-space-3); flex: 1; }
.fc-nav-group { margin-bottom: var(--fc-space-4); }
.fc-nav-group-label { font: var(--fc-text-label); text-transform: uppercase; letter-spacing: 0.06em; color: var(--fc-text-faint); padding: 0 var(--fc-space-3); margin-bottom: var(--fc-space-2); }
.fc-nav-item {
  display: flex; align-items: center; gap: var(--fc-space-3); padding: 0.55rem var(--fc-space-3);
  border-radius: var(--fc-radius-sm); color: var(--fc-text-muted); text-decoration: none; font-size: 0.9rem; font-weight: 500;
  transition: background var(--fc-transition-fast), color var(--fc-transition-fast);
}
.fc-nav-item svg { width: 18px; height: 18px; flex: none; }
.fc-nav-item:hover { background: var(--fc-hover-overlay); color: var(--fc-text); }
.fc-nav-item[aria-current="page"] { background: var(--fc-primary-soft); color: var(--fc-primary); font-weight: 600; }
.fc-sidebar-footer { padding: var(--fc-space-3); border-top: 1px solid var(--fc-border); }

.fc-topbar {
  grid-area: topbar; display: flex; align-items: center; justify-content: space-between;
  height: var(--fc-topbar-height); padding: 0 var(--fc-space-5); background: var(--fc-surface);
  border-bottom: 1px solid var(--fc-border); position: sticky; top: 0; z-index: 30;
}
.fc-topbar-title { font-weight: 600; font-size: 0.98rem; }
.fc-topbar-actions { display: flex; align-items: center; gap: var(--fc-space-3); }
.fc-nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: var(--fc-space-2); color: var(--fc-text); border-radius: var(--fc-radius-sm); }
.fc-nav-toggle:hover { background: var(--fc-hover-overlay); }
.fc-nav-toggle svg { width: 22px; height: 22px; }

.fc-main { grid-area: main; min-width: 0; display: flex; flex-direction: column; }
.fc-main-content { padding: var(--fc-space-5); flex: 1; min-width: 0; }

.fc-context-switch { display: flex; align-items: center; gap: var(--fc-space-2); padding: 0.45rem 0.6rem; border: 1px solid var(--fc-border); border-radius: var(--fc-radius-sm); background: var(--fc-surface); font-size: 0.85rem; color: var(--fc-text); cursor: pointer; }
.fc-context-switch svg { width: 16px; height: 16px; color: var(--fc-text-faint); }

/* ---- customer switcher (sidebar) --------------------------------------------------------------- */

.fc-customer-switcher { margin: 0 var(--fc-space-3) var(--fc-space-4); }
.fc-customer-switcher-trigger {
  width: 100%; justify-content: flex-start; padding: 0.5rem 0.6rem; border: 1px solid var(--fc-border);
  border-radius: var(--fc-radius-sm); background: var(--fc-surface);
}
.fc-customer-switcher-trigger svg:first-child { color: var(--fc-text-faint); flex: none; }
.fc-customer-switcher-trigger svg:last-child { margin-left: auto; flex: none; color: var(--fc-text-faint); }
.fc-customer-switcher-name { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 0.87rem; }
.fc-customer-switcher .fc-dropdown-menu { left: 0; right: 0; min-width: 0; }
.fc-customer-switcher .fc-dropdown-menu a[aria-current="true"] { background: var(--fc-primary-soft); color: var(--fc-primary); }

/* ---- theme switcher (sidebar footer) ------------------------------------------------------------ */

.fc-theme-switcher { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--fc-border); border-radius: var(--fc-radius-sm); background: var(--fc-surface-sunken); }
.fc-theme-btn { flex: 1; display: flex; align-items: center; justify-content: center; padding: 0.4rem 0; background: none; border: none; border-radius: calc(var(--fc-radius-sm) - 2px); color: var(--fc-text-faint); cursor: pointer; }
.fc-theme-btn svg { width: 16px; height: 16px; }
.fc-theme-btn:hover { color: var(--fc-text); }
.fc-theme-btn[aria-pressed="true"] { background: var(--fc-surface-raised); color: var(--fc-primary); box-shadow: var(--fc-shadow-sm); }

/* Mobile: sidebar becomes an off-canvas drawer, topbar gains a hamburger toggle. */
@media (max-width: 900px) {
  .fc-app-shell { grid-template-columns: 1fr; }
  .fc-sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(84vw, 300px); transform: translateX(-100%);
    transition: transform var(--fc-transition); z-index: 50; box-shadow: var(--fc-shadow-lg);
  }
  .fc-sidebar[data-open="true"] { transform: translateX(0); }
  .fc-nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .fc-sidebar-scrim { display: none; position: fixed; inset: 0; background: rgba(10, 11, 16, 0.4); z-index: 45; }
  .fc-sidebar[data-open="true"] ~ .fc-sidebar-scrim { display: block; }
}

@media (max-width: 480px) {
  .fc-main-content { padding: var(--fc-space-4); }
  .fc-card-pad, .fc-card-body { padding: var(--fc-space-4); }
}
