:root {
  --navy: #1f2d3d;
  --navy-dark: #16212e;
  --accent: #3a6ea5;
  --muted: #6b7686;
  --border: #dfe3e8;
  --bg: #f5f6f8;
}

body {
  background: var(--bg);
  font-family: 'Poppins', sans-serif;
  color: #222;
}

.navbar {
  background: var(--navy) !important;
}

.navbar-brand {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.navbar .nav-link {
  color: rgba(255, 255, 255, 0.75);
  font-weight: 500;
}

.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: #fff;
}

.navbar .nav-link.active {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.study-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.study-card + .study-card {
  margin-top: 1.25rem;
}

.week-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.week-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.6rem;
  background: #fff;
}

.week-list a {
  text-decoration: none;
  color: inherit;
  flex: 1;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-badge.locked { background: #eceff1; color: var(--muted); }
.status-badge.unlocked { background: #e3edf9; color: var(--accent); }
.status-badge.in_progress { background: #fff3cd; color: #8a6100; }
.status-badge.completed { background: #d9f2e3; color: #1c7a45; }
.status-badge.not_scheduled { background: #eceff1; color: var(--muted); }

.likert-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1.25rem;
}

.likert-group label {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.likert-group input[type="radio"] {
  margin-right: 0.35rem;
}

.likert-anchors {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.claim-text {
  font-size: 1.15rem;
  font-weight: 500;
  border-left: 4px solid var(--accent);
  padding-left: 1rem;
  margin-bottom: 1.5rem;
}

/* Session / chat-budget countdown */
.session-timer {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: #33507a;
  background: #eef2fb;
  border: 1px solid #d4defa;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  margin-bottom: 1rem;
}

.session-timer .session-timer-value {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.session-timer.expired {
  color: #a4262c;
  background: #fdecea;
  border-color: #f5c6c2;
}

.session-timer-paused-note {
  display: none;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  opacity: 0.6;
}
.session-timer.paused .session-timer-paused-note { display: inline; }
.session-timer.paused .session-timer-value { opacity: 0.55; }

/* Collapsible "example questions" helper */
.example-questions {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafbfc;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
}
.example-questions > summary {
  cursor: pointer;
  font-weight: 500;
  color: #33507a;
}
.example-questions[open] > summary { margin-bottom: 0.5rem; }
.example-questions ul { padding-left: 1.2rem; }
.example-questions li { margin: 0.25rem 0; }

/* Chat */
.chat-container {
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
}

.chat-history {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  background: #fafbfc;
  min-height: 320px;
  max-height: 55vh;
}

.chat-bubble {
  max-width: 78%;
  padding: 0.65rem 1rem;
  border-radius: 14px;
  margin: 0.4rem 0;
  word-wrap: break-word;
  line-height: 1.4;
}

.chat-bubble.assistant {
  background: #eef1f4;
  color: #222;
  margin-right: auto;
}

.chat-bubble.user {
  background: var(--accent);
  color: #fff;
  margin-left: auto;
}

/* Rendered markdown inside assistant bubbles */
.chat-bubble.markdown > *:first-child {
  margin-top: 0;
}
.chat-bubble.markdown > *:last-child {
  margin-bottom: 0;
}
.chat-bubble.markdown p {
  margin: 0 0 0.6rem;
}
.chat-bubble.markdown h1,
.chat-bubble.markdown h2,
.chat-bubble.markdown h3,
.chat-bubble.markdown h4 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.9rem 0 0.4rem;
  line-height: 1.3;
}
.chat-bubble.markdown ul,
.chat-bubble.markdown ol {
  margin: 0 0 0.6rem;
  padding-left: 1.35rem;
}
.chat-bubble.markdown li {
  margin: 0.15rem 0;
}
.chat-bubble.markdown code {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  font-size: 0.88em;
}
.chat-bubble.markdown pre {
  background: rgba(0, 0, 0, 0.06);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0 0 0.6rem;
}
.chat-bubble.markdown pre code {
  background: none;
  padding: 0;
}
.chat-bubble.markdown blockquote {
  margin: 0 0 0.6rem;
  padding-left: 0.75rem;
  border-left: 3px solid var(--border);
  color: #555;
}
.chat-bubble.markdown a {
  color: var(--accent);
}
.chat-bubble.markdown table {
  border-collapse: collapse;
  margin: 0 0 0.6rem;
  font-size: 0.9em;
}
.chat-bubble.markdown th,
.chat-bubble.markdown td {
  border: 1px solid var(--border);
  padding: 0.3rem 0.5rem;
}

/* "Assistant is thinking" animated dots */
.chat-bubble.chat-thinking {
  display: flex;
  gap: 5px;
  align-items: center;
  width: fit-content;
}
.chat-bubble.chat-thinking .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8a94a6;
  animation: chat-thinking-bounce 1.3s infinite ease-in-out both;
}
.chat-bubble.chat-thinking .dot:nth-child(1) { animation-delay: -0.32s; }
.chat-bubble.chat-thinking .dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes chat-thinking-bounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .chat-bubble.chat-thinking .dot {
    animation-duration: 2.4s;
  }
}

.chat-input-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem;
  border-top: 1px solid var(--border);
  background: #fff;
}

.chat-input-row textarea {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  resize: none;
}

.chat-error {
  color: #a4262c;
  font-size: 0.9rem;
  margin-top: 0.5rem;
  display: none;
}

.comparison-columns {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.comparison-columns > div {
  flex: 1;
  min-width: 260px;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.progress-matrix table {
  font-size: 0.85rem;
}

.progress-matrix td, .progress-matrix th {
  vertical-align: middle;
}
