/* app.css: PER APP (parity-fleet.sh declares it per-app). This app's own classes, linked after base.css. Name them
   with the app's prefix so a shared class is never redefined per app, and colour them with the brand variables or
   neutrals only (a community's colour replaces the brand variables on its pages, membership PRD §6i.1). */

/* Declared on body too: an alias of a brand variable resolves where it is declared, so on :root alone it kept the
   app's colour after a community's colour re-set --brand on body (PRD §6i.1). */
:root, body {
  --color-primary: var(--brand);
  --color-secondary: #F97316;
  --color-bg: #ffffff;
  --color-surface: #f8f9fa;
  --color-text: #212529;
  --color-text-muted: #6c757d;
  --color-border: #dee2e6;
  --color-success: #198754;
  --color-warning: #ffc107;
  --color-danger: #dc3545;
}

[data-bs-theme="dark"], [data-bs-theme="dark"] body {
  --color-primary: var(--brand-bright);
  --color-secondary: #FB923C;
  --color-bg: #1a1a2e;
  --color-surface: #16213e;
  --color-text: #e9ecef;
  --color-text-muted: #adb5bd;
  --color-border: #495057;
  --color-success: #20c997;
  --color-warning: #ffc107;
  --color-danger: #f87171;
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: #15803D;
  --bs-btn-hover-border-color: #15803D;
  --bs-btn-active-bg: #166534;
  --bs-btn-active-border-color: #166534;
  --bs-btn-disabled-bg: var(--brand);
  --bs-btn-disabled-border-color: var(--brand);
}

[data-bs-theme="dark"] a.btn-primary,
[data-bs-theme="dark"] button.btn-primary,
[data-bs-theme="dark"] .btn.btn-primary {
  color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-primary .btn-outline-light,
[data-bs-theme="dark"] .bg-gradient .btn-outline-light,
[data-bs-theme="dark"] section.bg-primary .btn-outline-light {
  --bs-btn-color: #ffffff;
  --bs-btn-border-color: rgba(255, 255, 255, 0.6);
  --bs-btn-hover-bg: rgba(255, 255, 255, 0.15);
  --bs-btn-hover-border-color: #ffffff;
  --bs-btn-hover-color: #ffffff;
  color: #ffffff !important;
}

[data-bs-theme="dark"] .bg-primary .btn-light,
[data-bs-theme="dark"] .bg-gradient .btn-light {
  --bs-btn-bg: #ffffff;
  --bs-btn-color: #1e1f22;
  --bs-btn-border-color: #ffffff;
  --bs-btn-hover-bg: #e3e5e8;
  --bs-btn-hover-color: #1e1f22;
}

[data-bs-theme="dark"] section.bg-light,
[data-bs-theme="dark"] .py-5.bg-light,
[data-bs-theme="dark"] .bg-light.rounded,
[data-bs-theme="dark"] .bg-light.rounded-4 {
  background-color: #2b2d31 !important;
}

[data-bs-theme="dark"] .blockquote.bg-light {
  background-color: #35373c !important;
}

[data-bs-theme="dark"] .card.bg-light[role="img"],
[data-bs-theme="dark"] .card.bg-light[role="img"] .card-body {
  background-color: #2b2d31 !important;
  color: #e3e5e8 !important;
  border: 1px solid #3a3c41 !important;
}

[data-bs-theme="dark"] .card.bg-light[role="img"] h6,
[data-bs-theme="dark"] .card.bg-light[role="img"] small,
[data-bs-theme="dark"] .card.bg-light[role="img"] .fw-semibold {
  color: #e3e5e8 !important;
}

[data-bs-theme="dark"] .card.bg-light[role="img"] .text-muted {
  color: #9e9e9e !important;
}

[data-bs-theme="dark"] .card.bg-light[role="img"] .list-group-item {
  background-color: transparent !important;
  color: #e3e5e8 !important;
  border-color: #3a3c41 !important;
}

[data-bs-theme="dark"] .card.bg-light[role="img"] .bg-white {
  background-color: #35373c !important;
  color: #e3e5e8 !important;
}

[data-bs-theme="dark"] .card.bg-light[role="img"] .bg-white small,
[data-bs-theme="dark"] .card.bg-light[role="img"] .bg-white .fw-semibold,
[data-bs-theme="dark"] .card.bg-light[role="img"] .bg-white .text-muted {
  color: #b0b3b8 !important;
}

[data-bs-theme="dark"] .card.bg-light[role="img"] .badge.bg-primary,
[data-bs-theme="dark"] .card.bg-light[role="img"] .badge.bg-success,
[data-bs-theme="dark"] .card.bg-light[role="img"] .badge.bg-info,
[data-bs-theme="dark"] .card.bg-light[role="img"] .badge.bg-secondary {
  color: #ffffff !important;
}

[data-bs-theme="dark"] .card.bg-light[role="img"] .badge.bg-warning {
  color: #212529 !important;
}

[data-bs-theme="dark"] .card.bg-light:not([role="img"]) {
  background-color: #2b2d31 !important;
}

a {
  color: var(--color-primary);
}

a:hover {
  color: var(--bs-link-hover-color);
}

[data-bs-theme="dark"] a {
  color: var(--brand-bright);
}

[data-bs-theme="dark"] a:hover {
  color: var(--bs-link-hover-color);
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
  background-color: #2b2d31;
  color: #e3e5e8;
  border-color: #2196f3;
  box-shadow: 0 0 0 0.25rem rgba(33, 150, 243, 0.25);
}

.sidebar {
  flex-shrink: 0; 
  width: 300px;
  background-color: var(--bs-gray-50);
  border-right: 1px solid var(--bs-border-color);
  height: calc(100vh - 56px); 
  position: sticky;
  top: 56px;
}

.editor-wrapper:focus-within {
  border-color: #7BA3F0 !important;
  outline: 0 !important;
  box-shadow: 0 0 0 0.25rem rgba(46, 97, 224, 0.25) !important;
}

[data-bs-theme="dark"] .editor-wrapper:focus-within {
  border-color: #4B7BF5 !important;
  box-shadow: 0 0 0 0.25rem rgba(75, 123, 245, 0.25) !important;
}
