/*
 * Same dark palette as the issuer/verifier/wallet apps (this page is
 * "TRUSTEQ infra" tying the demo together, not a distinct third-party
 * product the way the client-site app deliberately is - see that app's
 * own style.css for the contrast).
 */
:root {
  --bg: #0f1220;
  --card: #1a1e33;
  --border: #2a2f4a;
  --text: #e8eaf6;
  --muted: #9aa0c3;
  --accent: #006edf;
  --accent-dark: #021529;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: inherit; }

.muted { color: var(--muted); }

/* ---------- header ---------- */
.db-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.db-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.db-logo { height: 32px; width: auto; display: block; }
.db-brand-name { font-weight: 700; font-size: 18px; color: var(--text); }

/* Same shared pill-badge language as the issuer/verifier/wallet headers
   (Issuer #006EDF, Verifier #8145BD, Wallet #F39626 - see e.g.
   eudi-srv-pid-issuer/main.css's own .role-badge) - green here, the one
   color in that shared palette none of the four apps already claimed. */
.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: #55953b;
}

.db-mode-switch {
  display: inline-flex;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.db-mode-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.db-mode-btn.active { background: var(--accent); color: #fff; }
.db-mode-btn:not(.active):hover { color: var(--text); }

/* ---------- layout shell ---------- */
#db-main { flex: 1 1 auto; display: flex; min-height: 0; }
.db-view { display: none; flex: 1 1 auto; min-width: 0; min-height: 0; }
.db-view.active { display: flex; flex-direction: column; }

/* ---------- launcher ---------- */
#view-launcher { padding: 40px 24px; align-items: flex-start; justify-content: center; }
.db-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}
.db-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  transition: transform 120ms ease, border-color 120ms ease;
}
.db-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.db-card-icon { color: var(--accent); }
.db-card h2 { margin: 4px 0 0; font-size: 19px; }
.db-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* ---------- tabbed / split shared shell ---------- */
.db-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 16px 0;
  border-bottom: 1px solid var(--border);
}
.db-tab {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
}
.db-tab.active { color: var(--text); background: var(--card); }
.db-tab:not(.active):hover { color: var(--text); }

#frame-pool { flex: 1 1 auto; min-height: 0; }

.db-pane {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--card);
}
.db-pane-label {
  display: none;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
/* Dark, matching this page's own --bg, not white - the issuer/verifier
   panes are dark-themed apps, and a white iframe background would show
   through as a light flash while the app is still loading, or around any
   gap if its content is shorter than the iframe. (The client-site app is
   deliberately light-themed of its own accord - see its own README - so
   its pane still reads as light once loaded, just without a white frame
   showing through before/around it too.) */
.db-frame { flex: 1 1 auto; width: 100%; border: none; background: var(--bg); }

/* Tabbed: one pane at a time, full size, no per-pane label (the tab strip
   above already says which app it is). */
#frame-pool[data-mode="tabbed"] { display: flex; }
#frame-pool[data-mode="tabbed"] .db-pane.active { display: flex; }

/* Split: every pane at once, in a responsive grid, each labeled since
   there's no tab strip to say which is which - reflows to a single
   column on a narrow window instead of squeezing three panes unreadably
   thin. */
#frame-pool[data-mode="split"] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
#frame-pool[data-mode="split"] .db-pane { display: flex; border-left: 1px solid var(--border); }
#frame-pool[data-mode="split"] .db-pane:first-child { border-left: none; }
#frame-pool[data-mode="split"] .db-pane-label { display: block; }

/* ---------- wallet widget - always visible, independent of mode ---------- */
.db-wallet-widget {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--card);
}
.db-wallet-widget img {
  border-radius: 8px;
  background: #fff;
  padding: 6px;
  flex-shrink: 0;
}
.db-wallet-info { display: flex; align-items: flex-start; gap: 10px; }
.db-wallet-info .db-wallet-icon { color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.db-wallet-info strong { display: block; margin-bottom: 2px; }
.db-wallet-info p { margin: 0; font-size: 13px; line-height: 1.5; max-width: 60ch; }
.db-wallet-info a { color: var(--accent); font-weight: 600; text-decoration: none; }
.db-wallet-info a:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .db-header { padding: 12px 16px; }
  .db-wallet-widget { flex-direction: column; align-items: flex-start; padding: 14px 16px; }
  #frame-pool[data-mode="split"] { grid-template-columns: 1fr; }
}
