/* ===== Vindhya AI tutor (static/js/tutor.js): Chat + Voice tabs, resizable panel ===== */
.vt { --vt-w: 420px; font-family: var(--font); }
.vt-fab { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 18px 12px 14px; cursor: pointer; color: #fff; font: 700 15px var(--font);
  background: linear-gradient(135deg, #14a078 0%, #0d6b52 55%, #094a38 100%); box-shadow: 0 10px 28px rgba(13,107,82,.35), 0 2px 6px rgba(0,0,0,.12);
  transition: transform .15s ease, box-shadow .15s ease; }
.vt-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(13,107,82,.42), 0 2px 6px rgba(0,0,0,.12); }
.vt-fab:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.vt-fab-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 15px;
  background: linear-gradient(180deg, #ffd25a, #f28a1b); color: #5a2d00; }
.vt-open .vt-fab, .vt-open .vt-fab-voice { transform: scale(.92); opacity: .0; pointer-events: none; }
.vt-fab-voice { position: fixed; right: 26px; bottom: 82px; z-index: 120; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--brand); font-size: 20px; display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(13,107,82,.22); transition: transform .15s ease, box-shadow .15s ease; }
.vt-fab-voice:hover { transform: translateY(-2px) scale(1.04); box-shadow: 0 12px 28px rgba(13,107,82,.3); }
.vt-fab-voice:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#toasts { bottom: 140px; }

.vt-panel { position: fixed; right: 20px; bottom: 20px; z-index: 130; width: var(--vt-w); max-width: calc(100vw - 24px);
  height: min(680px, calc(100vh - 100px)); display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(8, 40, 30, .22), 0 4px 14px rgba(0,0,0,.08); animation: vtIn .2s ease-out; }
[data-theme="dark"] .vt-panel { box-shadow: 0 24px 60px rgba(0,0,0,.55); }
@keyframes vtIn { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.vt-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 14px; color: #fff;
  background: linear-gradient(135deg, #14a078 0%, #0d6b52 60%, #094a38 100%); }
.vt-id { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.vt-id b { display: block; font-size: 15px; line-height: 1.2; }
.vt-id small { display: block; font-size: 12px; opacity: .85; }
.vt-avatar { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-size: 16px;
  background: linear-gradient(180deg, #ffd25a, #f28a1b); color: #5a2d00; }
.vt-avatar-lg { width: 52px; height: 52px; border-radius: 16px; font-size: 26px; margin: 0 auto 10px; }
.vt-lang { border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.12); color: #fff; border-radius: 8px;
  padding: 5px 6px; font: 600 12px var(--font); cursor: pointer; }
.vt-lang option { color: #17201c; background: #fff; }
.vt-ibtn { border: 0; background: rgba(255,255,255,.12); color: #fff; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-size: 15px; flex: none; }
.vt-ibtn:hover { background: rgba(255,255,255,.24); }

/* tabs + subject */
.vt-tabs { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.vt-tab { border: 0; background: transparent; color: var(--ink-2); font: 700 13.5px var(--font); padding: 7px 12px; border-radius: 9px; cursor: pointer; }
.vt-tab:hover { background: var(--bg-2); color: var(--ink); }
.vt-tab.on { background: var(--brand-soft); color: var(--brand); }
.vt-subj-wrap { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 9px; padding: 0 4px 0 8px; background: var(--bg); }
.vt-subj-ico { font-size: 13px; }
.vt-subj { border: 0; background: transparent; color: var(--ink); font: 600 12.5px var(--font); padding: 6px 2px; cursor: pointer; outline: none; max-width: 130px; }
.vt-subj option { color: #17201c; background: #fff; }
.vt-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.vt-subjects { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 0 0 12px; }
.vt-sbtn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); border-radius: 10px;
  padding: 6px 10px; font: 700 12.5px var(--font); cursor: pointer; }
.vt-sbtn:hover { border-color: var(--brand); color: var(--brand); }
.vt-sbtn.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.vt-hint { font-size: 12px !important; color: var(--muted) !important; margin: 14px auto 0 !important; }
.vt-vbadge { font-size: 12px; opacity: .85; }

.vt-msgs { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 12px; background: var(--bg-2); overscroll-behavior: contain; }
.vt-hello { text-align: center; padding: 10px 6px; }
.vt-hello h3 { margin: 0 0 6px; font-size: 18px; }
.vt-hello p { margin: 0 auto 14px; color: var(--ink-2); font-size: 14px; max-width: 330px; line-height: 1.55; }
.vt-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.vt-chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 11px;
  font: 500 13px var(--font); cursor: pointer; text-align: left; line-height: 1.3; }
.vt-chip:hover { border-color: var(--brand); color: var(--brand); }
.vt-follow { justify-content: flex-start; margin-top: 8px; }
.vt-follow .vt-chip { font-size: 12px; padding: 4px 10px; }

.vt-msg { max-width: 100%; font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.vt-user { align-self: flex-end; max-width: 86%; }
.vt-user .vt-body { background: var(--brand); color: #fff; padding: 9px 13px; border-radius: 14px 14px 4px 14px; }
.vt-quote { font-size: 12.5px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 6px 9px; margin-bottom: 5px; }
.vt-bot .vt-body { background: var(--surface); border: 1px solid var(--line); padding: 10px 14px; border-radius: 14px 14px 14px 4px; }
.vt-err .vt-body { border-color: #e8b4ad; background: #fdf1ef; color: #7a2418; }
[data-theme="dark"] .vt-err .vt-body { background: #2a1513; border-color: #5a2a24; color: #f3c2ba; }
.vt-body > :first-child { margin-top: 0; }
.vt-body > :last-child { margin-bottom: 0; }
.vt-body p { margin: 0 0 9px; }
.vt-body h3, .vt-body h4, .vt-body h5, .vt-body h6 { margin: 14px 0 6px; font-size: 15px; line-height: 1.35; color: var(--brand); }
.vt-body h3 { font-size: 16px; }
.vt-body ul, .vt-body ol { margin: 0 0 9px; padding-left: 22px; }
.vt-body li { margin: 2px 0; }
.vt-body blockquote { margin: 0 0 9px; padding: 4px 10px; border-left: 3px solid var(--brand); color: var(--ink-2); background: var(--brand-soft); border-radius: 0 6px 6px 0; }
.vt-body hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.vt-body a { text-decoration: underline; }
.vt-body code { font-size: 12.5px; background: var(--brand-soft); color: var(--ink); padding: 1px 5px; border-radius: 5px; }
.vt-code { margin: 6px 0 10px; border-radius: 10px; overflow: hidden; background: var(--code-bg); border: 1px solid #1d2a25; }
.vt-code-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 4px 12px; background: #16241f;
  color: #9fb5ab; font: 600 11.5px var(--mono); text-transform: lowercase; }
.vt-copy { border: 0; background: transparent; color: #cfe3da; font: 600 11.5px var(--font); cursor: pointer; padding: 3px 8px; border-radius: 6px; }
.vt-copy:hover { background: rgba(255,255,255,.08); }
.vt-code pre { margin: 0; padding: 10px 12px; overflow-x: auto; }
.vt-code code { background: none; color: #e6f0eb; padding: 0; font-size: 12.5px; line-height: 1.55; white-space: pre; }
.vt-table { overflow-x: auto; margin: 4px 0 10px; }
.vt-table table { border-collapse: collapse; font-size: 13px; min-width: 100%; }
.vt-table th, .vt-table td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.vt-table th { background: var(--brand-soft); }
.vt-math-d { display: block; overflow-x: auto; overflow-y: hidden; margin: 6px 0 10px; padding: 2px 0; text-align: center; }
.vt-math:not([data-done]) { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.vt-body .katex { font-size: 1.06em; }

.vt-tools { display: flex; gap: 4px; margin-top: 4px; }
.vt-tools button { border: 0; background: transparent; color: var(--muted); font: 600 12px var(--font); padding: 3px 8px; border-radius: 6px; cursor: pointer; }
.vt-tools button:hover { background: var(--surface); color: var(--brand); }
.vt-rel { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.vt-rel small { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.vt-rel a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; }
.vt-rel a:hover { border-color: var(--brand); color: var(--brand); }
.vt-rel a span { color: var(--muted); font-weight: 500; font-size: 12px; }

.vt-typing { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.vt-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); opacity: .35; animation: vtDot 1s infinite; }
.vt-typing i:nth-child(2) { animation-delay: .15s; }
.vt-typing i:nth-child(3) { animation-delay: .3s; }
.vt-typing em { font-style: normal; font-size: 13px; margin-left: 6px; }
@keyframes vtDot { 50% { opacity: 1; transform: translateY(-2px); } }

.vt-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 6px; border-top: 1px solid var(--line); background: var(--surface); }
.vt-form textarea { flex: 1; resize: none; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; font: 14.5px/1.45 var(--font);
  color: var(--ink); background: var(--bg); max-height: 200px; outline: none; }
.vt-dict { flex: none; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 16px; cursor: pointer; }
.vt-dict:hover { border-color: var(--brand); }
.vt-dict.on { background: #e11d48; border-color: #e11d48; animation: vtPulse 1.2s infinite; }
.vt-form textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.vt-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--brand); color: #fff; font-size: 16px; cursor: pointer; }
.vt-send:hover { background: var(--brand-dark); }
.vt-send.vt-stop { background: var(--ink-2); font-size: 13px; }
.vt-foot { text-align: center; font-size: 11px; color: var(--muted); padding: 0 12px 8px; background: var(--surface); }

.vt-sel { position: fixed; z-index: 125; border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; font: 700 13px var(--font);
  color: #fff; background: var(--brand); box-shadow: 0 6px 18px rgba(0,0,0,.22); }
.vt-sel:hover { background: var(--brand-dark); }
.topnav .nav-ai { font-weight: 700; }
.topnav .nav-ai::before { content: "✦ "; color: var(--accent); }

/* ---- resize handles ---- */
.vt-rz { position: absolute; z-index: 5; }
.vt-rz-l { left: -4px; top: 18px; bottom: 18px; width: 9px; cursor: ew-resize; }
.vt-rz-t { top: -4px; left: 18px; right: 18px; height: 9px; cursor: ns-resize; }
.vt-rz-tl { top: 0; left: 0; width: 22px; height: 22px; cursor: nwse-resize; border-top-left-radius: 18px;
  background: linear-gradient(135deg, rgba(255,255,255,.75) 0 2px, transparent 2px 5px, rgba(255,255,255,.75) 5px 7px, transparent 7px); opacity: .7; }
.vt-rz-tl:hover { opacity: 1; }
.vt-resizing, .vt-resizing * { user-select: none !important; }
.vt-resizing .vt-panel { animation: none; }
.vt-panel { min-width: 340px; min-height: 420px; }
.vt-max .vt-panel { top: calc(var(--top) + 10px); right: 16px; bottom: 16px; left: calc(var(--sbw, 0px) + 16px); width: auto !important; height: auto !important; max-width: none; }
.vt-max .vt-rz { display: none; }
.vt-max .vt-msgs, .vt-max .vt-vlog { padding-left: max(14px, calc((100% - 880px) / 2)); padding-right: max(14px, calc((100% - 880px) / 2)); }
.vt-max .vt-form { padding-left: max(12px, calc((100% - 880px) / 2)); padding-right: max(12px, calc((100% - 880px) / 2)); }
.vt-max .vt-msg { font-size: 15.5px; }

/* ---- Voice tab ---- */
.vt-vlog { flex: 1; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-2); overscroll-behavior: contain; }
.vt-vhello { text-align: center; padding: 6px 4px; margin: auto 0; }
.vt-vhello h3 { margin: 6px 0 6px; font-size: 18px; }
.vt-vhello p { margin: 0 auto 14px; color: var(--ink-2); font-size: 14px; max-width: 340px; line-height: 1.55; }
.vt-vhello small { display: block; color: var(--muted); font-weight: 700; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.vt-wave { display: inline-flex; gap: 4px; align-items: center; height: 40px; }
.vt-wave i { width: 5px; border-radius: 3px; background: linear-gradient(180deg, #14a078, #0d6b52); height: 14px; animation: vtWave 1.4s ease-in-out infinite; }
.vt-wave i:nth-child(2) { animation-delay: .12s; height: 26px; } .vt-wave i:nth-child(3) { animation-delay: .24s; height: 36px; }
.vt-wave i:nth-child(4) { animation-delay: .36s; height: 26px; } .vt-wave i:nth-child(5) { animation-delay: .48s; }
@keyframes vtWave { 50% { transform: scaleY(.45); } }
.vt-vq, .vt-va { font-size: 14.5px; line-height: 1.6; overflow-wrap: anywhere; }
.vt-vq span, .vt-va > span { display: block; font: 700 11px var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
.vt-vq { align-self: flex-end; max-width: 86%; text-align: right; }
.vt-vq { background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 14px 14px 4px 14px; }
.vt-vq span { color: rgba(255,255,255,.75); }
.vt-va { align-self: flex-start; max-width: 100%; }
.vt-va .vt-body { background: var(--surface); border: 1px solid var(--line); padding: 10px 14px; border-radius: 14px 14px 14px 4px; }
.vt-va.vt-err .vt-body { border-color: #e8b4ad; background: #fdf1ef; color: #7a2418; }
.vt-vctl { border-top: 1px solid var(--line); background: var(--surface); padding: 10px 14px 12px; text-align: center; }
.vt-vlive { font-size: 15px; font-weight: 600; color: var(--ink); background: var(--brand-soft); border-radius: 10px; padding: 6px 10px; margin: 0 0 8px; }
.vt-vstatus { font-size: 13px; color: var(--ink-2); min-height: 20px; margin-bottom: 8px; }
.vt-vrow { display: flex; align-items: center; justify-content: center; gap: 22px; }
.vt-vside { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); font-size: 16px; cursor: pointer; }
.vt-vside:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.vt-vside:disabled { opacity: .4; cursor: default; }
.vt-mic { position: relative; width: 78px; height: 78px; border-radius: 50%; border: 0; cursor: pointer; color: #fff; font-size: 30px;
  background: linear-gradient(135deg, #14a078 0%, #0d6b52 60%, #094a38 100%); box-shadow: 0 10px 26px rgba(13,107,82,.38); transition: transform .15s ease; }
.vt-mic:hover { transform: scale(1.04); }
.vt-mic:disabled { filter: grayscale(1); opacity: .5; cursor: not-allowed; }
.vt-mic:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.vt-mic-ico { position: relative; z-index: 1; }
.vt-mic-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid #e11d48; opacity: 0; }
.vt-mic.on { background: linear-gradient(135deg, #f43f5e, #be123c); box-shadow: 0 10px 26px rgba(225,29,72,.4); }
.vt-mic.on .vt-mic-ring { animation: vtRing 1.6s ease-out infinite; }
.vt-mic.on .vt-mic-ring.r2 { animation-delay: .8s; }
@keyframes vtRing { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(1.75); opacity: 0; } }
@keyframes vtPulse { 50% { opacity: .65; } }
.vt-view-voice[data-state="thinking"] .vt-mic { animation: vtPulse 1s infinite; }
.vt-view-voice[data-state="speaking"] .vt-mic { box-shadow: 0 0 0 6px var(--brand-soft), 0 10px 26px rgba(13,107,82,.38); }
.vt-vopts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 14px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.vt-vopts label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.vt-vopts select { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 7px; padding: 3px 4px; font: 600 12px var(--font); }
.vt-tog input { accent-color: var(--brand); }
.vt-vnote { margin-top: 10px; font-size: 12.5px; color: #9a5a00; background: #fff6e5; border: 1px solid #f4dfaf; border-radius: 8px; padding: 6px 10px; }
[data-theme="dark"] .vt-vnote { background: #2a2210; border-color: #4a3c1a; color: #f2cf8a; }

@media (max-width: 760px) {
  .vt-fab { bottom: 76px; right: 14px; padding: 10px 14px 10px 10px; font-size: 14px; }
  .vt-fab-voice { bottom: 134px; right: 18px; width: 42px; height: 42px; font-size: 18px; }
  .vt-rz { display: none; }
  .vt-maxb { display: none; }
  .vt-subj { max-width: 104px; }
  #toasts { bottom: 186px; }
  .vt-panel { right: 0; left: 0; bottom: 0; top: auto; width: 100% !important; max-width: 100%; min-width: 0; height: calc(100dvh - 48px) !important; border-radius: 18px 18px 0 0; }
  .vt-open ~ .mobile-tabs, body:has(.vt-open) .mobile-tabs { display: none; }
}
@media (prefers-reduced-motion: reduce) { .vt-panel, .vt-typing i, .vt-wave i, .vt-mic-ring, .vt-mic, .vt-dict.on { animation: none !important; } }
@media print { .vt { display: none; } }
