/**
 * RegIntel – app styles
 * Extracted from index.html for maintainability.
 *
 * When you change this file, bump the query string on app.css in
 * webapp/templates/base.html (?v=…) so browsers load the new rules.
 */

:root {
  --bg-main: #f8fafc;
  --card-white: #ffffff;
  --accent-primary: #0F766E;
  --accent-hover: #0d6560;
  --accent-light: #ccfbf1;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  /* Right “Ask & verify” width (36rem × 1.1 × 1.05); center shrinks via main padding-right. */
  --regintel-right-panel-width: 41.58rem;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: "Inter", sans-serif;
  font-size: 0.8125rem; /* 13px — one step under 14px for dense portal UI */
}

/*
 * Site header background — switch in header.html: <header class="site-header" data-surface="…">
 * Options: white, slate-100, slate-200, stone-100, zinc-100, neutral-100, teal-soft
 */
.site-header {
  border-bottom-width: 1px;
  border-bottom-style: solid;
}
.site-header[data-surface="white"],
.site-header:not([data-surface]) {
  background-color: #ffffff;
  border-bottom-color: var(--border-light);
}
.site-header[data-surface="slate-100"] {
  background-color: #f1f5f9;
  border-bottom-color: #e2e8f0;
}
.site-header[data-surface="slate-200"] {
  background-color: #e2e8f0;
  border-bottom-color: #cbd5e1;
}
.site-header[data-surface="stone-100"] {
  background-color: #f5f5f4;
  border-bottom-color: #e7e5e4;
}
.site-header[data-surface="zinc-100"] {
  background-color: #f4f4f5;
  border-bottom-color: #e4e4e7;
}
.site-header[data-surface="neutral-100"] {
  background-color: #f5f5f5;
  border-bottom-color: #e5e5e5;
}
.site-header[data-surface="teal-soft"] {
  background-color: #f0fdfa;
  border-bottom-color: #99f6e4;
}

/* Left catalog sidebar: ensure Inter font matches rest of UI */
.left-sidebar {
  font-family: "Inter", sans-serif;
}

/* Catalog list items: match welcome message typography (Inter, line-height 1.6) */
.catalog-item {
  font-family: "Inter", sans-serif;
  line-height: 1.6;
}

/* Ask & verify (right sidebar): chat scroll + input row */
.ask-verify-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
}

/* Legacy class name kept for any inline references; main chat uses .ask-verify-panel */
.chat-panel {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
}

.chat-container {
  min-height: 0; /* Required for grid child to shrink and scroll */
  min-width: 0;
  overflow-y: auto; /* Scrollbar only when content overflows */
  overflow-x: hidden;
  overscroll-behavior: contain; /* Prevent scroll chaining to parent */
  -webkit-overflow-scrolling: touch;
  /* Scrollbar toward right: gap between content and scrollbar, extend into panel padding */
  padding-right: 1rem;
  margin-right: -1rem; /* Extend scrollbar toward right edge of chat panel */
}

.user-bubble {
  background-color: #f1f5f9;
  color: #1e293b;
  border: 1px solid #e2e8f0;
  border-radius: 1rem 1rem 0 1rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  user-select: text;
  -webkit-user-select: text;
}

.agent-bubble {
  background-color: var(--card-white);
  border: 1px solid var(--border-light);
  color: var(--text-main);
  border-radius: 1rem 1rem 1rem 0;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
}

/* Tighter bubbles in the narrow right column */
.ask-verify-panel .agent-bubble {
  padding: 0.625rem 0.875rem;
  border-radius: 0.75rem 0.75rem 0.75rem 0;
  font-size: 0.8125rem;
}
.ask-verify-panel .agent-content p {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}
.ask-verify-panel .user-bubble {
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
}

.agent-content h1,
.agent-content h2 {
  font-weight: 700;
  color: var(--accent-primary);
  margin: 1rem 0 0.5rem;
}

.agent-content p {
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.agent-content ul {
  list-style-type: disc;
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.agent-content code {
  background: #f1f5f9;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.source-tag {
  background: #f1f5f9;
  border: 1px solid var(--border-light);
  border-radius: 9999px;
  transition: all 0.2s;
}

.source-tag:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
}

/* Numbered source citations (Ask & verify) */
.source-cite-list {
  margin: 0;
  padding: 0;
}
.source-cite-item {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-size: 0.7rem;
  line-height: 1.35;
}
.source-cite-num {
  flex-shrink: 0;
  min-width: 1.15rem;
  height: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.25rem;
  background: var(--accent-light);
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 0.65rem;
}
.source-cite-link {
  display: inline-flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.2rem;
  text-decoration: none;
  color: #475569;
  border: 1px solid var(--border-light);
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  transition: border-color 0.15s, background 0.15s;
}
.source-cite-link:hover {
  border-color: var(--accent-primary);
  background: #f8fafc;
  color: var(--accent-primary);
}
.source-cite-title {
  flex: 1;
  min-width: 0;
}

.suggested-query:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--accent-light);
}

.dot {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
}

.extraction-card {
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.08);
}

.header-btn-hover:hover {
  color: var(--accent-primary);
}

.accent-btn {
  background-color: var(--accent-primary);
}
.accent-btn:hover {
  background-color: var(--accent-hover);
}

.accent-text {
  color: var(--accent-primary);
}
.accent-text:hover {
  color: var(--accent-hover);
}

.input-focus-ring:focus-within {
  --tw-ring-color: rgba(15, 118, 110, 0.3);
}

/* Morning signal digest cards: comfortable reading (body is 14px / text-sm in Tailwind). */
.morning-signal-card {
  line-height: 1.55;
}

/* Dashboard cards – subtle corners (8–10px), very light shadow, teal accent line on top */
.dashboard-card {
  background: var(--card-white);
  border: 1px solid var(--border-light);
  border-radius: 0.375rem;
  padding: 0.75rem 0.875rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.04);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.dashboard-card:hover {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.06);
  border-color: rgba(15, 118, 110, 0.15);
}

/* Card headers: bolder font + grey accent line above */
.dashboard-card h3 {
  font-weight: 800 !important;
}
/* Teal accent line above card titles */
.dashboard-card h3.card-header-short-accent {
  position: relative;
  padding-top: 0.35rem;
  margin-bottom: 0.35rem;
  width: fit-content;
}
.dashboard-card h3.card-header-short-accent::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--accent-primary);
  border-radius: 1px;
}
/* When h3 has flex (e.g. title + button), keep full width so justify-between aligns button right */
.dashboard-card h3.card-header-short-accent.flex {
  width: 100%;
}

/* Compliance Health status badge */
.health-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  border-radius: 9999px;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid;
}
.health-status-green {
  background-color: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}
.health-status-yellow {
  background-color: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}
.health-status-red {
  background-color: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

/* Right chat + main padding (open/closed): see inline <style> in base.html (after Tailwind). */
@media (min-width: 1024px) {
  .left-sidebar[data-collapsed="true"] {
    width: 2.5rem;
    min-width: 2.5rem;
  }
  .left-sidebar[data-collapsed="true"] #leftSidebarContent {
    display: none !important;
  }
  .left-sidebar[data-collapsed="true"] #leftSidebarCollapsed {
    display: flex !important;
  }

  .right-sidebar[data-collapsed="true"] #rightSidebarContent {
    display: none !important;
  }
  .right-sidebar[data-collapsed="true"] #rightSidebarCollapsed {
    display: flex !important;
  }
}

@media (max-width: 1024px) {
  .right-sidebar-responsive {
    position: relative;
    width: 100%;
    max-height: 50vh;
    border-left: none;
    border-top: 1px solid var(--border-light);
  }

  .main-with-sidebar {
    padding-right: 0 !important;
  }
}
