@import url('https://fonts.googleapis.com/css2?family=Gentium+Plus:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* ── Colour palette ── */

:root {
  color-scheme: light dark;

  /* Page backgrounds */
  --bg:               #f5f6fa;
  --surface:          #fff;
  --surface-tint:     #f0f0f8;   /* subtle tinted surface, gloss bg, etc. */
  --surface-input:    #f8f8fc;   /* text input background */
  --surface-readonly: #e8e8f0;   /* readonly / disabled inputs */

  /* Borders */
  --border:        #d8dae8;   /* main card / section border */
  --border-subtle: #c8c8e8;   /* input / button borders */
  --border-row:    #e8e8f0;   /* table row dividers */
  --border-faint:  #eeeef6;   /* very subtle dividers */

  /* Brand — fixed colours used as solid backgrounds (table headers, avatar) */
  --brand-navy:        #082b6b;
  --brand-accent:      #6262ba;
  --brand-accent-hover:#8080c8;

  /* Adaptive foreground colours */
  --primary:   #082b6b;   /* headings, links, emphasis */
  --secondary: #4a4ab0;   /* secondary links / labels */

  /* Text */
  --text:       #222;
  --text-label: #444;
  --text-muted: #666;
  --text-faint: #888;

  /* Status */
  --success:              #2d7d2d;
  --success-surface:      #edf5ed;
  --success-surface-hover:#d6ebd6;
  --danger:               #c0392b;

  /* Hover surfaces */
  --hover-surface:      #ededf8;
  --hover-surface-tint: #e0e0f4;
  --hover-table-row:    #f0f0f8;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:               #111827;
    --surface:          #1f2937;
    --surface-tint:     #374151;
    --surface-input:    #283548;
    --surface-readonly: #374151;

    --border:        #374151;
    --border-subtle: #4b5563;
    --border-row:    #2d3748;
    --border-faint:  #2d3748;

    /* brand-navy and brand-accent stay fixed */

    --primary:   #93c5fd;
    --secondary: #a5b4fc;

    --text:       #f9fafb;
    --text-label: #d1d5db;
    --text-muted: #9ca3af;
    --text-faint: #6b7280;

    --success:              #4ade80;
    --success-surface:      #14532d;
    --success-surface-hover:#166534;
    --danger:               #f87171;

    --hover-surface:      #374151;
    --hover-surface-tint: #4b5563;
    --hover-table-row:    #2d3748;
  }
}

/* ── Base ── */

html {
  font-family: Arial, Helvetica sans-serif;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
}

h3 {
  margin: 10px;
  font-size: 14pt;
}

/* ── Title bar ── */

#TitleBar {
  margin-left: 10%;
  margin-right: 10%;
  display: flex;
  align-items: center;
  padding: 8px 0;
  position: relative;
}

#TitleProgramName {
  color: var(--primary);
  font-family: 'Gentium Plus', serif;
  font-size: 32px;
  font-weight: normal;
  user-select: none;
  text-decoration: none;
}

#PageTitle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--primary);
  font-family: 'Gentium Plus', serif;
  font-size: 18px;
  font-weight: normal;
  font-style: italic;
  user-select: none;
}

#UserProfile {
  margin-left: auto;
  margin-right: 20px;
  display: flex;
  align-items: center;
  position: relative;
  user-select: none;
}

#UserProfile #Avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--brand-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

#UserProfile #Avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#AvatarPlaceholder {
  color: #fff;
  font: bold 14pt Arial;
  line-height: 1;
  user-select: none;
}

#UserSettings {
  float: right;
  margin-left: 10px;
  user-select:none;
}

#ReturnToChooser {
  margin-left: auto;
  font-size: 0.85em;
  color: var(--secondary);
  text-decoration: none;
  border: 1.5px solid var(--border-subtle);
  border-radius: 16px;
  padding: 4px 14px;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

#ReturnToChooser:hover {
  background-color: var(--hover-surface);
  color: var(--primary);
}

#PageTitle {
  line-height: 30px;
  margin-left: auto;
  margin-right: auto;
  font:  bold 20px Arial;
  user-select: none;
}

/* ── Mobile title bar ── */

@media (max-width: 600px) {
  #TitleBar {
    flex-direction: column;
    align-items: center;
    margin-left: 0;
    margin-right: 0;
    padding: 10px 0 6px;
    gap: 2px;
  }

  #TitleProgramName {
    font-size: 40px;
  }

  #PageTitle {
    position: static;
    transform: none;
    font-size: 16px;
    line-height: 1.4;
  }

  #ReturnToChooser {
    display: none;
  }

  #UserProfile {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    margin: 0;
  }
}
