/* ============================================================================
   Skillesta Design System v2 — reusable component kit
   Tokens live in styles.css (:root --sk-*). This file is the shared vocabulary
   every redesigned page/modal consumes so the rollout stays consistent.
   Prefix: .sk-  (won't collide with legacy classes).
   ============================================================================ */

/* ── Page scaffolding ─────────────────────────────────────────────────────── */
.sk-page { background: var(--sk-ground); font-family: var(--sk-font-body); color: var(--sk-body); padding: 34px 0 64px; }
/* Default width matches the calendar page (its spacing reads best beside the
   near-full-width header). `narrow` stays for text-heavy pages where a shorter
   line length aids readability. */
.sk-container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.sk-container.narrow { max-width: 900px; }
.sk-container.wide { max-width: 1320px; }

.sk-page-head { margin-bottom: 22px; }
.sk-eyebrow { font-family: var(--sk-font-display); font-size: 12px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--sk-primary); margin-bottom: 8px; }
.sk-title { font-family: var(--sk-font-display); font-size: 30px; line-height: 1.12; font-weight: 700;
  letter-spacing: -.02em; color: var(--sk-ink); margin: 0 0 6px; text-wrap: balance; }
.sk-sub { margin: 0; font-size: 15px; color: var(--sk-muted); }
.sk-section-title { font-family: var(--sk-font-display); font-size: 19px; font-weight: 700; color: var(--sk-ink); letter-spacing: -.01em; margin: 0; }

/* ── Surfaces ─────────────────────────────────────────────────────────────── */
.sk-card { background: var(--sk-surface); border: 1px solid var(--sk-line); border-radius: var(--sk-radius);
  box-shadow: var(--sk-shadow-sm); }
.sk-card.pad { padding: 18px; }
.sk-card.hover { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.sk-card.hover:hover { transform: translateY(-3px); box-shadow: var(--sk-shadow-md); border-color: var(--sk-line-strong); }
.sk-panel { background: var(--sk-panel); border-radius: var(--sk-radius-sm); }
.sk-divider { height: 1px; background: var(--sk-line); border: 0; margin: 0; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.sk-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; padding: 0 20px; border-radius: var(--sk-radius-pill);
  font-family: var(--sk-font-body); font-weight: 600; font-size: 14px; line-height: 1; cursor: pointer;
  border: 1px solid transparent; white-space: nowrap; text-decoration: none;
  transition: transform .12s ease, background .12s ease, box-shadow .12s ease, border-color .12s ease, color .12s ease; }
.sk-btn:active { transform: translateY(1px); }
.sk-btn:focus-visible { outline: 2px solid var(--sk-primary); outline-offset: 2px; }
.sk-btn-primary { background: var(--sk-primary); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--sk-primary) 65%, transparent); }
.sk-btn-primary:hover { background: var(--sk-primary-press); color: #fff; }
.sk-btn-accent { background: var(--sk-accent); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--sk-accent) 60%, transparent); }
.sk-btn-accent:hover { filter: brightness(1.05); color: #fff; }
.sk-btn-ghost { background: var(--sk-surface); color: var(--sk-primary); border-color: var(--sk-line-strong); }
.sk-btn-ghost:hover { border-color: var(--sk-primary); background: var(--sk-primary-soft); color: var(--sk-primary); }
.sk-btn-subtle { background: var(--sk-panel); color: var(--sk-ink); }
.sk-btn-subtle:hover { background: var(--sk-panel-2); color: var(--sk-ink); }
.sk-btn-danger { background: var(--sk-danger); color: #fff; }
.sk-btn-danger:hover { filter: brightness(1.05); color: #fff; }
.sk-btn-sm { height: 36px; padding: 0 15px; font-size: 13px; }
.sk-btn-lg { height: 48px; padding: 0 26px; font-size: 15px; }
.sk-btn.block { width: 100%; }
.sk-btn[disabled], .sk-btn.disabled { opacity: .55; pointer-events: none; }

/* Works on <a> and <button> alike — the resets neutralise a button's native
   grey chrome so `.sk-link` renders as a clean text link everywhere. */
.sk-link {
  color: var(--sk-primary); font-weight: 600; cursor: pointer; text-decoration: none;
  background: none; border: 0; padding: 0;
  font-family: inherit; font-size: inherit; line-height: inherit;
}
.sk-link:hover { color: var(--sk-primary-press); text-decoration: underline; }

/* ── Chips & badges ───────────────────────────────────────────────────────── */
.sk-chip { display: inline-flex; align-items: center; gap: 6px; height: 27px; padding: 0 11px;
  border-radius: var(--sk-radius-pill); font-size: 12.5px; font-weight: 600; background: var(--sk-panel);
  color: var(--sk-body); border: 1px solid transparent; }
.sk-chip.line { background: transparent; border-color: var(--sk-line-strong); color: var(--sk-muted); }
.sk-chip.primary { background: var(--sk-primary-soft); color: var(--sk-primary); }
.sk-chip.accent { background: var(--sk-accent-soft); color: var(--sk-accent); }
.sk-chip.success { background: color-mix(in srgb, var(--sk-success) 15%, transparent); color: var(--sk-success); }
.sk-chip.warn { background: color-mix(in srgb, var(--sk-warn) 16%, transparent); color: var(--sk-warn); }
.sk-chip.danger { background: color-mix(in srgb, var(--sk-danger) 14%, transparent); color: var(--sk-danger); }
.sk-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

/* status badge with a leading dot */
.sk-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--sk-body); }
.sk-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--sk-muted); }
.sk-badge.is-success::before { background: var(--sk-success); }
.sk-badge.is-warn::before { background: var(--sk-warn); }
.sk-badge.is-danger::before { background: var(--sk-danger); }
.sk-badge.is-primary::before { background: var(--sk-primary); }

/* ── Form controls ────────────────────────────────────────────────────────── */
.sk-label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--sk-muted); margin-bottom: 9px; }
.sk-input, .sk-select, .sk-textarea { width: 100%; border: 1px solid var(--sk-line-strong); border-radius: var(--sk-radius-sm);
  background: var(--sk-surface); color: var(--sk-ink); font: inherit; font-size: 14px; padding: 0 14px; height: 44px; outline: none;
  transition: border-color .12s ease, box-shadow .12s ease; }
.sk-textarea { height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.sk-input::placeholder, .sk-textarea::placeholder { color: var(--sk-muted); }
.sk-input:focus, .sk-select:focus, .sk-textarea:focus { border-color: var(--sk-primary); box-shadow: 0 0 0 3px var(--sk-primary-soft); }
.sk-input-group { display: flex; align-items: center; gap: 10px; background: var(--sk-panel);
  border-radius: var(--sk-radius-sm); padding: 0 14px; color: var(--sk-muted); }
.sk-input-group input { flex: 1; border: 0; background: transparent; outline: none; font: inherit; font-size: 14px;
  color: var(--sk-ink); height: 44px; }

/* segmented quick-pick pills (for filters / small choices) */
.sk-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.sk-pill { padding: 7px 13px; border-radius: var(--sk-radius-pill); border: 1px solid var(--sk-line-strong);
  font-size: 13px; font-weight: 500; color: var(--sk-body); cursor: pointer; background: var(--sk-surface); transition: .12s ease; }
.sk-pill:hover { border-color: var(--sk-primary); }
.sk-pill.on { background: var(--sk-primary-soft); border-color: var(--sk-primary); color: var(--sk-primary); font-weight: 600; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */
.sk-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--sk-line); }
.sk-tab { padding: 11px 16px; font-size: 14px; font-weight: 600; color: var(--sk-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s ease, border-color .12s ease; background: none; border-top:0; border-left:0; border-right:0; }
.sk-tab:hover { color: var(--sk-ink); }
.sk-tab.active { color: var(--sk-primary); border-bottom-color: var(--sk-primary); }

/* ── Avatars & stats ──────────────────────────────────────────────────────── */
.sk-avatar { border-radius: 50%; object-fit: cover; background: var(--sk-panel); display: inline-flex;
  align-items: center; justify-content: center; color: #fff; font-family: var(--sk-font-display); font-weight: 700; }
.sk-avatar.grad { background: linear-gradient(135deg, var(--sk-brand), var(--sk-primary)); }
.sk-stat { background: var(--sk-surface); border: 1px solid var(--sk-line); border-radius: var(--sk-radius-sm); padding: 14px 16px; }
.sk-stat b { display: block; font-family: var(--sk-font-display); font-size: 24px; font-weight: 700; color: var(--sk-ink);
  letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.sk-stat span { font-size: 12px; color: var(--sk-muted); }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.sk-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 48px 20px; text-align: center;
  background: var(--sk-surface); border: 1px dashed var(--sk-line-strong); border-radius: var(--sk-radius); color: var(--sk-muted); }
.sk-empty b { font-family: var(--sk-font-display); color: var(--sk-ink); font-size: 16px; }

/* ── Icons ────────────────────────────────────────────────────────────────── */
.sk-icn { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.sk-icn.sm { width: 15px; height: 15px; }
.sk-icn.lg { width: 22px; height: 22px; }

/* ── Modal shell (for ng-bootstrap dialogs opting into the system) ────────── */
.sk-modal { font-family: var(--sk-font-body); color: var(--sk-body); }
/* Dialog width for form modals: panel matches the content column instead of
   Bootstrap's .modal-lg (800px), which left a slab of dead space. */
.sk-dialog-form { max-width: 640px; }
.sk-dialog-post { max-width: 720px; }
.sk-modal .sk-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 20px 24px; border-bottom: 1px solid var(--sk-line); }
.sk-modal .sk-modal-head h4 { font-family: var(--sk-font-display); font-size: 19px; font-weight: 700; color: var(--sk-ink); margin: 0; }
.sk-modal .sk-modal-head p { margin: 4px 0 0; font-size: 13.5px; color: var(--sk-muted); }
.sk-modal .sk-modal-body { padding: 22px 24px; }
.sk-modal .sk-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--sk-line); }
.sk-modal-x { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--sk-line); background: var(--sk-surface);
  color: var(--sk-muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto; }
.sk-modal-x:hover { color: var(--sk-ink); border-color: var(--sk-line-strong); }

/* ── Utilities ────────────────────────────────────────────────────────────── */
.sk-tnum { font-variant-numeric: tabular-nums; }
.sk-muted { color: var(--sk-muted); }
.sk-ink { color: var(--sk-ink); }
.sk-grid { display: grid; gap: 16px; }
.sk-row { display: flex; gap: 12px; align-items: center; }
.sk-row.wrap { flex-wrap: wrap; }
.sk-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

@media (prefers-reduced-motion: reduce) {
  .sk-btn, .sk-card.hover, .sk-pill, .sk-tab { transition: none; }
}

/* ============================================================================
   Global dropdown & select FONT CONSISTENCY (app-wide, not scoped)
   Third-party dropdowns (ng-select, ng-multiselect-dropdown) and bootstrap
   menus each ship their own font stack, so a <select>, a multiselect and a
   nav dropdown on the same screen render in three different faces. Forcing
   `font-family: inherit` makes every dropdown adopt the font of its context —
   the single highest-leverage consistency fix across the platform.
   ============================================================================ */

/* Native + bootstrap selects & menus */
select,
.form-select,
.dropdown-menu,
.dropdown-item,
.dropdown-toggle {
  font-family: inherit;
}
.dropdown-menu { font-size: 14px; }
.dropdown-item { font-size: 14px; }

/* ng-select (@ng-select/ng-select) — control + options panel (panel is
   appended to body, so it can't inherit from the page; pin it to the body face) */
.ng-select,
.ng-select .ng-select-container,
.ng-select .ng-select-container .ng-value-container .ng-input > input,
.ng-dropdown-panel,
.ng-dropdown-panel .ng-option {
  font-family: var(--sk-font-body, inherit);
}
.ng-dropdown-panel .ng-option { font-size: 14px; color: var(--sk-ink); }
.ng-dropdown-panel .ng-option.ng-option-selected,
.ng-dropdown-panel .ng-option.ng-option-marked { background: var(--sk-primary-soft); color: var(--sk-primary); }

/* ng-multiselect-dropdown — button + options list */
.multiselect-dropdown,
.multiselect-dropdown .dropdown-btn,
.multiselect-dropdown .dropdown-list,
.multiselect-dropdown .dropdown-list .item2,
.multiselect-dropdown .dropdown-list li,
.multiselect-item-checkbox {
  font-family: var(--sk-font-body, inherit) !important;
}
.multiselect-dropdown .dropdown-list { font-size: 14px; }
.multiselect-dropdown .dropdown-list .multiselect-item-checkbox input[type=checkbox]:checked + div:before {
  background: var(--sk-primary) !important; border-color: var(--sk-primary) !important;
}
.multiselect-dropdown .dropdown-list .multiselect-item-checkbox input[type=checkbox] + div:before {
  border-color: var(--sk-primary) !important;
}

/* ngb typeahead / autocomplete results */
ngb-typeahead-window.dropdown-menu,
.ngb-highlight { font-family: inherit; }

/* ============================================================================
   Best-in-class remediation — systemic additions
   ============================================================================ */

/* Keyboard focus — a visible ring on every interactive primitive + a global
   fallback so no keyboard user is ever left without a focus indicator. */
.sk-tab:focus-visible,
.sk-link:focus-visible,
.sk-pill:focus-visible,
.sk-modal-x:focus-visible,
.sk-back-to-top:focus-visible {
  outline: 2px solid var(--sk-primary);
  outline-offset: 2px;
}
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--sk-primary);
  outline-offset: 2px;
}

/* Button loading state — spinner + inert, works on any variant (currentColor) */
.sk-btn.is-loading { pointer-events: none; opacity: 0.85; }
.sk-btn.is-loading::before {
  content: ""; width: 15px; height: 15px; flex: 0 0 15px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: sk-spin 0.6s linear infinite;
}
@keyframes sk-spin { to { transform: rotate(360deg); } }

/* Validation — consistent invalid styling + a field-error message helper.
   (Promoted from the many copy-pasted per-component rules.) */
.sk-input.is-invalid,
.sk-select.is-invalid,
.sk-textarea.is-invalid,
.is-invalid > .sk-input {
  border-color: var(--sk-danger) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sk-danger) 12%, transparent);
}
.ng-select.is-invalid .ng-select-container,
.multiselect-dropdown.is-invalid .dropdown-btn,
app-eutopia-multi-select.is-invalid { border-radius: var(--sk-radius-sm); box-shadow: 0 0 0 1px var(--sk-danger); }
.sk-field-error {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
  font-size: 12.5px; color: var(--sk-danger);
}
.sk-field-error .sk-icn { color: var(--sk-danger); flex: 0 0 auto; }

/* Loading skeleton primitive */
.sk-skeleton {
  background: linear-gradient(90deg, var(--sk-panel) 25%, var(--sk-panel-2) 37%, var(--sk-panel) 63%);
  background-size: 400% 100%; border-radius: var(--sk-radius-sm); animation: sk-shimmer 1.4s ease infinite;
}
@keyframes sk-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
