/*
 * SPDX-FileCopyrightText: 2026 FinTag Uganda
 * SPDX-License-Identifier: LicenseRef-MediRec-Proprietary
 * See LICENSE in the repository root for the complete terms.
 */

/* Only screen palettes change; printed clinical and financial documents keep their styling. */
/* Classic Blue uses app.css defaults. Additional IDs match services/theme_service.py. */
@media screen {
  :root[data-theme="teal"] {
    --bg: #edf5f3;
    --surface-border: #cdded9;
    --text: #204b45;
    --muted: #526f69;
    --primary: #146b60;
    --primary-dark: #10554d;
    --surface-soft: #f4faf8;
    --theme-canvas: #edf5f3;
    --theme-soft: #f4faf8;
    --theme-heading: #164e46;
    --theme-heading-border: #103d36;
    --theme-button: #146b60;
    --theme-button-hover: #10554d;
    --theme-border: #cdded9;
  }

  :root[data-theme="violet"] {
    --bg: #f3f0f8;
    --surface-border: #ded4ea;
    --text: #46305e;
    --muted: #756285;
    --primary: #74469b;
    --primary-dark: #5d347f;
    --surface-soft: #faf7fd;
    --theme-canvas: #f3f0f8;
    --theme-soft: #faf7fd;
    --theme-heading: #51316d;
    --theme-heading-border: #3f2456;
    --theme-button: #74469b;
    --theme-button-hover: #5d347f;
    --theme-border: #ded4ea;
  }

  :root[data-theme="forest"] {
    --bg: #f0f5ec;
    --surface-border: #d3dfcc;
    --text: #30492d;
    --muted: #61745a;
    --primary: #3f6d32;
    --primary-dark: #305426;
    --surface-soft: #f7faf4;
    --theme-canvas: #f0f5ec;
    --theme-soft: #f7faf4;
    --theme-heading: #2f4f28;
    --theme-heading-border: #243e1f;
    --theme-button: #3f6d32;
    --theme-button-hover: #305426;
    --theme-border: #d3dfcc;
  }

  :root[data-theme="rose"] {
    --bg: #faf0f3;
    --surface-border: #ead3dc;
    --text: #63374a;
    --muted: #856372;
    --primary: #a13f63;
    --primary-dark: #82314f;
    --surface-soft: #fdf7f9;
    --theme-canvas: #faf0f3;
    --theme-soft: #fdf7f9;
    --theme-heading: #733149;
    --theme-heading-border: #5a2639;
    --theme-button: #a13f63;
    --theme-button-hover: #82314f;
    --theme-border: #ead3dc;
  }

  :root[data-theme="amber"] {
    --bg: #faf4e9;
    --surface-border: #e7d9bd;
    --text: #594326;
    --muted: #7c6a4b;
    --primary: #875b18;
    --primary-dark: #6c4710;
    --surface-soft: #fdfaf3;
    --theme-canvas: #faf4e9;
    --theme-soft: #fdfaf3;
    --theme-heading: #654719;
    --theme-heading-border: #503712;
    --theme-button: #875b18;
    --theme-button-hover: #6c4710;
    --theme-border: #e7d9bd;
  }

  :root[data-theme="slate"] {
    --bg: #f1f4f6;
    --surface-border: #d5dde3;
    --text: #344451;
    --muted: #647580;
    --primary: #4b6273;
    --primary-dark: #394c5b;
    --surface-soft: #f8fafb;
    --theme-canvas: #f1f4f6;
    --theme-soft: #f8fafb;
    --theme-heading: #354957;
    --theme-heading-border: #293a46;
    --theme-button: #4b6273;
    --theme-button-hover: #394c5b;
    --theme-border: #d5dde3;
  }

  /* Reference-inspired clinical palette: neutral chrome, green actions and blue links. */
  :root[data-theme="clinical"] {
    --bg: #f4f6f3;
    --surface-border: #d9dfd8;
    --text: #333c39;
    --muted: #626f66;
    --primary: #276982;
    --primary-dark: #406d31;
    --accent: #78a94f;
    --surface-soft: #f8faf6;
    --theme-canvas: #f4f6f3;
    --theme-soft: #f8faf6;
    --theme-heading: #2d3f4b;
    --theme-heading-border: #23333e;
    --theme-button: #467b32;
    --theme-button-hover: #376326;
    --theme-border: #d9dfd8;
  }

  :root[data-theme="clinical"] .brand-mark,
  :root[data-theme="clinical"] .topnav-link.active {
    background: var(--theme-button);
    border-color: var(--theme-button);
    color: #ffffff;
  }

  :root[data-theme="clinical"] .topnav-link.active {
    box-shadow: none;
  }

  :root[data-theme="clinical"] .topnav-menu {
    background: var(--surface);
    border-color: var(--surface-border);
  }

  :root[data-theme="clinical"] .page-content > .section-head :is(h1, h2),
  :root[data-theme="clinical"] .card-body > :is(h2, h3) {
    color: var(--primary-dark);
  }

  :root[data-theme="clinical"] .table th {
    background: #edf0eb;
    color: var(--text);
    border-color: var(--surface-border);
  }

  :root[data-theme="clinical"] .table th[aria-sort="ascending"],
  :root[data-theme="clinical"] .table th[aria-sort="descending"] {
    background: #e5eddc;
    box-shadow: inset 0 -2px 0 var(--theme-button);
  }

  :root[data-theme="clinical"] .button-link-secondary:hover,
  :root[data-theme="clinical"] .button-link-secondary:focus-visible {
    background: #edf2e8;
    border-color: #9eb58e;
  }
}

.profile-header {
  flex-wrap: wrap;
}

.theme-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  flex: 0 1 370px;
  max-width: 100%;
}

.theme-field {
  display: grid;
  gap: 0.4rem;
  flex: 1 1 160px;
  min-width: 0;
  max-width: 100%;
}

.theme-form button {
  width: auto;
  margin: 0;
}
