/* ------------------------- Styles ------------------------- */
/* Simple shared styles for the e4aid website. */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: #222;
  background: #f5f5f5;
}

/* The menu is a burger everywhere: the three-line button toggles a dropdown panel of
   links. No JavaScript - a hidden checkbox (.nav-toggle) holds the open/closed state
   and its :checked state reveals the <nav>. */
.navbar {
  position: relative; /* anchors the dropdown panel below the header */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #1a3c5e;
  color: #fff;
}
.navbar .brand { font-weight: bold; font-size: 18px; }

/* Burger button: three stacked bars. The real checkbox stays visually hidden; the
   <label> is the clickable icon. */
.navbar .nav-toggle { position: absolute; opacity: 0; pointer-events: none; }
.navbar .nav-burger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 30px;
  padding: 4px 5px;
  border-radius: 8px;
  cursor: pointer;
}
.navbar .nav-burger span {
  display: block;
  height: 3px;
  width: 100%;
  background: #fff;
  border-radius: 2px;
}
.navbar .nav-burger:hover { background: rgba(255, 255, 255, 0.14); }
/* Keyboard focus lands on the hidden checkbox; mirror it onto the icon. */
.navbar .nav-toggle:focus-visible + .nav-burger {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* The links: hidden until the burger is toggled, then a dropdown panel below the
   header, right-aligned under the button. */
.navbar nav {
  display: none;
  position: absolute;
  top: 100%;
  right: 16px;
  z-index: 200;
  flex-direction: column;
  min-width: 200px;
  margin-top: 4px;
  padding: 8px;
  background: #15314d;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}
.navbar .nav-toggle:checked ~ nav { display: flex; }
.navbar a { color: #fff; text-decoration: none; }
.navbar nav a {
  padding: 10px 12px;
  border-radius: 8px;
}
.navbar nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.content { max-width: 720px; margin: 40px auto; padding: 0 20px; }

/* Wider page width for the chat, where replies quote column listings and data
   rows. The auth pages keep the standard 720px. */
.content.wide { max-width: 1000px; }

.footer {
  text-align: center;
  padding: 20px;
  color: #777;
  font-size: 13px;
}

.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 24px;
}

.form-row { margin-bottom: 12px; }
.form-row label { display: block; margin-bottom: 4px; font-size: 14px; }
.form-row input { width: 100%; padding: 8px; border: 1px solid #ccc; border-radius: 4px; }
/* The composer's message box - same frame as the inputs above it. */
.form-row textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}
/* A file picker draws its own button, so it does not want the input frame. */
.form-row input[type="file"] {
  border: none;
  padding: 0;
  font-size: 14px;
}

.btn {
  display: inline-block;
  padding: 9px 16px;
  background: #1a3c5e;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #15314d; }
/* Secondary action sitting beside the primary one (Clear, Download). */
.btn + .btn { margin-left: 8px; }
.btn-muted { background: #777; }
.btn-muted:hover { background: #666; }

.error { color: #b00020; margin-bottom: 12px; }
.notice { color: #1a6e2e; margin-bottom: 12px; }

/* Red "(*)" marker in front of a required field's label. */
.required { color: #b00020; font-weight: bold; }

/* Muted helper text - counts, hints, form notes. */
.muted { color: #777; font-size: 13px; }

/* Inline + block code. */
code {
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  background: #f0f0f0;
  padding: 1px 4px;
  border-radius: 3px;
}
.code {
  display: block;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 12px;
  font-size: 13px;
  white-space: pre-wrap;
  overflow-wrap: normal;
  word-break: normal;
  overflow-x: auto;
}

.hidden { display: none; }
.switch { margin-top: 14px; font-size: 14px; }
.switch a { color: #1a3c5e; cursor: pointer; }

/* A submit button that has to look like a link, because the action is a POST but
   reads as one ("Resend code" on verify_2fa.php). */
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #1a3c5e;
  cursor: pointer;
  text-decoration: underline;
  font-size: 14px;
}

/* ------------------------- Chat ------------------------- */
/* The conversation thread and composer on e4aid.php. */

/* Starts short and grows with the conversation, up to 400px - then it scrolls. */
.chat-window {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  padding: 14px;
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 12px;
}
/* The landing point for the redirect after an answer. Zero-height, so it only
   marks a position - the margin keeps the answer off the top edge instead of
   butting it against the border. */
#chat_answer { display: block; scroll-margin-top: 14px; }

.chat-msg {
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
  font-size: 14px;
}
.chat-user { background: #1a3c5e; color: #fff; }
.chat-agent { background: #e9edf1; color: #222; }
.chat-empty { color: #777; text-align: center; padding: 20px; }

/* The spoken version of the newest answer, under its bubble. The player is left
   at its own width rather than stretched, so it reads as an extra rather than a
   second message. */
.chat-audio { margin: -4px 0 10px; }
.chat-audio audio { max-width: 100%; height: 32px; }

/* A lookup the agent ran, shown in the thread between the question and the
   answer. Deliberately quieter than either bubble - it is what the agent did, not
   what anybody said - but always visible, because an answer read out of a
   database the customer cannot see is only worth as much as their ability to
   check that it WAS read. */
.chat-tool {
  border: 1px solid #dfe5ea;
  border-left: 3px solid #8fa5b8;
  border-radius: 6px;
  background: #f7f9fb;
  padding: 8px 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.chat-tool-head {
  color: #777;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: 12px;
  margin-bottom: 4px;
}

/* The voice tick under the message box. A quiet row - it is a choice about this
   message, not a setting worth the weight of a panel. */
.chat-opts { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.chat-opt {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #555;
  font-size: 13px;
  cursor: pointer;
}

/* Spinner shown while a Sasha call is in flight. Pair it with the shared .hidden
   class to keep it out of view until the form submits. */
.spinner {
  width: 22px;
  height: 22px;
  margin-top: 12px;
  border: 3px solid #ccc;
  border-top-color: #1a3c5e;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Replaces the composer while a question is still being worked on. The page makes
   one API call per request and lets the browser come back for the next, so this is
   on screen between hops - it has to read as "still going", not as a stalled
   page. */
.working {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid #ddd;
  border-left: 4px solid #1a3c5e;
  background: #f7f9fb;
  border-radius: 4px;
  padding: 14px;
  margin-bottom: 12px;
}
/* The spinner's own top margin is for sitting under the composer; in here it is
   one of two things on a row. */
.working .spinner { flex: 0 0 auto; margin-top: 0; }
.working p { margin: 0; font-size: 14px; }

/* ------------------------- Attached Files ------------------------- */
/* The panel above the thread listing every file the agent can currently see.
   Each one is re-sent with every question until it is removed. */

.file-list {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f7f9fb;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 13px;
}
.file-list-head {
  color: #777;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-size: 12px;
  margin-bottom: 6px;
}
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}
/* Rule between rows only - the head above the list is a div too, so a
   :first-of-type exception would land on the wrong element. */
.file-item + .file-item { border-top: 1px solid #e4e9ee; }
.file-name {
  flex: 1 1 auto;
  font-weight: bold;
  color: #1a3c5e;
  overflow-wrap: anywhere;
}
.file-size { flex: 0 0 auto; color: #777; }
.file-remove { flex: 0 0 auto; color: #b00020; text-decoration: none; }
.file-remove:hover { text-decoration: underline; }
