/* ==========================================================================
   BHASNet Platform — dashboard chrome
   Reuses the theme's CSS custom properties where available (--bh-ink,
   --bh-red, etc.) with safe fallback values, so the dashboard inherits
   the marketing site's look without a hard dependency on the theme
   being active. If the BHASNet theme isn't active, these fallbacks
   keep the dashboard legible and on-brand on its own.
   ========================================================================== */

.bhap {
  --bhap-ink: var(--bh-ink, #0B0B0E);
  --bhap-paper: var(--bh-paper, #FFFFFF);
  --bhap-paper-dim: var(--bh-paper-dim, #F2F1EF);
  --bhap-red: var(--bh-red, #D7263D);
  --bhap-red-deep: var(--bh-red-deep, #A91930);
  --bhap-amber: var(--bh-amber, #E8A33D);
  --bhap-slate: var(--bh-slate, #5C6470);
  --bhap-line: var(--bh-line-dark, rgba(11,11,14,0.12));
  --bhap-font-display: var(--bh-font-display, 'Fraunces', Georgia, serif);
  --bhap-font-body: var(--bh-font-body, 'Inter', sans-serif);
  --bhap-font-mono: var(--bh-font-mono, 'IBM Plex Mono', monospace);

  font-family: var(--bhap-font-body);
  color: var(--bhap-ink);
  max-width: 1320px;
  margin-inline: auto;
  padding: clamp(0.5rem, 1.5vw, 1.5rem);
}

.bhap * { box-sizing: border-box; }
.bhap a { color: inherit; text-decoration: none; }
.bhap ul { list-style: none; margin: 0; padding: 0; }
.bhap h1, .bhap h2, .bhap h3, .bhap p { margin: 0; }
.bhap button { font-family: inherit; cursor: pointer; }

/* ---- Flash messages - compact, inline ---- */
.bhap-flash {
  background: var(--bhap-red);
  color: var(--bhap-paper);
  padding: 0.6rem 1rem;
  margin-bottom: 1rem;
  font-family: var(--bhap-font-mono);
  font-size: var(--bh-size-small, 0.875rem);
  border-radius: 2px;
}

/* ---- Shell layout ---- */
.bhap-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 880px) {
  .bhap-shell { grid-template-columns: 200px 1fr; align-items: start; }
}

/* ---- Sidebar - compact, dark, consistent ---- */
.bhap-sidebar {
  background: var(--bhap-ink);
  color: var(--bhap-paper);
  padding: 0.85rem 0.85rem 0.6rem;
  position: sticky;
  top: 1.5rem;
}

.bhap-sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.bhap-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bhap-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--bhap-font-display);
  font-weight: 600;
  font-size: var(--bh-size-small, 0.875rem);
  flex-shrink: 0;
}

.bhap-user-name {
  display: block;
  font-weight: 600;
  font-size: var(--bh-size-small, 0.875rem);
  line-height: 1.2;
}
.bhap-user-role {
  display: block;
  font-family: var(--bhap-font-mono);
  font-size: var(--bh-size-micro, 0.75rem);
  color: rgba(255,255,255,0.5);
  margin-top: 0.05rem;
}

.bhap-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.bhap-nav-link {
  display: block;
  padding: 0.4rem 0.6rem;
  font-family: var(--bhap-font-mono);
  font-size: var(--bh-size-small, 0.875rem);
  border-radius: 2px;
  border-left: 3px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.bhap-nav-link:hover {
  background: rgba(255,255,255,0.06);
}
.bhap-nav-link.is-active {
  background: rgba(215,38,61,0.15);
  border-left-color: var(--bhap-red);
  color: var(--bhap-paper);
}

.bhap-sidebar-foot {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.bhap-logout {
  color: rgba(255,255,255,0.5);
  font-size: var(--bh-size-small, 0.875rem);
  font-family: var(--bhap-font-mono);
  padding: 0.4rem 0.6rem;
  border-radius: 2px;
  transition: color 0.2s ease, background 0.2s ease;
}
.bhap-logout:hover {
  color: var(--bhap-paper);
  background: rgba(255,255,255,0.06);
}

.bhap-main {
  min-width: 0;
  padding-top: 0.25rem;
}

/* ---- Shared content patterns - consistent with public pages ---- */
.bhap-page-title {
  font-family: var(--bhap-font-display);
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.bhap-page-sub {
  color: var(--bhap-slate);
  font-size: var(--bh-size-body, 1.0625rem);
  margin-bottom: 1.25rem;
  max-width: 56ch;
}

.bhap-empty {
  border: 1px solid var(--bhap-line);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--bhap-slate);
  border-radius: 2px;
}
.bhap-empty strong {
  display: block;
  color: var(--bhap-ink);
  margin-bottom: 0.4rem;
  font-size: 1.1rem;
  font-family: var(--bhap-font-display);
}

/* ---- Cards - same as public pages ---- */
.bhap-card {
  border: 1px solid var(--bhap-line);
  padding: 0.85rem 1.1rem;
  margin-bottom: 0.6rem;
  border-radius: 2px;
  background: var(--bhap-paper);
  transition: border-color 0.2s ease;
}
.bhap-card:hover {
  border-color: var(--bhap-slate);
}
.bhap-card-title {
  font-family: var(--bhap-font-display);
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.15rem;
}
.bhap-card-title a {
  color: var(--bhap-red);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.bhap-card-title a:hover {
  border-bottom-color: var(--bhap-red);
}
.bhap-card-meta {
  font-family: var(--bhap-font-mono);
  font-size: var(--bh-size-micro, 0.75rem);
  color: var(--bhap-red);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}
.bhap-card-body {
  color: var(--bhap-slate);
  font-size: var(--bh-size-small, 0.875rem);
  line-height: 1.5;
}
.bhap-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

/* ---- Inline form error box ---- */
.bhap-error-box {
  border: 1px solid var(--bhap-red);
  background: rgba(215, 38, 61, 0.06);
  color: var(--bhap-ink);
  padding: 0.6rem 0.9rem;
  font-size: var(--bh-size-small, 0.875rem);
  margin-bottom: 1rem;
  border-radius: 2px;
}

/* ---- Buttons - compact, consistent with public pages ---- */
.bhap-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--bhap-font-mono);
  font-size: var(--bh-size-small, 0.875rem);
  letter-spacing: 0.02em;
  padding: 0.45rem 1.1rem;
  border: 1px solid var(--bhap-ink);
  background: var(--bhap-ink);
  color: var(--bhap-paper);
  border-radius: 2px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  cursor: pointer;
  text-decoration: none;
}
.bhap-btn:hover {
  background: var(--bhap-red);
  border-color: var(--bhap-red);
}
.bhap-btn--ghost {
  background: transparent;
  color: var(--bhap-ink);
}
.bhap-btn--ghost:hover {
  background: var(--bhap-ink);
  color: var(--bhap-paper);
}
.bhap-btn--full {
  width: 100%;
  justify-content: center;
}
.bhap-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Forms - compact, consistent with public pages ---- */
.bhap-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.bhap-field label {
  font-family: var(--bhap-font-mono);
  font-size: var(--bh-size-micro, 0.75rem);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bhap-slate);
}
.bhap-field input,
.bhap-field textarea,
.bhap-field select {
  font-family: var(--bhap-font-body);
  font-size: var(--bh-size-body, 1.0625rem);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--bhap-line);
  background: var(--bhap-paper);
  color: var(--bhap-ink);
  border-radius: 2px;
  width: 100%;
  transition: border-color 0.2s ease;
}
.bhap-field input:focus-visible,
.bhap-field textarea:focus-visible,
.bhap-field select:focus-visible {
  outline: 2px solid var(--bhap-red);
  outline-offset: 2px;
}
.bhap-field textarea {
  min-height: 100px;
  resize: vertical;
}
.bhap-field-hint {
  font-size: var(--bh-size-small, 0.875rem);
  color: var(--bhap-slate);
  margin-top: 0.1rem;
}

/* ---- Choice grid (for profile form) ---- */
.bhap-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}
.bhap-choice-card {
  position: relative;
  border: 1px solid var(--bhap-line);
  padding: 0.5rem 0.7rem;
  border-radius: 2px;
  font-size: var(--bh-size-small, 0.875rem);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.bhap-choice-card input {
  position: absolute;
  opacity: 0;
}
.bhap-choice-card:has(input:checked) {
  border-color: var(--bhap-red);
  background: rgba(215,38,61,0.04);
}

/* ---- Auth screens (login/register/forgot-password) - compact ---- */
.bhap-auth {
  max-width: 400px;
  margin-inline: auto;
  padding-block: clamp(0.5rem, 2vw, 1.5rem);
}
.bhap-auth-eyebrow {
  font-family: var(--bhap-font-mono);
  font-size: var(--bh-size-micro, 0.75rem);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--bhap-red);
  display: block;
  margin-bottom: 0.3rem;
}
.bhap-auth h1 {
  font-family: var(--bhap-font-display);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 600;
  margin-bottom: 1rem;
  line-height: 1.2;
}
.bhap-auth-foot {
  margin-top: 1rem;
  font-size: var(--bh-size-small, 0.875rem);
  color: var(--bhap-slate);
  text-align: center;
}
.bhap-auth-foot a {
  color: var(--bhap-red);
  border-bottom: 1px solid var(--bhap-red);
}
.bhap-auth h2 {
  font-family: var(--bhap-font-display);
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 600;
  margin-bottom: 1rem;
  line-height: 1.2;
}

/* ---- Dashboard empty state CTAs - consistent with public ---- */
.bhap-empty-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1rem;
}
.bhap-empty-actions .bhap-btn {
  font-size: var(--bh-size-small, 0.875rem);
  padding: 0.35rem 1rem;
}

/* ---- Loading state during SPA navigation ---- */
.bhap[data-loading] .bhap-main {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

/* ---- Responsive adjustments ---- */
@media (max-width: 880px) {
  .bhap {
    padding: 0.5rem 0.75rem;
  }
  .bhap-sidebar {
    padding: 0.6rem 0.6rem 0.4rem;
    position: relative;
    top: 0;
    margin-bottom: 0.75rem;
  }
  .bhap-shell {
    gap: 0.75rem;
  }
  .bhap-sidebar-user {
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
  }
  .bhap-avatar {
    width: 28px;
    height: 28px;
    font-size: var(--bh-size-micro, 0.75rem);
  }
  .bhap-user-name {
    font-size: var(--bh-size-small, 0.875rem);
  }
  .bhap-nav-link {
    padding: 0.3rem 0.5rem;
    font-size: var(--bh-size-micro, 0.75rem);
  }
  .bhap-logout {
    font-size: var(--bh-size-micro, 0.75rem);
    padding: 0.3rem 0.5rem;
  }
  .bhap-card {
    padding: 0.6rem 0.75rem;
  }
  .bhap-card-title {
    font-size: 0.95rem;
  }
  .bhap-field input,
  .bhap-field textarea,
  .bhap-field select {
    font-size: var(--bh-size-small, 0.875rem);
    padding: 0.4rem 0.6rem;
  }
}

@media (max-width: 480px) {
  .bhap {
    padding: 0.35rem 0.5rem;
  }
  .bhap-card {
    padding: 0.5rem 0.6rem;
  }
  .bhap-card-title {
    font-size: 0.9rem;
  }
  .bhap-page-title {
    font-size: 1.3rem;
  }
  .bhap-btn {
    font-size: var(--bh-size-micro, 0.75rem);
    padding: 0.3rem 0.7rem;
  }
  .bhap-empty {
    padding: 1.5rem 1rem;
  }
}

