/* jobvoodoo branding — Branding jobvoodoo v2:
   primary #1abcfe, secondary #0acf83, gradient 135° primary→secondary,
   text #273266, text-dark #192551, muted #6b90c0, light #edf5fa,
   dark #1c2f4b. Typeface: Geomanist (self-hosted, 400 + 500). */

@font-face {
  font-family: "Geomanist";
  src: url("assets/fonts/geomanist-regular-webfont.woff2?v=1") format("woff2"),
       url("assets/fonts/geomanist-regular-webfont.woff?v=1") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geomanist";
  src: url("assets/fonts/geomanist-medium-webfont.woff2?v=1") format("woff2"),
       url("assets/fonts/geomanist-medium-webfont.woff?v=1") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

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

:root {
  --jv-primary: #1abcfe;
  --jv-green: #0acf83;
  --jv-gradient: linear-gradient(135deg, #1abcfe, #0acf83);
  --jv-text: #273266;
  --jv-text-dark: #192551;
  --jv-muted: #6b90c0;
  --jv-dark: #1c2f4b;
  --jv-light: #edf5fa;
  --jv-link: #0886c9;
  --jv-border: #d7e6f2;
  --jv-error: #ff8400;
}

html, body { height: 100%; }

body {
  font-family: "Geomanist", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  color: var(--jv-text);
  background: var(--jv-light);
}

.app {
  height: 100%;
}

.chat {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #ffffff;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: #ffffff;
  border-bottom: 1px solid var(--jv-border);
}

.brand { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.brand-logo { height: 26px; width: auto; display: block; align-self: center; }

.reset-btn {
  border: none;
  background: var(--jv-gradient);
  border-radius: 10px;
  padding: 8px 16px;
  font: inherit;
  font-weight: 500;
  font-size: 13px;
  color: #ffffff;
  cursor: pointer;
  flex-shrink: 0;
}
.reset-btn:hover { filter: brightness(1.06); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px max(18px, calc(50% - 430px));
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.msg { display: flex; flex-direction: column; }
.msg.user { align-items: flex-end; }
.msg.bot { align-items: flex-start; }

.bubble {
  max-width: 86%;
  padding: 10px 15px;
  border-radius: 14px;
  line-height: 1.6;
  overflow-wrap: break-word;
}
.msg.user .bubble {
  background: var(--jv-gradient);
  color: #ffffff;
  border-bottom-right-radius: 5px;
}
.msg.bot .bubble {
  background: #f6fafd;
  border: 1px solid var(--jv-border);
  border-bottom-left-radius: 5px;
}
.msg.bot .bubble.error {
  background: #fff7ef;
  color: #9a4b00;
  border-color: #ffd9ae;
}

.bubble h3 {
  font-size: 15px;
  font-weight: 500;
  margin: 10px 0 5px;
  color: var(--jv-text-dark);
}
.bubble p { margin: 5px 0; }
.bubble ul { margin: 5px 0 5px 20px; }
.bubble strong { color: var(--jv-text-dark); font-weight: 500; }
.bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: #e6f1f9;
  padding: 1px 5px;
  border-radius: 4px;
}

.thinking { display: inline-flex; gap: 8px; align-items: center; }
.thinking .dots { display: inline-flex; gap: 5px; align-items: center; }
.thinking .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--jv-primary);
  animation: pulse 1.2s infinite ease-in-out;
}
.thinking .dot:nth-child(2) { background: #14c6c0; animation-delay: 0.2s; }
.thinking .dot:nth-child(3) { background: var(--jv-green); animation-delay: 0.4s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .3; } 40% { opacity: 1; } }
.status-text { font-size: 13px; color: var(--jv-muted); }

details.sql-block { margin: 8px 0; }
details.sql-block summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--jv-link);
  user-select: none;
}
details.sql-block pre {
  margin-top: 7px;
  padding: 10px;
  background: var(--jv-dark);
  color: #d9e8f5;
  border-radius: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  overflow-x: auto;
  white-space: pre-wrap;
}

.table-wrap { overflow-x: auto; margin: 8px 0; }
table.data {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 220px;
}
table.data th, table.data td {
  border: 1px solid var(--jv-border);
  padding: 5px 10px;
  text-align: left;
  white-space: nowrap;
}
table.data th {
  background: #eaf7fe;
  font-weight: 500;
  color: var(--jv-text-dark);
}
table.data tr:nth-child(even) td { background: #f7fbfd; }
.table-note { font-size: 12px; color: var(--jv-muted); margin-top: 3px; }

.chart-wrap { margin: 8px 0; max-width: 100%; overflow-x: auto; }

.followups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  max-width: 86%;
}
.followup-chip {
  border: 1px solid var(--jv-primary);
  background: #ffffff;
  color: var(--jv-link);
  border-radius: 999px;
  padding: 6px 14px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.followup-chip:hover { background: #eaf7fe; }
.followup-chip:disabled {
  border-color: var(--jv-border);
  color: var(--jv-muted);
  cursor: default;
  background: #ffffff;
}

.chat-form {
  display: flex;
  gap: 10px;
  padding: 13px max(18px, calc(50% - 430px));
  border-top: 1px solid var(--jv-border);
  background: #ffffff;
}
#chat-input {
  flex: 1;
  padding: 11px 15px;
  border: 1px solid #c3d7e6;
  border-radius: 10px;
  font: inherit;
  color: var(--jv-text);
}
#chat-input::placeholder { color: #8aa0b8; }
#chat-input:focus {
  outline: 2px solid var(--jv-primary);
  outline-offset: -1px;
  border-color: var(--jv-primary);
}
#send {
  border: none;
  background: var(--jv-gradient);
  color: #ffffff;
  border-radius: 10px;
  width: 46px;
  cursor: pointer;
  font-size: 16px;
}
#send:hover { filter: brightness(1.06); }
#send:disabled { background: #b7c6d6; filter: none; cursor: default; }

.chat-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 16px 10px;
  font-size: 11.5px;
  color: var(--jv-muted);
  background: #ffffff;
  border-top: 1px solid #eef4f9;
}
.chat-footer .legal { display: flex; gap: 12px; }
.chat-footer a { color: var(--jv-muted); text-decoration: underline; }
.chat-footer a:hover { color: var(--jv-link); }

@media (max-width: 720px) {
  .bubble { max-width: 94%; }
  .followups { max-width: 94%; }
}
