/* ClubMeet Hub theme - Toastmasters Brand Manual v2.0 colours and type, on top of Bootstrap 5.3.
 *
 * How it works (beginner notes):
 *  - Bootstrap 5.3 switches colour sets with <html data-bs-theme="light|dark">.
 *  - Below we set our own "tokens" (--tm-*) for each mode, then point Bootstrap's variables at them.
 *  - Brand colours: Loyal Blue #004165, True Maroon #772432, Cool Gray #A9B2B1,
 *    Happy Yellow #F2DF74; approved gradient partner Blissful Blue #006094; Fair Gray #F5F5F5.
 *  - Fonts are self-hosted (the security policy allows only local files).
 */

/* ---- Fonts: Montserrat (headings, stands in for Gotham) and Source Sans 3 (body) ---- */
@font-face {
  font-family: "Montserrat";
  src: url("/static/fonts/Montserrat-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Source Sans 3";
  src: url("/static/fonts/SourceSans3-latin-wght.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

/* ---- Light mode tokens ---- */
:root,
[data-bs-theme="light"] {
  --tm-blue: #004165;
  --tm-blue-light: #006094;
  --tm-maroon: #772432;
  --tm-gray: #a9b2b1;
  --tm-yellow: #f2df74;

  --tm-page: #f5f5f5;          /* Fair Gray */
  --tm-surface: #ffffff;
  --tm-text: #1b2830;
  --tm-muted: #52606a;
  --tm-border: #d5dbda;
  --tm-heading: #004165;
  --tm-link: #004165;
  --tm-link-hover: #006094;
  --tm-primary: #004165;
  --tm-primary-hover: #006094;
  --tm-focus: #006094;
  --tm-th-bg: #e9eeee;
  --tm-signal-green: #1e7a46;
  --tm-signal-yellow: #d9a400;
  --tm-signal-red: #b3261e;
}

/* ---- Dark mode tokens (same brand colours, lifted for contrast) ---- */
[data-bs-theme="dark"] {
  --tm-page: #0e1a22;
  --tm-surface: #15262f;
  --tm-text: #e8eef0;
  --tm-muted: #a9b2b1;         /* Cool Gray */
  --tm-border: #2b4150;
  --tm-heading: #ffffff;
  --tm-link: #8fc7ea;
  --tm-link-hover: #f2df74;    /* Happy Yellow */
  --tm-primary: #006094;       /* Blissful Blue */
  --tm-primary-hover: #0a77b3;
  --tm-focus: #f2df74;
  --tm-th-bg: #1d3340;
  --tm-signal-green: #3fb27a;
  --tm-signal-yellow: #f2c230;
  --tm-signal-red: #ef6b62;
}

/* ---- Point Bootstrap at the tokens ---- */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-body-font-family: "Source Sans 3", "Segoe UI", Arial, sans-serif;
  --bs-body-font-size: 1.0625rem;
  --bs-body-bg: var(--tm-page);
  --bs-body-color: var(--tm-text);
  --bs-secondary-color: var(--tm-muted);
  --bs-border-color: var(--tm-border);
  --bs-link-color: var(--tm-link);
  --bs-link-hover-color: var(--tm-link-hover);
  --bs-border-radius: 0.5rem;
  --bs-border-radius-lg: 0.75rem;
}

body { background: var(--tm-page); color: var(--tm-text); }
a { color: var(--tm-link); }
a:hover { color: var(--tm-link-hover); }

/* ---- Headings: Montserrat ---- */
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .navbar-brand {
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
  color: var(--tm-heading);
  letter-spacing: -0.01em;
}
h1, .h1 {
  font-weight: 700;
  padding-bottom: 0.4rem;
  border-bottom: 4px solid var(--tm-maroon);   /* True Maroon accent under page titles */
  display: inline-block;
}
h2, .h2, h3, .h3 { font-weight: 600; }
.text-muted { color: var(--tm-muted) !important; }

/* ---- Top bar: approved Loyal Blue -> Blissful Blue gradient, white text in both modes ---- */
.tm-navbar {
  background: linear-gradient(90deg, var(--tm-blue), var(--tm-blue-light));
  border-bottom: 3px solid var(--tm-maroon);
}
.tm-navbar .navbar-brand { color: #fff; font-weight: 700; }
.tm-navbar .nav-link { color: rgba(255, 255, 255, 0.88); font-weight: 500; }
.tm-navbar .nav-link:hover,
.tm-navbar .nav-link:focus { color: var(--tm-yellow); }
.tm-navbar .btn { white-space: nowrap; }   /* keep names like "Admin Synthetic" on one line */
.tm-theme-toggle { min-width: 6.5rem; }

/* ---- "Info" messages and badges use the brand blue instead of Bootstrap's cyan ---- */
[data-bs-theme="light"] {
  --bs-info-bg-subtle: #e3eef5;
  --bs-info-border-subtle: #b6d1e2;
  --bs-info-text-emphasis: #00304b;
}
[data-bs-theme="dark"] {
  --bs-info-bg-subtle: #10303f;
  --bs-info-border-subtle: #1f5273;
  --bs-info-text-emphasis: #a9d3ee;
}
.text-bg-info { background-color: var(--tm-blue-light) !important; color: #fff !important; }

/* ---- Cards and tables ---- */
.card {
  --bs-card-bg: var(--tm-surface);
  --bs-card-border-color: var(--tm-border);
  --bs-card-cap-bg: var(--tm-th-bg);
  margin-bottom: 1rem;
  border-radius: var(--bs-border-radius-lg);
}
.card-header { font-family: "Montserrat", "Segoe UI", Arial, sans-serif; font-weight: 600; }
.table { --bs-table-bg: transparent; --bs-table-color: var(--tm-text); }
.table > thead > tr > th {
  background: var(--tm-th-bg);
  color: var(--tm-heading);
  font-family: "Montserrat", "Segoe UI", Arial, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  border-bottom-color: var(--tm-border);
}
.form-control, .form-select {
  background-color: var(--tm-surface);
  color: var(--tm-text);
  border-color: var(--tm-border);
}

/* ---- Buttons ---- */
.btn { font-weight: 600; }
.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--tm-primary);
  --bs-btn-border-color: var(--tm-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--tm-primary-hover);
  --bs-btn-hover-border-color: var(--tm-primary-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--tm-primary-hover);
  --bs-btn-active-border-color: var(--tm-primary-hover);
  --bs-btn-disabled-bg: var(--tm-primary);
  --bs-btn-disabled-border-color: var(--tm-primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--tm-link);
  --bs-btn-border-color: var(--tm-link);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--tm-primary);
  --bs-btn-hover-border-color: var(--tm-primary);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--tm-primary-hover);
  --bs-btn-active-border-color: var(--tm-primary-hover);
}
.bg-primary { background-color: var(--tm-primary) !important; }
.text-primary { color: var(--tm-link) !important; }

/* Clear keyboard focus in both modes. */
:focus-visible {
  outline: 3px solid var(--tm-focus);
  outline-offset: 2px;
}

/* ---- Existing component rules (kept from the first version) ---- */
.stat { font-family: "Montserrat", "Segoe UI", Arial, sans-serif; font-size: 1.8rem; font-weight: 700; }
.code-box { font-family: monospace; font-size: 2rem; letter-spacing: 0.15rem; }
.table td, .table th { vertical-align: middle; }
.qr { max-width: 320px; width: 100%; background: #fff; padding: 0.5rem; border-radius: 0.5rem; }
.logo { max-height: 72px; max-width: 160px; }
.signal-green { border-left: 8px solid var(--tm-signal-green); }
.signal-yellow { border-left: 8px solid var(--tm-signal-yellow); }
.signal-red { border-left: 8px solid var(--tm-signal-red); }
.pre-line { white-space: pre-line; }

/* ---- Printing: always black on white, whichever mode is on screen ---- */
@media print {
  .no-print { display: none !important; }
  :root, [data-bs-theme="dark"], [data-bs-theme="light"] {
    --tm-page: #fff; --tm-surface: #fff; --tm-text: #000; --tm-muted: #333;
    --tm-heading: #000; --tm-link: #000; --tm-border: #999; --tm-th-bg: #eee;
  }
}
