/* public/style.css (clean) */

/* --------- Theme --------- */
:root {
  --navy: #0b1f36;
  --brand: #f37021;
  --blue: #0f62fe;
  --text: #111;
  --text-muted: #666;
  --border: #e6e6e6;
  --bg: #fff;
}

/* --------- Base --------- */
* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  padding: 0 1rem 1rem 1rem;            /* page content padding */
  max-width: 700px;         /* narrow content like your screenshot */
  margin: 0 auto;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

h3 {
  font-size: 1.2rem;
  margin: 1rem 0 0.5rem;
  font-weight: 700;
}

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

/* --------- Forms / Controls --------- */
input, button, textarea, select {
  margin-bottom: 0rem;
  width: 100%;
  padding: 0.5rem;
  font: inherit;
}

textarea {
  font-size: 1rem;
  resize: vertical;
}

input:disabled, button:disabled {
  background: #eee;
  color: #999;
  cursor: not-allowed;
}

/* --------- Loading spinner --------- */
#loading { display: none; margin-top: 1rem; font-style: italic; }
#loading::after {
  content: "";
  display: inline-block;
  width: 16px; height: 16px; margin-left: .5rem;
  border: 2px solid #ccc; border-top-color: #333;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#loadingScreen { text-align: center; padding: 3rem; }

/* --------- Chat messages --------- */
#chat-box { margin-top: 2rem; }
.message { margin: 1rem 0; }
.message .meta { margin-top: .25rem; font-size: .85rem; color: #777; }
.user { font-weight: 700; }

/* --------- Small prompt button row --------- */
.prompt-buttons { text-align: center; margin-top: .5rem; }
.prompt-buttons button {
  width: 90px; margin: 0 5px; padding: .4rem;
  font-size: .9rem; cursor: pointer;
}
.btn-save { background: #4caf50; color:#fff; border: none; }
.btn-delete { background: #e53935; color:#fff; border: none; }

/* --------- Cards (metrics) --------- */
.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
  margin-top: .5rem;
}
.card { border: 1px solid var(--border); border-radius: 8px; padding: .75rem; background: #fff; }
.card-label { font-size: .8rem; color: #666; margin-bottom: .25rem; }
.card-value { font-size: 1.25rem; font-weight: 600; }

/* --------- Topbar (dark navy) --------- */
.topbar {
  position: sticky; top: 0; z-index: 1000;
  background: var(--navy);
  border-bottom: none;
  box-shadow: 0 1px 0 rgba(0,0,0,.18);
}
.topbar__wrap {
  display: flex; align-items: center; gap: 12px;
  width: 100%; max-width: none;
  margin: 0 auto; padding: 10px 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 28px; width: auto; display: block; }
.brand__text { font-weight: 700; color: #fff; letter-spacing: .2px; }

.nav-group { display: flex; gap: 10px; margin-left: 8px; }
.nav-link {
  display: inline-flex; padding: 8px 10px; border-radius: 8px;
  text-decoration: none; color: #e6ecff; font-weight: 500; line-height: 1;
}
.nav-link:hover { background: rgba(255,255,255,.10); }
.nav-link.active { background: var(--brand); color: #fff; }

.spacer { flex: 1 1 auto; }

.user-area { display: inline-flex; align-items: center; gap: 10px; }
.user-email {
  color: #e6ecff; font-size: .9rem; max-width: 28ch;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Buttons (shared + topbar) */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 8px; border: 1px solid transparent;
  background: var(--blue); color:#fff; cursor: pointer; font-weight: 600;
}
.btn:hover { opacity: .92; }
.btn-ghost {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.35);
}
.btn-ghost:hover { background: rgba(255,255,255,.12); }

/* --------- Mobile nav --------- */
.hamburger {
  display: none; border: none; background: transparent; padding: 6px; right: 4px; cursor: pointer; position: relative;
}
.hamburger span {
  display: block; width: 22px; height: 2px; margin: 4px 0; background: #fff; border-radius: 2px;
}
@media (max-width: 720px) {
  .nav-group {
    position: absolute; top: 56px; left: 0; right: 0;
    background: var(--navy);
    border-bottom: 1px solid rgba(255,255,255,.15);
    padding: 8px 16px 12px;
    display: none; flex-direction: column; gap: 6px;
  }
  .nav-group.open { display: flex; }
  .hamburger { display: flex; flex-direction: column; align-items: flex-end;}
  .brand__text { display: none; }
}

/* --------- Responsive content --------- */
@media (max-width: 640px) {
  body { max-width: 100%; }
  h1 { font-size: 1.5rem; text-align: center; }
  .cards { grid-template-columns: 1fr; }
}

/* --------- Legacy cleanups --------- */
/* Hide the old body-level logout button (nav has its own) */
body > #logoutBtn { display: none !important; }

/* Make the topbar span the full viewport width even if the body is centered */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #0b1f36;                  /* navy */
  border-bottom: none;
  box-shadow: 0 1px 0 rgba(0,0,0,.18);

  /* full-bleed trick */
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  width: 100vw;
}

/* Keep content nicely contained inside the full-bleed bar */
.topbar__wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 1280px;                    /* widen so right side has room */
  margin: 0 auto;
  padding: 10px 16px;
}

/* Links on dark background */
.brand__text { color: #fff; }
.nav-link { color: #e6ecff; }
.nav-link:hover { background: rgba(255,255,255,.10); }
.nav-link.active { background: #f37021; color: #fff; }

/* Push user/email area hard-right */
.spacer { flex: 1 1 auto; }

/* Show the full email and keep it readable on navy */
.user-email {
  color: #e6ecff;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: visible;                     /* show full email */
  text-overflow: clip;                   /* no ellipsis */
  max-width: none;                       /* remove prior 28ch limit */
}

/* Logout button styling on dark bar */
.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
}
.btn-ghost:hover { background: rgba(255,255,255,.12); }

/* Mobile menu stays navy */
@media (max-width: 720px) {
  .nav-group {
    position: absolute;
    top: 56px;
    left: 0; right: 0;
    background: #0b1f36;
    border-bottom: 1px solid rgba(255,255,255,.15);
    padding: 8px 16px 12px;
    display: none;
    flex-direction: column;
    gap: 6px;
  }
  .nav-group.open { display: flex; }
  .user-email {
  max-width: 5rem;                  /* remove prior 28ch limit */
  }
}
