/* elmbench UI — core components.
 *
 * color-mix() lines always follow a plain fallback for browsers without it.
 *
 * Every selector is an `eb-` class, so this file can sit next to an app's own
 * stylesheet without restyling anything the app did not opt in. Logical
 * properties throughout: the same markup is correct in Persian (rtl) and English.
 * Requires tokens.css.
 */

/* page --------------------------------------------------------------------- */
.eb-page {
  margin: 0;
  min-height: 100vh;
  font-family: var(--eb-font);
  font-size: var(--eb-text-base);
  line-height: var(--eb-leading);
  color: var(--eb-ink);
  background: var(--eb-bg);
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}
.eb-page *,
.eb-page *::before,
.eb-page *::after { box-sizing: border-box; }

.eb-focus:focus-visible,
.eb-page :focus-visible {
  outline: 3px solid var(--eb-focus);
  outline-offset: 2px;
}

.eb-container {
  width: min(100% - 2 * var(--eb-s-4), 40rem);
  margin-inline: auto;
}
.eb-container--wide { width: min(100% - 2 * var(--eb-s-4), 72rem); }

.eb-muted { color: var(--eb-ink-3); }
.eb-mono { font-family: var(--eb-font-mono); }
.eb-num { font-variant-numeric: tabular-nums; }

/* top bar: app mark at the start, account and Sign out at the end ------------ */
.eb-topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--eb-s-3);
  min-block-size: var(--eb-topbar-h);
  padding-inline: var(--eb-s-4);
  color: var(--eb-ink);
  background: var(--eb-surface);
  background: color-mix(in srgb, var(--eb-surface) 88%, transparent);
  border-block-end: 1px solid var(--eb-border);
  backdrop-filter: saturate(1.4) blur(12px);
}
.eb-topbar__spacer { flex: 1; }

.eb-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--eb-s-2);
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}
.eb-brand__name { font-size: var(--eb-text-lg); letter-spacing: -0.01em; }
.eb-brand__suite { color: var(--eb-ink-3); font-size: var(--eb-text-sm); font-weight: 500; }

/* App mark: a rounded tile with the app's initial (or an icon). */
.eb-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  inline-size: 32px;
  block-size: 32px;
  border-radius: var(--eb-r-sm);
  color: #fff;
  background: var(--eb-brand-gradient);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
}
.eb-mark--lg {
  inline-size: 64px;
  block-size: 64px;
  border-radius: 55% 45% 58% 42% / 62% 48% 52% 38%;
  color: var(--eb-brand-deep);
  background: linear-gradient(145deg, #f0fdfa, #8cf0dc);
  font-size: 26px;
}

.eb-account {
  display: inline-flex;
  align-items: center;
  gap: var(--eb-s-2);
  color: var(--eb-ink-2);
  font-size: var(--eb-text-md);
}
.eb-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  inline-size: 30px;
  block-size: 30px;
  border-radius: 50%;
  color: var(--eb-accent);
  background: var(--eb-accent-soft);
  font-size: var(--eb-text-sm);
  font-weight: 700;
}

/* buttons ------------------------------------------------------------------- */
.eb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--eb-s-2);
  min-block-size: var(--eb-tap);
  padding: var(--eb-s-2) var(--eb-s-4);
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  color: var(--eb-ink);
  text-decoration: none;
  background: var(--eb-surface);
  border: 1px solid var(--eb-border-strong);
  border-radius: var(--eb-r-sm);
  cursor: pointer;
  transition: background var(--eb-dur-fast) var(--eb-ease), border-color var(--eb-dur-fast) var(--eb-ease);
}
.eb-btn:hover { background: var(--eb-surface-2); }
.eb-btn:disabled { cursor: not-allowed; opacity: 0.6; }
.eb-btn[aria-busy='true'] { cursor: wait; }

.eb-btn--primary {
  color: var(--eb-on-accent);
  background: var(--eb-accent);
  border-color: transparent;
}
.eb-btn--primary:hover { background: var(--eb-accent-hover); }

.eb-btn--ghost { background: transparent; border-color: transparent; color: var(--eb-ink-2); }
.eb-btn--ghost:hover { background: var(--eb-hover); color: var(--eb-ink); }

.eb-btn--danger { color: var(--eb-danger); border-color: var(--eb-danger); border-color: color-mix(in srgb, var(--eb-danger) 40%, transparent); }
.eb-btn--danger:hover { background: var(--eb-danger-soft); }

.eb-btn--sm { min-block-size: 34px; padding: var(--eb-s-1) var(--eb-s-3); font-size: var(--eb-text-md); }
.eb-btn--block { display: flex; inline-size: 100%; }

/* forms --------------------------------------------------------------------- */
.eb-field { display: block; margin-block-start: var(--eb-s-4); }
.eb-label {
  display: block;
  margin-block-end: var(--eb-s-1);
  color: var(--eb-ink-2);
  font-size: var(--eb-text-md);
  font-weight: 650;
}
.eb-hint { margin-block-start: var(--eb-s-1); color: var(--eb-ink-3); font-size: var(--eb-text-sm); }

.eb-input {
  display: block;
  inline-size: 100%;
  min-block-size: var(--eb-tap);
  padding: var(--eb-s-2) var(--eb-s-3);
  font: inherit;
  color: var(--eb-ink);
  background: var(--eb-surface);
  border: 1px solid var(--eb-border-strong);
  border-radius: var(--eb-r-sm);
  transition: border-color var(--eb-dur-fast) var(--eb-ease), box-shadow var(--eb-dur-fast) var(--eb-ease);
}
.eb-input::placeholder { color: var(--eb-ink-3); }
.eb-input:focus { outline: none; border-color: var(--eb-accent); box-shadow: 0 0 0 3px var(--eb-focus); }

/* surfaces ------------------------------------------------------------------ */
.eb-card {
  padding: var(--eb-s-6);
  color: var(--eb-ink);
  background: var(--eb-surface);
  border: 1px solid var(--eb-border);
  border-radius: var(--eb-r-lg);
  box-shadow: var(--eb-shadow-1);
}
.eb-card + .eb-card { margin-block-start: var(--eb-s-4); }
.eb-card__title { margin: 0 0 var(--eb-s-3); font-size: var(--eb-text-lg); font-weight: 700; }

.eb-notice {
  padding: var(--eb-s-3) var(--eb-s-4);
  border: 1px solid var(--eb-border);
  border-inline-start-width: 4px;
  border-radius: var(--eb-r-sm);
  background: var(--eb-surface-2);
  font-size: var(--eb-text-md);
}
.eb-notice--info { background: var(--eb-info-soft); border-color: color-mix(in srgb, var(--eb-info) 35%, transparent); border-inline-start-color: var(--eb-info); }
.eb-notice--ok { background: var(--eb-ok-soft); border-color: color-mix(in srgb, var(--eb-ok) 35%, transparent); border-inline-start-color: var(--eb-ok); }
.eb-notice--warn { background: var(--eb-warn-soft); border-color: color-mix(in srgb, var(--eb-warn) 35%, transparent); border-inline-start-color: var(--eb-warn); }
.eb-notice--danger { background: var(--eb-danger-soft); border-color: color-mix(in srgb, var(--eb-danger) 35%, transparent); border-inline-start-color: var(--eb-danger); }

.eb-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--eb-s-1);
  padding: 2px var(--eb-s-2);
  border-radius: var(--eb-r-pill);
  color: var(--eb-ink-2);
  background: var(--eb-surface-3);
  font-size: var(--eb-text-xs);
  font-weight: 650;
  white-space: nowrap;
}
.eb-badge--accent { color: var(--eb-accent); background: var(--eb-accent-soft); }
.eb-badge--ok { color: var(--eb-ok); background: var(--eb-ok-soft); }
.eb-badge--warn { color: var(--eb-warn); background: var(--eb-warn-soft); }
.eb-badge--danger { color: var(--eb-danger); background: var(--eb-danger-soft); }

/* lists of destinations (launcher, sidebars) -------------------------------- */
.eb-list { margin: 0; padding: 0; list-style: none; }
.eb-list__item {
  display: flex;
  align-items: center;
  gap: var(--eb-s-3);
  padding: var(--eb-s-3) var(--eb-s-4);
  color: inherit;
  text-decoration: none;
  border-radius: var(--eb-r-md);
}
a.eb-list__item:hover { background: var(--eb-hover); }
.eb-list__body { display: grid; min-inline-size: 0; }
.eb-list__title { font-weight: 700; }
.eb-list__meta { color: var(--eb-ink-3); font-size: var(--eb-text-sm); }

.eb-nav-item {
  display: flex;
  align-items: center;
  gap: var(--eb-s-3);
  min-block-size: 40px;
  padding-inline: var(--eb-s-3);
  color: var(--eb-ink-2);
  text-decoration: none;
  border-radius: var(--eb-r-sm);
}
.eb-nav-item:hover { color: var(--eb-ink); background: var(--eb-hover); }
.eb-nav-item[aria-current='page'] { color: var(--eb-accent); background: var(--eb-accent-soft); font-weight: 700; }

.eb-empty {
  display: grid;
  justify-items: center;
  gap: var(--eb-s-2);
  padding: var(--eb-s-10) var(--eb-s-4);
  color: var(--eb-ink-3);
  text-align: center;
  border: 1px dashed var(--eb-border-strong);
  border-radius: var(--eb-r-lg);
}

.eb-link { color: var(--eb-accent); text-underline-offset: 0.18em; }
.eb-link:hover { color: var(--eb-accent-hover); }

/* theme switch: Auto / Light / Dark, built by theme.js ------------------------ */
.eb-theme-switch {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--eb-border);
  border-radius: var(--eb-r-pill);
  background: var(--eb-surface-2);
  font-family: var(--eb-font);
  font-size: var(--eb-text-sm);
  line-height: 1.2;
}
.eb-theme-switch__option {
  display: inline-flex;
  align-items: center;
  gap: var(--eb-s-1);
  min-block-size: 30px;
  padding: var(--eb-s-1) var(--eb-s-2);
  color: var(--eb-ink-2);
  background: transparent;
  border: 0;
  border-radius: var(--eb-r-pill);
  font: inherit;
  cursor: pointer;
}
.eb-theme-switch__option:hover { color: var(--eb-ink); background: var(--eb-hover); }
.eb-theme-switch__option[aria-checked='true'] {
  color: var(--eb-accent);
  background: var(--eb-surface);
  box-shadow: var(--eb-shadow-1);
  font-weight: 650;
}
.eb-theme-switch__option:focus-visible { outline: 3px solid var(--eb-focus); outline-offset: 1px; }
.eb-theme-switch__icon { inline-size: 16px; block-size: 16px; flex: none; }
.eb-theme-switch--compact .eb-theme-switch__option { padding-inline: var(--eb-s-2); }
.eb-theme-switch--compact .eb-theme-switch__label {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .eb-page *, .eb-page *::before, .eb-page *::after { transition: none !important; animation: none !important; }
}
