/* Council Genius PWA — styles
 * Palette: navy #1e2a52, gold #c4a04f, off-white #eef1f4
 */

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1a1a1a;
  line-height: 1.5;
  background: #eef1f4;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.06);
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.screen[hidden] { display: none; }

/* ── Header ───────────────────────────────────────────── */
.app-header {
  background: linear-gradient(135deg, #1e2a52 0%, #0f1833 100%);
  color: #fff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
}

.app-header .brand {
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.3px;
}

.app-header .sub {
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}

.switch-council {
  font-size: 12px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 6px 12px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.switch-council:hover { background: rgba(255, 255, 255, 0.25); }
.switch-council:active { background: rgba(255, 255, 255, 0.35); }

/* ── Content body ─────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 20px;
  -webkit-overflow-scrolling: touch;
}

.content.center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── Splash ───────────────────────────────────────────── */
.logo-badge {
  width: 112px;
  height: 112px;
  margin-bottom: 32px;
  border-radius: 22px;
  object-fit: cover;
}

.headline {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.2;
}

.tagline {
  color: #666;
  font-size: 14px;
  margin-bottom: 40px;
  max-width: 300px;
}

.btn-primary {
  background: #1e2a52;
  color: #fff;
  border: none;
  padding: 14px 28px;
  border-radius: 26px;
  font-size: 15px;
  font-weight: 600;
  min-width: 220px;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary:hover { background: #0f1833; }
.btn-primary:active { background: #0a1128; }
.btn-primary:disabled { background: #8891a8; cursor: not-allowed; }

.install-hint {
  color: #888;
  font-size: 11px;
  margin-top: 20px;
}

/* ── Picker tabs ──────────────────────────────────────── */
.picker-tabs {
  display: flex;
  border-bottom: 1px solid #e5e8ed;
  margin: -8px -4px 20px;
}

.picker-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 13px;
  color: #888;
  cursor: pointer;
  border: none;
  background: none;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  font-family: inherit;
}

.picker-tab.active {
  color: #1e2a52;
  border-bottom-color: #1e2a52;
  font-weight: 600;
}

.picker-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #d0d5dc;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 12px;
  font-family: inherit;
}

.picker-input:focus {
  outline: none;
  border-color: #1e2a52;
  box-shadow: 0 0 0 3px rgba(30, 42, 82, 0.12);
}

.picker-hint {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
}

/* ── Council list ─────────────────────────────────────── */
.council-list {
  list-style: none;
}

.council-item {
  padding: 14px 16px;
  border: 1px solid #e5e8ed;
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: 15px;
  background: #fff;
  transition: background 0.12s, border-color 0.12s;
}

.council-item:hover,
.council-item:focus-visible {
  background: #f4f7fb;
  border-color: #1e2a52;
  outline: none;
}

.council-item:active {
  background: #e8edf5;
}

.council-item .state {
  font-size: 11px;
  color: #888;
  background: #eef1f4;
  padding: 3px 8px;
  border-radius: 8px;
  font-weight: 600;
}

.council-item .name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: #1a1a1a;
}

.council-item .name-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.council-item .badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.badge-beta {
  background: #fff4d6;
  color: #8a6d00;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.badge-version {
  background: #eef1f4;
  color: #4a5568;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.2px;
}

.badge-bin {
  background: #fee2e2;
  color: #991b1b;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-bin.good {
  background: #d1fae5;
  color: #065f46;
}

.empty-state {
  text-align: center;
  padding: 20px;
  color: #888;
  font-size: 14px;
}

/* ── Chat ─────────────────────────────────────────────── */
.council-banner {
  background: #f4f7fb;
  padding: 10px 20px;
  font-size: 12px;
  color: #444;
  border-bottom: 1px solid #e5e8ed;
}

.council-banner strong { color: #1e2a52; }

.bin-status-banner {
  background: #fff8e5;
  border-bottom: 1px solid #f3e0a0;
  padding: 9px 18px;
  font-size: 12px;
  color: #6b5400;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  line-height: 1.5;
}

.bin-status-banner[hidden] { display: none; }

.bin-status-banner .bin-status-icon {
  font-size: 14px;
  line-height: 1;
  margin-top: 1px;
  color: #c4a04f;
}

.bin-status-banner strong { color: #6b5400; }

.bin-status-banner a {
  color: #1e2a52;
  font-weight: 600;
  text-decoration: underline;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.45;
  word-wrap: break-word;
}

.msg-user {
  align-self: flex-end;
  background: #1e2a52;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-bot {
  align-self: flex-start;
  background: #f0f3f7;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
}

.msg-bot a { color: #1e2a52; font-weight: 600; }
.msg-bot strong { color: #1e2a52; }

.msg-bot.msg-error {
  background: #fdecec;
  color: #7a1f1f;
}

.msg-actions {
  align-self: flex-start;
  display: flex;
  gap: 6px;
  margin: -4px 0 6px 4px;
}

.thumb {
  background: #fff;
  border: 1px solid #d0d5dc;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
}

.thumb:hover { border-color: #1e2a52; }
.thumb.selected { border-color: #c4a04f; background: #fff8e5; }
.thumb[disabled] { cursor: default; opacity: 0.7; }

.typing-indicator {
  align-self: flex-start;
  padding: 8px 14px;
  color: #888;
  font-size: 13px;
  font-style: italic;
}

/* ── Ad slot (reserved) ───────────────────────────────── */
.ad-slot {
  margin: 8px 16px;
  padding: 0;
  height: 0;
  overflow: hidden;
}

/* When ads are enabled post-launch, unhide and style here. */

/* ── Input bar ────────────────────────────────────────── */
.chat-input-bar {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid #e5e8ed;
  gap: 8px;
  background: #fff;
}

.chat-input {
  flex: 1;
  border: 1px solid #d0d5dc;
  border-radius: 22px;
  padding: 11px 16px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}

.chat-input:focus {
  border-color: #1e2a52;
  box-shadow: 0 0 0 3px rgba(30, 42, 82, 0.12);
}

.send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #1e2a52;
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.send-btn:hover { background: #0f1833; }
.send-btn:disabled { background: #8891a8; cursor: not-allowed; }

/* ── Footer ───────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 12px 20px;
  font-size: 12px;
  color: #888;
  background: #eef1f4;
}

.app-footer a {
  color: #666;
  text-decoration: none;
}
.app-footer a:hover { text-decoration: underline; }

.app-footer span { margin: 0 6px; }

/* ── Reduced motion ───────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
