/*
 * RMP Distributor Portal – Global theme.
 * Brand color and fonts borrowed from the Miracle App's identity
 * (see IM Projects/miracle_app_2026 lib/main.dart + lib/views) — gold
 * accent, DM Sans/Montserrat — kept on a light surface scale.
 * Change --brand / --surface* / --text* values below to re-theme
 * the whole portal in one place.
 */
:root {
  /* Brand color — gold (Miracle App ColorScheme seed, #E0A93B) */
  --brand-50:  rgba(224, 169, 59, 0.12);
  --brand-100: rgba(224, 169, 59, 0.20);
  --brand-200: rgba(224, 169, 59, 0.35);
  --brand-300: #b78a35;
  --brand-400: #cf9f42;
  --brand-500: #e0a93b;   /* primary */
  --brand-600: #d89f34;
  --brand-700: #a67a1f;   /* deep gold — legible as text/hover on light surfaces */
  --brand-800: #8a6416;
  --brand-900: #6b4d0f;

  /* Text set on top of a solid gold fill (buttons, filled icon circles) */
  --ink: #141b4d;

  /* Neutrals — light mode. Brand color and fonts stay Miracle-gold /
     DM Sans + Montserrat; only the surface scale is light here. */
  --surface:        #ffffff;   /* card / component fill */
  --surface-hi:      #f1f5f9;  /* elevated: hover, table header, active row */
  --surface-muted:  #f6f8fb;   /* page background */
  --surface-border: #e5e9f0;
  --text-strong:    #0f172a;
  --text:           #1f2937;
  --text-soft:      #374151;
  --text-muted:     #64748b;
  --text-subtle:    #94a3b8;

  /* Status — mapped to the app's mood-scale accents */
  --success: #6fbf73;   /* "Good" mood */
  --warning: #e0824a;   /* "Low" mood */
  --danger:  #e0654a;   /* "Awful" mood / ColorScheme.error */
  --info:    #3e7fd9;   /* "Okay" mood */

  /* Fonts — Montserrat display, DM Sans body (mirrors lib/main.dart) */
  --font-primary:   "DM Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-secondary: "Montserrat", ui-sans-serif, system-ui, -apple-system, sans-serif;
}

html, body {
  background: var(--surface-muted);
  color: var(--text);
  font-family: var(--font-primary);
  -webkit-font-smoothing: antialiased;
}

/* Headings and display text carry Montserrat; body copy stays on DM Sans. */
h1, h2, h3, h4, h5, h6, .font-primary {
  font-family: var(--font-secondary);
  letter-spacing: -0.01em;
}

/* Brand utility classes */
.bg-brand   { background-color: var(--brand-500); }
.bg-brand-hover:hover { background-color: var(--brand-600); }
.bg-brand-50  { background-color: var(--brand-50); }
.bg-brand-100 { background-color: var(--brand-100); }
.text-brand   { color: var(--brand-700); }
.text-brand-700 { color: var(--brand-700); }
.border-brand { border-color: var(--brand-500); }
.ring-brand   { --tw-ring-color: var(--brand-400); }

/* Focus ring */
.input-base {
  width: 100%;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  border-radius: 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text);
  transition: border-color 120ms, box-shadow 120ms;
}
.input-base:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(224, 169, 59, 0.25);
}
.input-base::placeholder { color: var(--text-subtle); }
.input-base[aria-invalid="true"], .input-base.invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 101, 74, 0.18);
}

/* Custom dropdown arrow — replaces the native one so the gap between the
   selected text and the arrow stays consistent across browsers. */
select.input-base {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%236b7280' stroke-width='1.5'%3E%3Cpath d='M6 8l4 4 4-4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  background-size: 1rem;
}

.label-base {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.375rem;
}
.label-base .req { color: var(--danger); margin-left: 2px; }

/* Inline field hint / error text */
.field-hint  { font-size: 0.75rem; color: var(--text-subtle); margin-top: 0.25rem; }
.field-error { font-size: 0.75rem; color: var(--danger);     margin-top: 0.25rem; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: background-color 120ms, color 120ms, box-shadow 120ms, transform 120ms;
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.25;
  font-family: var(--font-primary);
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--brand-600);
  color: var(--ink);
}
.btn-primary:hover { background: var(--brand-700); }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--surface-border);
}
.btn-secondary:hover { background: var(--surface-hi); }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text-strong); background: var(--surface-hi); }
.btn-danger {
  background: #fee2e2;
  color: var(--danger);
}
.btn-danger:hover { background: #fecaca; }
.btn-warning {
  background: #fef3c7;
  color: #b45309;
}
.btn-warning:hover { background: #fde68a; }

/* Card */
.card {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

/* Sidebar link */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 120ms, color 120ms;
}
.nav-link:hover { background: var(--surface-hi); color: var(--text-strong); }
.nav-link.active {
  background: var(--brand-50);
  color: var(--brand-800);
}
.nav-link.active .nav-dot { background: var(--brand-500); }

.nav-section-title {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  padding: 0.5rem 0.875rem 0.25rem;
}

/* Sidebar — dark variant. Applied only by partials/app-admin/sidebar.ejs; the
   distributor admin and distributor client sidebars stay on the light scale.
   Values are lifted from miraclein15mins.com's own :root token set, so the
   console's dark chrome matches the public site exactly (its --on-gold,
   #141B4D, is already this file's --ink). Nothing here restyles .nav-link
   directly — the surface/text tokens are just re-pointed on the sidebar
   element itself, so the shared .nav-link / .nav-section-title rules and the
   bg-surface / border-slate-* / text-brand-* utilities inside it all resolve
   against the dark scale for free. */
.sidebar-dark {
  --surface:        #0a1230;              /* site --bg — sidebar fill */
  --surface-hi:     #1b2340;              /* site --surface-alt — hover / active row */
  --surface-muted:  #060b1f;              /* site --bg-deep */
  --surface-border: rgba(255,255,255,.08);/* site --border */

  /* Site text ramp: solid white down to white-alpha steps. */
  --text-strong:    #ffffff;              /* site --text */
  --text:           rgba(255,255,255,.72);/* site --text-2 */
  --text-soft:      rgba(255,255,255,.72);/* site --text-2 */
  --text-muted:     rgba(255,255,255,.72);/* site --text-2 — nav-link rest, 9.6:1 */
  --text-subtle:    rgba(255,255,255,.50);/* site --text-3 — section titles, 5.2:1 */

  /* Gold on dark. The light-mode deep golds (--brand-700/800) are unreadable
     on navy, so both re-point onto the site's own pair: --gold-dark at rest
     (6.4:1), brightening to --gold on hover / active (8.7:1). The tint fills
     use the site's own gold alphas. */
  --brand-50:  rgba(224,169,59,.16);
  --brand-100: rgba(224,169,59,.18);
  --brand-600: #e0a93b;                   /* site --gold — brand tile fill */
  --brand-700: #c68f2c;                   /* site --gold-dark */
  --brand-800: #e0a93b;                   /* site --gold */
}

/* Table */
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-hi);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--surface-border);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-family: var(--font-primary);
}
.data-table tbody td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--surface-border);
  color: var(--text);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-hi); }
.data-table tbody tr[data-click-url] { cursor: pointer; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--surface-hi);
  color: var(--text-muted);
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-brand   { background: var(--brand-50); color: var(--brand-800); }

/* Required-field asterisk helper for labels via class. */
.required::after { content: " *"; color: var(--danger); font-weight: 700; }
