/*
 * Global stylesheet for static affiliate starter pages.
 * Sections follow DOM structure: tokens → reset/base → forms → layout cards → dashboard → responsive.
 * Lines inside rules use trailing comments only where extra clarity helps beginners.
 */

/* ---------- Design tokens (referenced via var(--name) throughout) ---------- */
:root {
  --onyx: #1a1a1a; /* Deepest background tone */
  --page-bg: #1f2430; /* Secondary page wash */
  --panel-bg: #242b3a; /* Container surfaces */
  --card-bg: #2a3142; /* Nested cards */
  --input-bg: #1e2533; /* Fields sitting on panels */
  --text-main: #e5e7eb; /* Primary readable text */
  --text-muted: #aab3c5; /* Labels/helper copy */
  --line: #465067; /* Borders/dividers */
  --accent: #25c0d3; /* Primary buttons/links */
  --accent-strong: #1aa6b8; /* Hover/active accent */
  --positive: #3bd68c; /* Positive deltas on dashboard */
}

/* Global sizing and font baseline */
* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

/* Shared dark page background and centering */
body {
  margin: 0;
  background: var(--onyx);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

/* Landing page keeps centered single-form layout */
body.page-landing {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Dashboard uses app-like top aligned layout */
body.page-dashboard {
  display: block;
  align-items: initial;
  justify-content: initial;
  padding: 28px;
}

/* Main centered container used by forms/pages */
.container {
  width: 100%;
  max-width: 520px;
  background: var(--panel-bg);
  padding: 28px;
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

/* Landing form wrapper remains compact */
body.page-landing .container {
  max-width: 520px;
}

/* Thank-you / landing inline links (dashboard login, back to form) */
.page-landing .container a {
  color: var(--accent);
  text-decoration: none;
}

.page-landing .container a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

/* Dashboard configuration / API error banner */
.banner-warn {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.08);
  color: var(--text-main);
  font-size: 14px;
  text-align: left;
  line-height: 1.45;
}

/* Headings keep clean readable spacing */
h1 {
  margin: 0 0 18px;
  font-size: 22px;
  text-align: center;
}

h2, h3 {
  margin: 0 0 12px;
}

/* Landing signup hero — large title + subtitle above Join Request */
.landing-hero-title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 5.5vw, 2.35rem); /* Large responsive headline */
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.landing-hero-subtitle {
  margin: 0 0 24px;
  font-size: clamp(1.1rem, 3.2vw, 1.4rem); /* Prominent but secondary to title */
  font-weight: 600;
  text-align: center;
  line-height: 1.35;
  color: var(--accent);
}

/* Smaller section heading above the form fields */
h2.landing-form-heading {
  margin: 0 0 18px;
  font-size: 22px;
  text-align: center;
  font-weight: 700;
  color: var(--text-main);
}

/* Form labels use muted contrast text */
label {
  display: block;
  margin: 12px 0 6px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Inputs share same dark control style */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text-main);
  outline: none;
}

/* Optional checkbox panel style */
.checkbox-group {
  margin-top: 10px;
  padding: 10px;
  background: var(--input-bg);
  border-radius: 8px;
  border: 1px solid var(--line);
}

.checkbox-group p {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.checkbox-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 6px 0;
  font-size: 14px;
}

/* Keep checkboxes native size and alignment */
.checkbox-line input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

/* Primary action button style */
button {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-size: 15px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

/* Supporting small helper text */
.small {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 10px;
}

/* Reusable card and layout surfaces for dashboard pages */
.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}

.layout {
  width: 100%;
  max-width: 1200px;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 16px;
}

.sidebar {
  background: #1a2232;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.sidebar a {
  color: #d0d6e2;
  text-decoration: none;
  display: block;
  padding: 0.55rem 0;
}

.sidebar a:hover {
  color: #ffffff;
}

.content {
  width: 100%;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.pill {
  display: inline-block;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(37, 192, 211, 0.12);
  color: #9de9f1;
  border: 1px solid rgba(37, 192, 211, 0.4);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

p {
  color: var(--text-muted);
}

/* Centered dashboard shell with consistent spacing */
.dashboard-main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  background: var(--panel-bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  padding: 24px;
}

/* Dashboard cards should fill grid cells, not landing max width */
body.page-dashboard .cards .container,
body.page-dashboard .activity-wrapper .container {
  max-width: none;
}

/* Keep dashboard heading and cards visually centered */
.dashboard-topbar,
.dashboard-section-title {
  text-align: center;
}

.dashboard-section-title {
  margin: 20px 0 14px;
  color: var(--text-main);
  font-size: 22px;
}

/* Dashboard card grid matching reference spacing */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

/* Data tiles use centered content */
.data-box {
  text-align: center;
  padding: 20px;
}

.data-box h3 {
  margin-bottom: 10px;
  color: var(--text-main);
  font-size: 18px;
}

.data-box p {
  margin: 4px 0;
}

/* Match landing page stronger metric number emphasis */
.data-box p:not(.small) {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-main);
}

/* Positive trend text style for metric deltas */
.positive {
  color: var(--positive);
}

/* Activity wrapper aligns table card to dashboard center */
.activity-wrapper {
  margin-top: 8px;
  width: 100%;
}

/* Let activity card fill full dashboard row width */
.activity-wrapper .container {
  max-width: 100%;
  width: 100%;
}

/* Keep activity table columns evenly distributed */
.activity-wrapper .table {
  table-layout: fixed;
}

.activity-wrapper .table th,
.activity-wrapper .table td {
  width: 20%;
}

/* Keep table header style aligned with landing page contrast */
.table th {
  color: var(--text-main);
  font-weight: 600;
}

@media (max-width: 900px) {
  body {
    display: block;
  }
  .layout,
  .cards,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}
