/* Study AI tab (the study-ai/ page in a frame) and the Ask AI panel in the Notes tab.
   Colours, type and controls follow css/style.css so both read as part of this site. */

/* ---- Study AI tab ---- */
#v-study { position: relative; }
#v-study.on { display: block; }
.study-frame { display: block; width: 100%; height: 100%; border: 0; background: #0c0c0c; }
.study-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #777; font-size: 14px; pointer-events: none; }
#v-study.loaded .study-loading { display: none; }

/* ---- PDF toolbar button ---- */
.rpv-btn.rpv-ai { width: auto; gap: 6px; padding: 0 10px; margin-right: 6px; font-size: 12px; font-weight: 600;
  border: 1px solid #4b4b4b; }
.rpv-ai-spark { color: #c8a85e; font-size: 12px; }

/* Where a source points: a short highlight over that spot of the page. */
.rpv-spot { position: absolute; left: 0; right: 0; height: 64px; margin-top: -10px; pointer-events: none;
  background: rgba(200, 168, 94, .16); border-top: 2px solid #c8a85e; animation: rpv-spot 1.8s ease-out forwards; }
@keyframes rpv-spot { 0% { opacity: 0 } 15% { opacity: 1 } 70% { opacity: 1 } 100% { opacity: 0 } }

/* ---- Ask AI panel ---- */
#v-notes .notes-section-layout-wrap { position: relative; }
.askai { display: none; }
.askai-on .askai { display: flex; flex-direction: column; width: 360px; flex-shrink: 0; min-height: 0;
  margin-left: 12px; background: #0c0c0c; border-left: 1px solid #1a1a1a; }

.askai-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px 2px 14px; }
.askai-title { display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 600; color: #fff; }
.askai-spark { color: #c8a85e; }
.askai-x { background: none; border: none; color: #777; font-size: 20px; line-height: 1; cursor: pointer;
  padding: 2px 7px; border-radius: 4px; }
.askai-x:hover { color: #fff; background: #161616; }
.askai-about { padding: 0 14px 8px; font-size: 12px; color: #888; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.askai-about b { color: #ccc; font-weight: 600; }

.askai-tabs { display: flex; margin: 0 14px; border-bottom: 1px solid #1e1e1e; }
.askai-tab { padding: 8px 10px; border: none; border-bottom: 2px solid transparent; background: transparent;
  color: #aaa; font-family: inherit; font-size: 12px; font-weight: 600; letter-spacing: .3px;
  text-transform: uppercase; cursor: pointer; transition: color .15s; }
.askai-tab:hover { color: #fff; }
.askai-tab.on { color: #fff; border-bottom-color: #888; }

.askai-note { margin: 10px 14px 0; padding: 8px 10px; font-size: 12px; line-height: 1.5; color: #c4a84a;
  background: #1a1710; border: 1px solid #3a3010; border-radius: 4px; }
.askai-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 14px; }
.askai-foot { padding: 6px 14px 10px; font-size: 11px; color: #666; }

.askai-input { display: flex; align-items: flex-end; gap: 6px; margin: 0 14px; padding: 6px 6px 6px 10px;
  background: #141414; border: 1px solid #262626; border-radius: 6px; transition: border-color .15s; }
.askai-input:focus-within { border-color: #3f7350; }
.askai-input textarea { flex: 1; min-width: 0; max-height: 140px; padding: 5px 0; border: none; outline: none;
  resize: none; background: transparent; color: #eee; font: inherit; font-size: 14px; line-height: 1.45; }
.askai-input textarea::placeholder { color: #666; }
.askai-send { flex-shrink: 0; width: 32px; height: 32px; border-radius: 4px; border: 1px solid #2f5c3b;
  background: #25482f; color: #dbeede; font-size: 16px; cursor: pointer; }
.askai-send:hover:not(:disabled) { background: #2c5638; }
.askai-send:disabled { background: #1a1a1a; border-color: #2a2a2a; color: #666; cursor: not-allowed; }

/* Empty state, messages, sources */
.askai-empty p { margin-bottom: 12px; font-size: 14px; line-height: 1.6; color: #bbb; }
.askai-empty b { color: #eee; font-weight: 600; }
.askai-chips { display: flex; flex-direction: column; gap: 6px; }
.askai-chip { padding: 8px 10px; text-align: left; font: inherit; font-size: 13px; color: #ccc; cursor: pointer;
  background: #111; border: 1px solid #222; border-radius: 4px; transition: color .12s, border-color .12s; }
.askai-chip:hover { color: #fff; background: #161616; border-color: #333; }

.askai-msg { margin-bottom: 16px; }
.askai-msg-user { display: flex; justify-content: flex-end; }
.askai-bubble { max-width: 88%; padding: 8px 11px; font-size: 14px; line-height: 1.5; color: #eee;
  white-space: pre-wrap; word-break: break-word; background: #1a1a1a; border: 1px solid #262626;
  border-radius: 8px 8px 2px 8px; }
.askai-thinking { font-size: 13px; color: #888; font-style: italic; }
.askai-err { margin-bottom: 10px; font-size: 13px; line-height: 1.5; color: #c87b6e; }

.askai-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 8px; }
.askai-sources-h { margin-right: 2px; font-size: 11px; font-weight: 600; color: #777; letter-spacing: .5px;
  text-transform: uppercase; }
.askai-src { max-width: 100%; padding: 3px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: inherit; font-size: 11.5px; color: #aaa; cursor: pointer; background: #141414; border: 1px solid #262626;
  border-radius: 3px; transition: color .12s, border-color .12s; }
.askai-src:hover { color: #fff; border-color: #3f7350; }
.askai-src-own { cursor: default; }
.askai-src-own:hover { color: #aaa; border-color: #262626; }

/* Answer text: markdown + KaTeX, styled like the roadmap's learn text. */
.askai-md { font-size: 14px; line-height: 1.7; color: #ddd; word-break: break-word; }
.askai-md > :first-child { margin-top: 0; }
.askai-md > :last-child { margin-bottom: 0; }
.askai-md p { margin: 0 0 8px; }
.askai-md ul, .askai-md ol { margin: 4px 0 8px 18px; }
.askai-md li { margin-bottom: 3px; }
.askai-md strong, .askai-md b { color: #fff; font-weight: 600; }
.askai-md h1, .askai-md h2, .askai-md h3, .askai-md h4 { margin: 10px 0 6px; font-size: 14px; color: #fff; }
.askai-md code { padding: 1px 5px; font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px;
  color: #ce9178; background: #1a1a1a; border: 1px solid #2a2a2a; border-radius: 3px; }
.askai-md pre { margin: 6px 0 10px; padding: 10px 12px; overflow-x: auto; background: #1e1e1e;
  border: 1px solid #2a2a2a; border-radius: 3px; }
.askai-md pre code { padding: 0; color: #d4d4d4; background: none; border: none; }
.askai-md table { display: block; margin: 6px 0 10px; overflow-x: auto; border-collapse: collapse; font-size: 13px; }
.askai-md th, .askai-md td { padding: 5px 8px; text-align: left; border: 1px solid #1e1e1e; }
.askai-md th { color: #ccc; background: #141414; }
.askai-md a { color: #8bb8e0; }
.askai-md blockquote { margin: 6px 0; padding-left: 10px; color: #aaa; border-left: 2px solid #333; }
.askai-md .katex-display { margin: 6px 0; padding: 4px 0; overflow-x: auto; overflow-y: hidden; }

/* Sign-in prompt and buttons (like the calendar's plan buttons) */
.askai-signin { padding: 14px; }
.askai-signin p { margin-bottom: 14px; font-size: 14px; line-height: 1.6; color: #bbb; }
.askai-btn { padding: 6px 12px; font: inherit; font-size: 12px; color: #ddd; white-space: nowrap; cursor: pointer;
  background: #1a1a1a; border: 1px solid #333; border-radius: 4px; }
.askai-btn:hover:not(:disabled) { color: #fff; background: #222; }
.askai-btn.prim { color: #dbeede; background: #25482f; border-color: #2f5c3b; }
.askai-btn.prim:hover:not(:disabled) { background: #2c5638; }
.askai-btn:disabled { color: #666; background: #1a1a1a; border-color: #2a2a2a; cursor: not-allowed; }
.askai-signin .askai-btn { display: block; width: 100%; margin-bottom: 8px; padding: 8px 12px; font-size: 13px; }
.askai-fine { margin-top: 8px; font-size: 12px; line-height: 1.5; color: #888; }
.askai-fine a { color: #8bb8e0; }

/* Flashcards, quiz, summary */
.askai-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.askai-hint { font-size: 12px; color: #777; }
.askai-save { margin-left: auto; }
.askai-card { display: flex; flex-direction: column; gap: 10px; width: 100%; min-height: 150px; margin-bottom: 10px;
  padding: 14px; text-align: left; font: inherit; cursor: pointer; background: #141414; border: 1px solid #242424;
  border-radius: 6px; transition: border-color .12s, background .12s; }
.askai-card:hover { border-color: #333; }
.askai-card.flipped { background: #141c17; border-color: #2f5c3b; }
.askai-card-side { font-size: 11px; font-weight: 600; color: #7d9c88; letter-spacing: .05em; text-transform: uppercase; }
.askai-card-tip { margin-top: auto; font-size: 11px; color: #666; }
.askai-q { margin-bottom: 14px; }
.askai-qtext { display: flex; gap: 6px; margin-bottom: 6px; }
.askai-qtext > b { flex-shrink: 0; }
.askai-q .mcq-opt { align-items: flex-start; }
.askai-q .mcq-opt .mcq-radio { margin-top: 3px; }
.askai-q .mcq-opt .askai-md { color: inherit; font-size: 13.5px; line-height: 1.5; }
.askai-explain { margin-top: 6px; padding: 8px 10px; font-size: 13px; color: #bbb; background: #111;
  border-left: 2px solid #3f7350; border-radius: 3px; }
.askai-score { margin-top: 6px; padding: 10px 12px; font-size: 14px; font-weight: 600; color: #eee;
  background: #111; border-radius: 4px; }
.askai-summary { padding: 12px 14px; background: #111; border-radius: 4px; }

/* Narrower screens: the panel slides over the viewer instead of squeezing the PDF. */
@media (max-width: 1100px) {
  .askai-on .askai { position: absolute; top: 0; right: 0; bottom: 0; z-index: 20; width: min(380px, 100%);
    margin-left: 0; box-shadow: -8px 0 24px rgba(0, 0, 0, .5); }
}
@media (max-width: 768px) {
  .askai-on .askai { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 70vh;
    border-left: none; border-top: 1px solid #262626; }
}

/* ---- Profile menu in the header (right of Progress / Topics) ---- */
.hdr-profile { position: relative; display: flex; align-items: center; }
.hdr-profile:empty { display: none; }
.hdr-profile-btn { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px;
  padding: 0; border: none; border-radius: 50%; background: transparent; color: #ccc; cursor: pointer;
  transition: color .15s, background .15s; }
.hdr-profile-btn:hover, .hdr-profile-btn.on { color: #fff; background: #1a1a1a; }
.hdr-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 300; min-width: 210px; padding: 6px 0;
  background: #141414; border: 1px solid #262626; border-radius: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
.hdr-menu-who { margin-bottom: 4px; padding: 8px 14px 10px; border-bottom: 1px solid #1f1f1f; }
.hdr-menu-who b { display: block; font-size: 13px; font-weight: 600; color: #eee; }
.hdr-menu-who span { display: block; max-width: 240px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; font-size: 12px; color: #888; }
.hdr-menu button { display: block; width: 100%; padding: 8px 14px; text-align: left; font: inherit; font-size: 13px;
  color: #ddd; background: none; border: none; cursor: pointer; }
.hdr-menu button:hover { color: #fff; background: #1c1c1c; }
.hdr-menu .hdr-menu-out { margin-top: 4px; border-top: 1px solid #1f1f1f; color: #c87b6e; }
