/* ============================================================
   HWD. Portal — Shared Theme
   Single source of truth for design tokens + common components.
   Retint the whole portal by editing the :root variables below.
   ============================================================ */

:root {
  /* Brand */
  --brand-orange: #e8541a;
  --brand-purple: #6c3de0;
  --brand-purple-dark: #5a2fc0;
  --brand-purple-deep: #5b2db0;

  /* Surfaces */
  --bg-app: #f4f5f7;          /* portal pages */
  --bg-auth: #f0f0f8;         /* login / register / unit select */
  --surface: #ffffff;
  --surface-alt: #fafafa;
  --border: #eeeeee;
  --border-strong: #dddddd;

  /* Text */
  --ink: #1a1a2e;
  --text: #333333;
  --text-muted: #666666;
  --text-soft: #888888;

  /* Status */
  --green: #16a34a;
  --green-2: #22c55e;
  --green-ink: #059669;
  --green-bg: #d1fae5;
  --green-bg-2: #a7f3d0;
  --amber-ink: #d97706;
  --amber: #f59e0b;
  --amber-bg: #fef3c7;
  --amber-bg-2: #fde68a;
  --red-ink: #dc2626;
  --red-bg: #fee2e2;
  --red-bg-2: #fecaca;
  --blue-ink: #1d4ed8;
  --blue: #3b82f6;
  --blue-bg: #dbeafe;

  /* Geometry */
  --radius-card: 12px;
  --radius-input: 8px;
  --radius-pill: 20px;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.06);
  --shadow-float: 0 8px 40px rgba(0, 0, 0, 0.10);

  --font: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- Base ---------- */
body {
  background: var(--bg-app);
  font-family: var(--font);
  color: var(--text);
}

a { text-decoration: none; }

/* ---------- Patterned background (auth + unit select) ---------- */
.bg-grid {
  background-color: var(--bg-auth);
  background-image:
    linear-gradient(rgba(100, 80, 200, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100, 80, 200, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  min-height: 100vh;
}

/* ---------- Shared top navigation (injected by js/nav.js) ---------- */
.app-navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
}
.tcu-logo {
  color: var(--brand-orange);
  font-weight: 900;
  font-size: 1.6rem;
  letter-spacing: -1px;
}
.app-nav-link {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-input);
  transition: background 0.35s, color 0.35s;
}
.app-nav-link:hover { background: #f3f0ff; color: var(--brand-purple); }
.app-nav-link.active { background: #ede9fe; color: var(--brand-purple); }
.nav-user { font-size: 0.9rem; color: var(--text); }
.nav-logout { color: var(--brand-orange); font-size: 0.9rem; font-weight: 600; }
.nav-logout:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.main-content { padding: 28px 32px; }
.page-title { font-weight: 800; font-size: 1.6rem; margin: 0; color: var(--ink); }

/* ---------- Buttons ---------- */
.btn-purple {
  background: var(--brand-purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-input);
  padding: 8px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.35s;
}
.btn-purple:hover { background: var(--brand-purple-dark); color: #fff; }
.btn-grey {
  background: #e5e7eb;
  color: var(--text);
  border: none;
  border-radius: var(--radius-input);
  padding: 8px 18px;
  font-size: 0.88rem;
}
.btn-grey:hover { background: #d8dbe0; color: var(--text); }
.btn-green {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-input);
  padding: 10px 20px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-green:hover { background: #15903f; color: #fff; }
.btn-outline-dark {
  border: 1px solid #ccc;
  background: #fff;
  color: var(--text);
  border-radius: var(--radius-input);
  padding: 8px 18px;
  font-size: 0.88rem;
}

/* ---------- Cards ---------- */
.surface-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 20px;
}

/* ---------- Badges (status pills) ---------- */
.badge-pending,
.badge-pend { background: var(--amber-bg); color: var(--amber-ink); border-radius: var(--radius-pill); padding: 2px 10px; font-size: 0.72rem; font-weight: 600; }
.badge-completed,
.badge-comp { background: var(--green-bg); color: var(--green-ink); border-radius: var(--radius-pill); padding: 2px 10px; font-size: 0.72rem; font-weight: 600; }
.badge-failed { background: var(--red-bg); color: var(--red-ink); border-radius: var(--radius-pill); padding: 2px 10px; font-size: 0.72rem; font-weight: 600; }

/* ---------- Forms ---------- */
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.form-label .req { color: var(--red-ink); }
.form-control, .form-select {
  border-radius: var(--radius-input);
  border: 1px solid var(--border-strong);
  font-size: 0.88rem;
  padding: 9px 12px;
}
.form-control:focus, .form-select:focus {
  border-color: var(--brand-purple);
  box-shadow: 0 0 0 3px rgba(108, 61, 224, 0.1);
}
.input-group-text { background: #f9fafb; border: 1px solid var(--border-strong); font-size: 0.88rem; color: var(--text-muted); }

/* ---------- Toasts ---------- */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .main-content { padding: 18px 16px; }
  .page-title { font-size: 1.35rem; }
  .app-navbar { padding: 10px 16px; }
}
