/* ------------------------- Styles ------------------------- */
/* Simple shared styles for the QAD AI 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 table rows and data. 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 qad_ai.php. */

.chat-window {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  padding: 14px;
  height: 400px;
  overflow-y: auto;
  margin-bottom: 12px;
}
.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; }

/* 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); } }

/* ------------------------- 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; }

/* ------------------------- Billing & Admin ------------------------- */
/* Shared by billing.php, users.php and usage.php. */

/* A callout that is informational rather than an error - "no plan yet". */
.notice-box {
  border: 1px solid #ddd;
  border-left: 4px solid #1a3c5e;
  background: #f7f9fb;
  border-radius: 4px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

/* Replaces the composer when the plan is unpaid or exhausted. Deliberately
   heavier than .notice-box - it is a stop, not a note. */
.blocked {
  border: 1px solid #e6c9ce;
  border-left: 4px solid #b00020;
  background: #fdf6f7;
  border-radius: 4px;
  padding: 16px;
  margin-bottom: 12px;
}
.blocked-head { font-weight: bold; color: #b00020; margin-bottom: 6px; }
.blocked p { margin: 0 0 10px; }

/* Current-plan summary at the top of billing.php. */
.plan-now {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f7f9fb;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.plan-now-head {
  font-size: 12px;
  color: #777;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.plan-now-tier { font-size: 22px; font-weight: bold; color: #1a3c5e; margin: 2px 0 10px; }

/* Label / value pairs. dt and dd sit on one line each so long values wrap under
   their own label rather than against the next one. */
.detail-list { margin: 0; font-size: 14px; }
.detail-list dt { float: left; clear: left; width: 110px; color: #777; }
.detail-list dd { margin: 0 0 4px 120px; }

/* The three plan cards. Wraps to one column on a narrow screen. */
.tier-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 24px; }
.tier {
  flex: 1 1 200px;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
}
.tier-current { border-color: #1a3c5e; border-width: 2px; background: #f7f9fb; }
.tier-name { font-weight: bold; font-size: 16px; color: #1a3c5e; }
.tier-price { font-size: 26px; font-weight: bold; margin-top: 6px; }
.tier-per { font-size: 12px; color: #777; margin-bottom: 10px; }
.tier-list { margin: 0 0 14px; padding-left: 18px; font-size: 14px; }
.tier-list li { margin-bottom: 4px; }
/* Pushes the button to the bottom so cards of different heights line up. */
.tier form { margin-top: auto; }
.tier-badge { margin-top: auto; font-size: 13px; color: #1a3c5e; font-weight: bold; }

/* Data tables on all three admin pages. */
table.grid {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
table.grid th,
table.grid td {
  border: 1px solid #ddd;
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  overflow-wrap: anywhere;
}
table.grid th { background: #f0f0f0; }
table.grid tr.row-off td { color: #999; background: #fafafa; }
table.grid tr.grid-total td { background: #f7f9fb; font-weight: bold; }

/* Several single-button forms sitting side by side in one table cell. */
.inline-form { display: inline; }
.inline-form + .inline-form { margin-left: 10px; }

/* Month pager on usage.php. */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  font-size: 14px;
}
.pager a { color: #1a3c5e; text-decoration: none; }
.pager a:hover { text-decoration: underline; }
.pager-now { font-weight: bold; }

/* At-a-glance figures above the usage table. */
.tile-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.tile {
  flex: 1 1 120px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #f7f9fb;
  padding: 10px 12px;
}
.tile-label { display: block; font-size: 12px; color: #777; text-transform: uppercase; letter-spacing: .03em; }
.tile-value { display: block; font-size: 17px; font-weight: bold; color: #1a3c5e; margin-top: 2px; }

/* Proportional bar for the month's consumption. Turns red near the cap so
   "nearly out" reads at a glance rather than needing the percentage. */
.meter {
  height: 10px;
  background: #e9edf1;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}
.meter-fill { height: 100%; background: #1a3c5e; }
.meter-fill.meter-high { background: #b00020; }

/* Select boxes match the text inputs above them. */
.form-row select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}

/* A query the agent ran on qad_connect.php, 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 a figure
   read out of a database the customer cannot see is only worth as much as their
   ability to check where it came from. */
.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;
}
/* SQL keeps its own line breaks and scrolls sideways rather than wrapping a long
   join into something unreadable. */
.chat-tool-sql {
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
  color: #333;
  white-space: pre;
  overflow-x: auto;
}