/* =========================================
   1. Fonts
   ========================================= */

@font-face {
  font-family: "TT Norms";
  font-style: normal;
  font-weight: 400;
  src: url("/fonts/TT-Norms-Regular.otf") format("opentype");
}

@font-face {
  font-family: "TT Norms";
  font-style: normal;
  font-weight: 500;
  src: url("/fonts/TT-Norms-Bold.otf") format("opentype");
}

@font-face {
  font-family: "TT Norms";
  font-style: normal;
  font-weight: 600;
  src: url("/fonts/TT-Norms-Extra-Bold.otf") format("opentype");
}

@font-face {
  font-family: "TT Norms";
  font-style: normal;
  font-weight: 300;
  src: url("/fonts/TT-Norms-Light.otf") format("opentype");
}

@font-face {
  font-family: "TT Norms";
  font-style: normal;
  font-weight: 200;
  src: url("/fonts/TT-Norms-Extra-Light.otf") format("opentype");
}

@font-face {
  font-family: "TT Norms";
  font-style: italic;
  font-weight: 400;
  src: url("/fonts/TT-Norms-Italic.otf") format("opentype");
}

@font-face {
  font-family: "TT Norms";
  font-style: italic;
  font-weight: 500;
  src: url("/fonts/TT-Norms-Bold-Italic.otf") format("opentype");
}

@font-face {
  font-family: "TT Norms";
  font-style: italic;
  font-weight: 600;
  src: url("/fonts/TT-Norms-Extra-Bold-Italic.otf") format("opentype");
}

@font-face {
  font-family: "TT Norms";
  font-style: italic;
  font-weight: 300;
  src: url("/fonts/TT-Norms-Light-Italic.otf") format("opentype");
}

@font-face {
  font-family: "TT Norms";
  font-style: italic;
  font-weight: 200;
  src: url("/fonts/TT-Norms-Extra-Light-Italic.otf") format("opentype");
}

/* =========================================
   2. Root defaults & reset
   ========================================= */

:root {
  /* Fallbacks – overridden by inline CSS from header.ejs */
  --primary: #1b1464;
  --secondary: #007dc5;
  --dark: #282829;
  --light: #f1f2f2;

  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;

  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-subtle: 0 4px 12px rgba(15, 23, 42, 0.06);
  --border-subtle: 1px solid rgba(148, 163, 184, 0.25);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* =========================================
   3. Base layout & typography
   ========================================= */

body {
  margin: 0;
  font-family: "TT Norms", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #eef2ff 0, #f3f4f6 42%, #f9fafb 100%);
  color: var(--dark);
  letter-spacing: 0.03em;
}

main {
  max-width: 1400px;
  margin: 2.5rem auto 2rem;
  padding: 0 1rem 3rem;
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  min-height: calc(100vh - 58px - 4.4rem - 17rem);
}

footer {
  text-align: center;
  font-size: 0.85rem;
  padding: 1.5rem 1rem 2rem;
  color: #6b7280;
}

/* Typography */

h1,
h2,
h3 {
  color: var(--primary);
  letter-spacing: -0.02em;
}

h1 {
  font-size: 1.6rem;
  font-weight: 600;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.5rem;
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 1.25rem;
}

p {
  margin: 0 0 0.75rem;
  line-height: 1.6;
  color: #374151;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Page titles used in portal/admin headers */

.page-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.page-subtitle,
.page-header p {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: var(--light);
}

.page-header .page-title{
  color: var(--light);
}

/* Rich text output (AI-generated HTML, etc.) */

.rich-text p {
  margin: 0 0 0.75rem;
}

.rich-text a {
  text-decoration: underline;
}

fieldset {
  border: 1px solid #e1e4ea;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  margin-bottom: 1.5rem;
}

/* =========================================
   4. Header & navigation
   ========================================= */

header {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000 30%));
  color: #fff;
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

header .brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

header img.logo {
  height: 58px;
  width: auto;
  display: block;
  background: color-mix(in srgb, var(--light) 70%, var(--primary) 30%);
  border-radius: var(--radius-md);
  padding: 0.50rem;

}

header .brand-text-top {
  font-weight: 600;
  font-size: 1rem;
}

header .brand-text-bottom {
  font-size: 0.8rem;
  opacity: 0.85;
}

/* Nav */

nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

nav a {
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
  font-size: 0.9rem;
}

nav a:hover {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
}

nav a.active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06);
}

/* =========================================
   5. Buttons
   ========================================= */

/* Base button styling */

button,
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.2;
  border-radius: 999px;
  border: none;
  padding: 0.55rem 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  margin-top: 10px;

  background: var(--primary, #2b3f99);
  color: #ffffff;

  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.05s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

button:hover,
.btn:hover {
  background: color-mix(in srgb, var(--primary, #2b3f99) 82%, #000 18%);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
  text-decoration: none;
}

button:active,
.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(15, 23, 42, 0.25);
}

button:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

/* Remove random default styles in some browsers */
button::-moz-focus-inner {
  border: 0;
}

/* Variants */

.btn-primary {
  background: var(--primary, #2b3f99);
  color: #ffffff;
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--primary, #2b3f99) 82%, #000 18%);
}

.btn-secondary {
  background: var(--secondary, #26abe2);
  color: #ffffff;
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--secondary, #26abe2) 82%, #000 18%);
}

.btn-outline {
  background: transparent;
  color: var(--primary, #2b3f99);
  border: 1px solid var(--primary, #2b3f99);
  box-shadow: none;
}

.btn-outline:hover {
  background: rgba(43, 63, 153, 0.06);
  color: var(--primary, #2b3f99);
}

.btn-danger {
  background: #e03131;
  color: #ffffff;
}

.btn-danger:hover {
  background: #c12b2b;
}

.btn-ghost {
  background: transparent;
  color: var(--primary, #2b3f99);
  box-shadow: none;
}

.btn-ghost:hover {
  background: rgba(15, 23, 42, 0.03);
}

/* Size variants */

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
}

/* Icon-only */

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg,
.btn-icon i {
  font-size: 1rem;
  pointer-events: none;
}

/* Buttons in table action cells */

.table-actions .btn {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  margin-top: 0;
}

/* Password toggle buttons – deliberately neutral */

.password-toggle {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
  color: #6b7280;
  padding: 0;
  box-shadow: none;
  margin-top: 0;
}

.password-toggle:hover {
  color: #111827;
  background: none;
}

/* =========================================
   6. Forms
   ========================================= */

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  color: var(--dark);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid #d1d5db;
  font: inherit;
  max-width: 100%;
  max-width: -webkit-fill-available;
  background: #ffffff;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--primary) 80%, #000 20%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 80%, #000 20%), 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.form-group small,
.form-text {
  display: block;
  color: #6b7280;
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

/* Reusable .form-control for selects and manual inputs */

.form-control {
  width: 100%;
  max-width: 400px;
  padding: 0.6rem 0.75rem;
  font-size: 0.95rem;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  background: #ffffff;
}

/* Password wrappers */

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input[type="password"],
.password-wrapper input[type="text"] {
  padding-right: 2.5rem;
}

.password-input {
  width: 100%;
  box-sizing: border-box;
  min-width: 100%;
  max-width: -webkit-fill-available;
}

/* Select wrapper with custom arrow */

.select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 400px;
}

.select-wrapper select.form-control {
  background-color: #ffffff;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2rem;
}

.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 1.2rem;
  color: #6b7280;
}

/* Checkbox groups (SMS consent, etc.) */

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0.15rem 0.2rem 0 0;
}

/* Form layouts & actions */

.form-actions {
  margin-top: 1.5rem;
  display: flex;
  gap: 0.75rem;
}

.form-actions .btn+.btn {
  margin-left: 0;
}

/* =========================================
   7. Content layout helpers
   ========================================= */

/* Two-column layout used on contact page */

.two-column {
  display: grid;
  grid-template-columns: 2fr 1.2fr;
  gap: 2rem;
}

aside {
  margin-left: 1rem;
  border-left: 1px solid #e5e7eb;
  padding-left: 1rem;
}

/* Page header blocks (admin + portal) */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  z-index: 1;
  position: relative;
}

.page-header .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Containers */

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.container.narrow {
  max-width: 960px;
  margin: 0 auto;
}

/* Flash messages (info / error / success) */

.flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.flash-info {
  background: #e5f5ff;
  border: 1px solid #bfdbfe;
  color: #0f4a75;
}

.flash-error {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}

/* Thank-you / success states could reuse .flash-success if needed */
.flash-success {
  background: #dcfce7;
  border: 1px solid #bbf7d0;
  color: #166534;
}

/* =========================================
   8. Tables
   ========================================= */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid #e5e7eb;
  background: #ffffff;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

thead tr {
  background: #f3f4f6;
}

th,
td {
  border: 1px solid #e5e7eb;
  padding: 0.45rem 0.55rem;
}

th {
  text-align: left;
  font-weight: 600;
  color: #374151;
}

tbody tr:nth-child(even) {
  background: #f9fafb;
}

tbody tr:hover {
  background: #eff6ff;
}

/* Forms table in portal */

.forms-table td {
  vertical-align: top;
}

/* =========================================
   9. Footer inner (if used)
   ========================================= */

.footer-inner {
  max-width: 960px;
  margin: 2rem auto;
  padding: 1.5rem 1rem;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  font-size: 0.9rem;
  color: #6b7280;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* =========================================
   10. Responsive
   ========================================= */

@media (max-width: 1024px) {
  main {
    margin: 1.5rem auto 1.5rem;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  nav {
    flex-wrap: wrap;
  }

  nav a {
    margin-left: 0;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  aside {
    margin-left: 0;
    border-left: none;
    border-top: 1px solid #e5e7eb;
    padding-left: 0;
    padding-top: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-row {
    flex-direction: column;
  }
}