/* Author Cole Conley */
/* ═══════════════════════════════════════════════════════
   OIDC Federation Tester — SP Portal
   styles.css
═══════════════════════════════════════════════════════ */

/* ---- CSS VARIABLES ---- */
:root {
  --bg: #0a0c10;
  --surface: #0f1218;
  --surface2: #161b24;
  --surface3: #1e2530;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.13);
  --text: #e8edf5;
  --muted: #6b7a94;
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --accent-dim: rgba(59,130,246,0.12);
  --accent-glow: rgba(59,130,246,0.25);
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.1);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.1);
  --amber: #f59e0b;
  --amber-dim: rgba(245,158,11,0.1);
  --purple: #a855f7;
  --purple-dim: rgba(168,85,247,0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --mono: 'IBM Plex Mono', monospace;
  --display: 'Syne', sans-serif;
  --body: 'DM Sans', sans-serif;
}

/* ---- RESET ---- */
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- GRID LAYOUT ---- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.main {
  margin-left: 240px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- SIDEBAR ---- */
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-mark {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--accent2);
}
.logo-sub {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.nav-section { padding: 12px 12px 4px; }
.nav-label {
  font-size: 9px;
  font-family: var(--mono);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  transition: all 0.15s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  position: relative;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent2); }
.nav-item .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}
.nav-item.active .dot { background: var(--accent); }
.nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-family: var(--mono);
  background: var(--accent-dim);
  color: var(--accent2);
  padding: 1px 6px;
  border-radius: 20px;
  border: 1px solid var(--accent-glow);
}

.sidebar-bottom {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--border);
}
.session-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: pointer;
  transition: background 0.15s;
}
.session-pill:hover { background: var(--surface3); }
.avatar-sm {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  color: var(--accent2);
  flex-shrink: 0;
}
.session-info { flex: 1; min-width: 0; }
.session-name { font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-role { font-size: 10px; color: var(--muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex-shrink: 0; box-shadow: 0 0 6px var(--green); }

/* ---- PAGES ---- */
.page { display: none; flex: 1; }
.page.active { display: flex; flex-direction: column; }

/* ---- TOPBAR ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky; top: 0; z-index: 50;
}
.topbar-title {
  font-family: var(--display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.topbar-subtitle { font-size: 12px; color: var(--muted); margin-top: 1px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  font-family: var(--body);
  cursor: pointer; border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border2); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.25); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34,197,94,0.25); }
.btn-success:hover { background: rgba(34,197,94,0.2); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-xl { padding: 16px 32px; font-size: 16px; border-radius: var(--radius-lg); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-family: var(--display); font-size: 13px; font-weight: 700; letter-spacing: 0.3px; color: var(--text); }
.card-subtitle { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 11px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 5px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  font-family: var(--body);
  transition: border-color 0.15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--muted); }
.form-select { cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; font-family: var(--mono); font-size: 12px; }
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px; font-weight: 500;
  font-family: var(--mono);
}
.badge-blue   { background: var(--accent-dim);  color: var(--accent2); border: 1px solid var(--accent-glow); }
.badge-green  { background: var(--green-dim);   color: var(--green);   border: 1px solid rgba(34,197,94,0.25); }
.badge-red    { background: var(--red-dim);     color: var(--red);     border: 1px solid rgba(239,68,68,0.25); }
.badge-amber  { background: var(--amber-dim);   color: var(--amber);   border: 1px solid rgba(245,158,11,0.25); }
.badge-purple { background: var(--purple-dim);  color: var(--purple);  border: 1px solid rgba(168,85,247,0.25); }
.badge-gray   { background: rgba(255,255,255,0.05); color: var(--muted); border: 1px solid var(--border); }

/* ---- CODE BLOCK ---- */
.code-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.7;
  color: #a8b8d8;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 280px;
  overflow-y: auto;
}
.code-block .k { color: var(--accent2); }
.code-block .s { color: var(--green); }
.code-block .n { color: var(--amber); }

/* ---- TABLES ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left;
  font-size: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 400;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }

/* ---- STEP FLOW ---- */
.flow-steps { display: flex; flex-direction: column; gap: 8px; }
.flow-step {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface2);
  transition: all 0.2s;
}
.flow-step.done   { border-color: rgba(34,197,94,0.3);  background: rgba(34,197,94,0.04); }
.flow-step.active { border-color: var(--accent-glow);   background: var(--accent-dim); }
.flow-step.error  { border-color: rgba(239,68,68,0.3);  background: var(--red-dim); }
.step-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
  font-family: var(--mono);
}
.step-icon.pending { background: var(--surface3);   color: var(--muted);   border: 1px solid var(--border2); }
.step-icon.done    { background: var(--green-dim);  color: var(--green);   border: 1px solid rgba(34,197,94,0.4); }
.step-icon.active  { background: var(--accent-dim); color: var(--accent2); border: 1px solid var(--accent-glow); }
.step-icon.error   { background: var(--red-dim);    color: var(--red);     border: 1px solid rgba(239,68,68,0.4); }
.step-body { flex: 1; min-width: 0; }
.step-name   { font-size: 13px; font-weight: 500; color: var(--text); }
.step-detail { font-size: 11px; color: var(--muted); font-family: var(--mono); margin-top: 2px; word-break: break-all; }
.step-detail.ok  { color: var(--green); }
.step-detail.err { color: var(--red); }

/* ---- ALERTS ---- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert-info    { background: var(--accent-dim); color: var(--accent2); border: 1px solid var(--accent-glow); }
.alert-success { background: var(--green-dim);  color: var(--green);   border: 1px solid rgba(34,197,94,0.25); }
.alert-error   { background: var(--red-dim);    color: var(--red);     border: 1px solid rgba(239,68,68,0.25); }
.alert-warn    { background: var(--amber-dim);  color: var(--amber);   border: 1px solid rgba(245,158,11,0.25); }

/* ---- TABS ---- */
.tabs {
  display: flex; gap: 2px; padding: 4px;
  background: var(--surface2);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.tab {
  flex: 1; text-align: center;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px; font-weight: 500;
  cursor: pointer; border: none; background: none;
  color: var(--muted); transition: all 0.15s;
  font-family: var(--body);
}
.tab.active { background: var(--surface); color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- PAGE LAYOUT HELPERS ---- */
.page-body { padding: 24px 28px; flex: 1; overflow-y: auto; }
.two-col   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row   { display: flex; gap: 12px; align-items: center; }

/* ---- STAT CARDS ---- */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.stat-value  { font-family: var(--display); font-size: 28px; font-weight: 800; color: var(--text); }
.stat-label  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat-change { font-size: 11px; font-family: var(--mono); margin-top: 6px; }
.stat-up     { color: var(--green); }

/* ---- LOGIN PAGE ---- */
.login-page {
  display: none;
  min-height: 100vh;
  background: var(--bg);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-page.active { display: flex; }
.login-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}
.login-glow {
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 70%);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.login-box {
  position: relative;
  width: 420px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 40px;
  z-index: 1;
}
.login-logo {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.login-tagline {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 32px;
  font-family: var(--mono);
}
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
  color: var(--muted); font-size: 12px;
}
.login-divider::before,
.login-divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

/* ---- IDP LOGIN BUTTONS ---- */
.idp-btn {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px; font-weight: 500;
  cursor: pointer; border: none;
  transition: all 0.2s;
  margin-bottom: 8px;
  font-family: var(--body);
  position: relative;
  overflow: hidden;
}
.idp-btn::after {
  content: '';
  position: absolute; inset: 0;
  background: rgba(255,255,255,0);
  transition: background 0.15s;
}
.idp-btn:hover::after { background: rgba(255,255,255,0.04); }
.idp-btn-primary {
  background: linear-gradient(135deg, #1a3a6b 0%, #0f2447 100%);
  color: #e8f0ff;
  border: 1px solid rgba(59,130,246,0.3);
}
.idp-btn-primary:hover {
  border-color: rgba(59,130,246,0.6);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(59,130,246,0.2);
}
.idp-icon {
  width: 20px; height: 20px;
  border-radius: 4px;
  background: var(--accent-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  color: var(--accent2);
  flex-shrink: 0;
  font-family: var(--mono);
}

/* ---- USER PROFILE CARD ---- */
.user-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center;
}
.avatar-lg {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 2px solid var(--accent-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  color: var(--accent2);
  font-family: var(--display);
}

/* ---- TOKEN VIEWER ---- */
.token-section { margin-bottom: 16px; }
.token-label {
  font-size: 10px;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 5px;
}
.token-value {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: #7a9cc9;
  word-break: break-all;
  max-height: 80px;
  overflow-y: auto;
  line-height: 1.5;
}

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ---- ANIMATIONS ---- */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse  { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin   { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn 0.25s ease-out; }
.spin    { animation: spin 1s linear infinite; display: inline-block; }
.pulse   { animation: pulse 2s infinite; }

.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ---- MISC UTILITIES ---- */
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.text-muted  { color: var(--muted); }
.text-sm     { font-size: 12px; }
.text-mono   { font-family: var(--mono); }
.text-accent { color: var(--accent2); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.mb-0        { margin-bottom: 0; }
.mt-8        { margin-top: 8px; }
.gap-8       { gap: 8px; }
.hidden      { display: none !important; }

/* ---- IDP CONFIG ACCORDION ---- */
.idp-config-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s;
}
.idp-config-item:hover { border-color: var(--border2); }
.idp-config-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
}
.idp-config-body {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: none;
}
.idp-config-body.open { display: block; }
.idp-color-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- CLAIMS GRID ---- */
.claims-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  font-size: 12px;
}
.claim-key { color: var(--muted); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.claim-val { color: var(--text); word-break: break-word; }

/* ---- MODALS ---- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 28px;
  width: 520px;
  max-width: 95vw;
  max-height: 85vh;
  overflow-y: auto;
  animation: fadeIn 0.2s ease-out;
}
.modal-title {
  font-family: var(--display);
  font-size: 16px; font-weight: 700;
  margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-close {
  background: none; border: none; color: var(--muted);
  cursor: pointer; font-size: 18px; line-height: 1;
  padding: 2px 6px; border-radius: 4px;
  transition: color 0.15s;
}
.modal-close:hover { color: var(--text); }

/* ---- TOAST NOTIFICATIONS ---- */
.toast-area {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text);
  pointer-events: auto;
  animation: fadeIn 0.2s ease-out;
  max-width: 320px;
  display: flex; align-items: center; gap: 8px;
}
.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error   { border-color: rgba(239,68,68,0.3); }
