/* === Murikual shared admin styles (loaded globally by App.razor) === */

/* Flat, non-sticky page header: a transparent inline title block. Page padding
   is owned by .main-content (base.css), so the header only needs its own bottom
   gap. This is the platform-wide header style (overrides base.css's card header). */
.content-header {
    background: transparent;
    border-bottom: none;
    padding: 0;
    position: static;
    margin-bottom: 1.5rem;
}

.content-header h1 {
    font-size: 1.5rem;
    margin: 0 0 0.25rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.breadcrumb {
    margin-top: 0.25rem;
}

.breadcrumb .separator {
    margin: 0 0.375rem;
    color: var(--border);
}

/* Identity-specific sidebar footer */
.logout-btn {
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}

/* Identity button extras */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--content-bg);
    color: var(--text);
}

.btn-danger {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

/* Success alert (Identity-specific) */
.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}


/* Recommended badge */
.badge-recommended {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 4px;
    padding: 0.0625rem 0.375rem;
    margin-left: 0.375rem;
    vertical-align: middle;
    line-height: 1.4;
}

/* Section description text */
.section-desc {
    color: var(--text-secondary);
    font-size: 0.8125rem;
    margin: -0.25rem 0 0.75rem;
    line-height: 1.5;
}

/* Audit log event badges */
.badge-event {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    line-height: 1.4;
    white-space: nowrap;
}

/* Token-driven so the configurable palette (and its dark ramps) flow through. */
.badge-success {
    color: var(--green-700);
    background: var(--green-50);
    border: 1px solid var(--green-500);
}

.badge-danger {
    color: var(--red-700);
    background: var(--red-50);
    border: 1px solid var(--red-200);
}

.badge-warning {
    color: var(--yellow-700);
    background: var(--yellow-50);
    border: 1px solid var(--yellow-100);
}

.badge-info {
    color: var(--blue-700);
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
}

/* ======================== FORM ROW (stacked label/input) ======================== */
/* Shared stacked-form pattern — used by Identity and any other module with admin forms */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="password"],
.form-row input[type="url"],
.form-row input[type="number"],
.form-row input[type="datetime-local"],
.form-row select,
.form-row textarea {
    appearance: none;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    /* Theme-aware surface — was a hardcoded #fff, which put light text on a white
       field (unreadable) in dark mode. */
    background: var(--card-bg);
    font-size: var(--text-base);
    color: var(--text);
    font-family: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ======================== SUBNAV (tab-row for sub-page navigation) ======================== */
/* Used wherever a horizontal tab strip is needed (Realm detail, Account portal, etc.) */
.subnav {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.subnav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding-bottom: 0.375rem;
    border-bottom: 2px solid transparent;
    transition: color 0.15s ease;
}

.subnav a:hover { color: var(--text); }

.subnav a.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Field hint text — short explanatory copy under form inputs. */
.field-hint {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.field-hint code {
  background: var(--gray-100, #f3f4f6);
  padding: 0.0625rem 0.25rem;
  border-radius: 3px;
  font-size: 0.6875rem;
}

/* "Recommended:" callout inside a field hint or info banner. */
.field-hint .recommended,
.info-banner .recommended {
  color: var(--green-700, #047857);
  font-weight: 600;
}

/* Info / explainer banner inside a card body — used to introduce a setting page. */
.info-banner {
  background: var(--blue-50, #eff6ff);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.8125rem;
  color: var(--text);
}
.info-banner strong { color: var(--accent); }

/* Inline form-actions row */
.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.25rem;
  align-items: center;
}

/* Status pill */
.status-pill {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-pill.status-active { background: var(--green-50, #ecfdf5); color: var(--green-700, #047857); }
.status-pill.status-suspended { background: var(--yellow-100, #fef3c7); color: var(--yellow-700, #b45309); }

/* ======================== BADGE: muted + dark mode ========================
   badge-muted lives here (not identity.css) so admin pages migrated into the
   platform shell get it. The status badge-* classes (success/danger/warning/
   info) are now driven by the palette tokens, whose dark ramps flow from
   ThemeCssBuilder — so they need no per-class dark override. badge-muted /
   badge-proxy / badge-static / status-pill are not palette-driven, so they keep
   explicit gray/dark overrides. */
.badge-muted { color: var(--gray-600); background: var(--gray-100); border: 1px solid var(--gray-200); }

[data-theme="dark"] .badge-proxy   { color: #93c5fd; background: #11243f; }
[data-theme="dark"] .badge-static  { color: #6ee7b7; background: #0d2a1e; }

@media (prefers-color-scheme: dark) {
    [data-theme="system"] .badge-proxy   { color: #93c5fd; background: #11243f; }
    [data-theme="system"] .badge-static  { color: #6ee7b7; background: #0d2a1e; }
}

/* ======================== REALM DETAIL (migrated to platform shell) ========
   The realm-detail hub (RealmDetail.razor + its panels) renders under the
   platform shell, which loads base.css + app.css but NOT the module's
   identity.css. These classes (manage tiles, branding two-column, tab nav,
   test-user row controls, config grid) were moved here so the migrated page is
   styled identically to MurikualHost in both light and dark mode. All colors
   are design tokens — surface/border/text tokens already flip with the theme,
   so no separate dark-mode block is needed. */

/* Manage tiles (Realm overview). */
.manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.manage-tile {
  display: block;
  padding: 1rem 1.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.manage-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08);
  text-decoration: none;
  color: var(--text);
}
.manage-tile-label {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin: 0 0 0.25rem;
}
.manage-tile-hint {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  margin: 0;
}

/* Realm branding two-column layout. */
.branding-grid {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}
.branding-grid-col {
  flex: 1;
  min-width: 280px;
}
.branding-preview-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 100%;
  height: 420px;
}

/* Tab nav (realm sections). */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--gray-200);
  margin: 1rem 0;
  flex-wrap: wrap;
}
.tab {
  padding: 0.5rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tab:hover {
  color: var(--accent);
  text-decoration: none;
}
.tab--active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Test-user binding row controls (Realm > Test users tab). */
.tu-reorder {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  vertical-align: middle;
}
.tu-reorder button {
  appearance: none;
  background: none;
  border: 1px solid transparent;
  border-radius: .25rem;
  width: 1.5rem;
  height: 1.125rem;
  padding: 0;
  cursor: pointer;
  font-size: .75rem;
  line-height: 1;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tu-reorder button:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--text);
  border-color: var(--border);
}
.tu-reorder button:disabled { opacity: .35; cursor: default; }

.tu-label-form {
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  max-width: 18rem;
  width: 100%;
}
.tu-label-form input[type="text"],
.tu-label-form input.form-control {
  flex: 1 1 auto;
  min-width: 0;
  padding: .375rem .5rem;
  font-size: .875rem;
  border: 1px solid var(--border);
  border-right: none;
  border-radius: .25rem 0 0 .25rem;
  background: var(--card-bg);
  color: var(--text);
  line-height: 1.3;
}
.tu-label-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring, rgba(37, 99, 235, .15));
  position: relative;
  z-index: 1;
}
.tu-label-form button {
  appearance: none;
  padding: .375rem .625rem;
  font-size: .75rem;
  font-weight: 500;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 0 .25rem .25rem 0;
  cursor: pointer;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
}
.tu-label-form button:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Configuration grid (read-only label/value pairs). */
.config-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  padding: 1rem 1.25rem;
  align-items: baseline;
}
.config-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}
.config-value {
  font-size: 0.875rem;
  color: var(--text);
  min-width: 0;
  overflow-wrap: anywhere;
}
.config-value code {
  font-size: 0.8125rem;
}

/* ─── Danger zone (Delete / Retire / Rotate confirm cards) ─────────────────── */
.danger-card {
  background: var(--red-50);
  border: 1px solid var(--red-200);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.danger-card h2 {
  color: var(--red-700);
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
}
.danger-card ul {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
  color: var(--red-700);
}

/* Action bar at the foot of confirm/edit forms. */
.actions-bar {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  align-items: center;
}

/* ─── Row actions (per-row mini buttons in admin tables) ───────────────────── */
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  align-items: center;
  justify-content: flex-end;
}
.row-actions .btn-mini,
.row-actions a.btn-mini,
.btn-mini {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  line-height: 1.2;
  cursor: pointer;
  display: inline-block;
  /* Keep each button's own label intact; the container (flex-wrap) reflows
     buttons onto extra lines instead of overflowing the row's rounded edge. */
  white-space: nowrap;
}
.row-actions .btn-mini:hover,
.btn-mini:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.row-actions .btn-danger.btn-mini,
.btn-danger.btn-mini {
  background: var(--red-50);
  color: var(--red-700);
  border-color: var(--red-200);
}
.row-actions .btn-danger.btn-mini:hover,
.btn-danger.btn-mini:hover {
  background: var(--red-600);
  color: #fff;
  border-color: var(--red-700);
}

/* Inline checkbox label (checkbox + text on one line) used by the admin forms. */
.form-label-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

/* One-time secret / generated value block — monospace, selectable, token-themed. */
.secret-block {
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin: 0.5rem 0 0;
  user-select: all;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}

/* Monospace textarea/input for URI / scope lists. */
.mono-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}

/* Checkbox list (role assignment etc.) — moved from identity.css so it themes
   in the shared shell which only loads base.css + app.css. */
.checkbox-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
}
.checkbox-row + .checkbox-row { border-top: 1px solid var(--border); }
.checkbox-row:hover { background: var(--gray-50); }
.checkbox-row input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin: 0;
}
.checkbox-row label {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  margin: 0;
  cursor: pointer;
  min-width: 0;
}
.checkbox-row-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

/* A checkbox or radio with its label on one line. Lives here rather than in a component's scoped
   CSS because scoped styles apply only to the component that declares them: the Mac agent had this
   in one page's file and used it from two, so the second one rendered unstyled. A form control used
   by more than one component belongs to the design system. */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.form-check span {
    color: var(--text-secondary);
    font-size: var(--text-sm);
}
