/* ai-teacher.css — AI Teacher dashboard hero card + pop-up modal.
 * The teacher lives in a modal (opened from the dashboard card or the
 * "AI শিক্ষক" nav item). Reuses .modal-overlay / .modal.lg from
 * components.css and the chat styles from chat.css. */

/* ===== Dashboard hero card (top of the dashboard, above everything) ===== */
.teacher-hero{
  display:flex;gap:14px;align-items:center;
  padding:16px 18px;margin:0 0 14px;border-radius:var(--radius-card);
  background:linear-gradient(135deg,#e8f5e9 0%,#ffffff 55%,#e3f2fd 100%);
  border:1px solid #c8e6c9;
  box-shadow:0 6px 24px rgba(46,125,50,.12);
}
.teacher-hero-avatar{
  width:64px;height:64px;border-radius:50%;object-fit:cover;flex:none;
  border:3px solid #fff;box-shadow:0 4px 14px rgba(0,0,0,.18);
}
.teacher-hero-copy{flex:1;min-width:0}
.teacher-hero-title{
  font-weight:800;font-size:1.15rem;color:#1b5e20;
  display:flex;align-items:center;gap:8px;flex-wrap:wrap;
}
.teacher-hero-title .badge{background:#2e7d32;color:#fff}
.teacher-hero-sub{margin:4px 0 0;color:var(--text2);font-size:.9rem;line-height:1.5}
.teacher-hero-actions{display:flex;gap:8px;flex-wrap:wrap;flex:none}
.teacher-hero-actions .btn{white-space:nowrap}
@media (max-width:560px){
  .teacher-hero{flex-wrap:wrap;padding:14px}
  .teacher-hero-avatar{width:52px;height:52px}
  .teacher-hero-actions{width:100%}
  .teacher-hero-actions .btn{flex:1;justify-content:center}
}

/* ===== Teacher modal — TRUE full-screen unified view (Part 1, 23 Nov 2026).
 * Root cause of Nafiz's complaint: .modal-body scrolled as ONE unit
 * (pickers + quiz bar + chat + input all in one scroll), so the chat
 * never got a fixed height and the input scrolled away, leaving a big
 * empty gap at the bottom. Now the modal is full-viewport (100% + 100vh
 * fallback + 100dvh, see the #teacher-modal rules below), the body is a
 * fixed flex column (no page scroll), the setup zone can shrink/scroll
 * on its own, the chat flexes to fill the rest, and the input bar is
 * pinned at the bottom of the card. */
/* ===== Teacher modal — TRUE full-page by default (fixed 24 Nov 2026).
 * Nafiz's screenshot showed a small centered card: his Walton Primo NF5 /
 * Android 10 WebView (Chrome <108) drops unknown `dvh` declarations, so
 * `height:100dvh` vanished and the modal fell back to content height
 * under the base .modal rules (max-width 560/760, 90vh, rounded corners,
 * overlay padding 18px + centering). The media="print" stylesheet trick
 * could also leave these rules unapplied on that WebView.
 * Fix: ID selectors (1,1,0+) beat .modal / .modal.lg (0,2,0) and the phone
 * bottom-sheet rules in focus.css regardless of load order; 100% + 100vh
 * fallbacks BEFORE 100dvh (old WebView keeps vh, new browsers get dvh);
 * solid white background — the base .modal glass gradient is
 * semi-transparent, so over the dim overlay even a full-size modal still
 * looked grey; no open zoom animation (scale(.96) briefly showed dim
 * margins around a full-viewport card). */
#teacher-modal.teacher-modal-overlay{padding:0;align-items:stretch;justify-content:center}
#teacher-modal.teacher-modal-overlay .teacher-modal{
  width:100%;max-width:none;height:100%;height:100vh;height:100dvh;max-height:none;
  margin:0;border:0;border-radius:0;box-shadow:none;background:#fff;
}
#teacher-modal.open .teacher-modal{animation:none}
.teacher-modal .modal-header{flex:none}
.teacher-modal .modal-body{
  display:flex;flex-direction:column;gap:10px;
  padding:12px 16px;overflow:hidden;min-height:0;
  /* v1.3.10 fix (24 Nov): mobile-ui.css caps EVERY .modal-body at
     max-height:65vh — that starved the chat even in a full-height modal
     (a ~25vh empty gap at the bottom). The teacher body must fill the
     modal, so the cap is removed here (higher specificity wins). */
  max-height:none;
}
/* Setup zone (intro + class setup + weak card + pickers + start/quiz
 * buttons): one unified view with the chat, not a separate panel.
 * It can shrink and scroll internally so the chat always keeps room. */
.teacher-setup{
  flex:0 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  display:flex;flex-direction:column;gap:10px;scrollbar-width:thin;
}
/* Once a lesson is running the setup collapses into the compact lesson
 * bar below, so the chat owns the screen. "পরিবর্তন করুন" re-opens it. */
/* The 'lesson-active' / 'setup-open' classes live on the OUTER overlay
   (#teacher-modal, .teacher-modal-overlay) — the JS adds them there
   (showTeacherChatScreen / startLesson / the "পরিবর্তন করুন" toggle) —
   so these rules must target the overlay, not the inner .teacher-modal
   card. (Targeting .teacher-modal.lesson-active never matched, so the
   setup stayed visible even during a lesson — found 25 Nov 2026.) */
.teacher-modal-overlay.lesson-active .teacher-setup{display:none}
.teacher-modal-overlay.lesson-active.setup-open .teacher-setup{display:flex;max-height:46%}
.teacher-lesson-bar{
  flex:none;display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  padding:8px 10px;border-radius:var(--radius-control);
  background:#e8f5e9;border:1px solid #a5d6a7;
  font-size:.85rem;font-weight:600;color:#1b5e20;
}
/* The start button is a .btn (display:inline-flex), which beats the
   browser's [hidden] rule — without this it stays visible during a
   lesson even though paintLessonBar sets hidden=true. */
#teacher-lesson-start[hidden]{display:none}
.teacher-lesson-bar[hidden]{display:none}
.teacher-lesson-summary{flex:1;min-width:140px}
.teacher-lesson-phase{
  flex:none;padding:3px 10px;border-radius:999px;background:#2e7d32;color:#fff;
  font-size:.75rem;font-weight:700;white-space:nowrap;
}
.teacher-modal-context{font-size:.82rem;color:var(--text2);font-weight:600}
.teacher-modal .chat-messages{
  flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;
  scroll-behavior:smooth;
}

/* Class setup row (shown only when the profile has no class set). */
.teacher-class-setup{
  display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  padding:10px 12px;border-radius:var(--radius-control);
  background:#fff8e1;border:1px solid #ffe082;
}
.teacher-class-setup .mini-note{margin:0;flex:1;min-width:180px}
.teacher-class-setup select{min-width:130px}

/* Quiz bar under the pickers. */
.teacher-quiz-bar{
  display:flex;gap:8px;align-items:center;flex-wrap:wrap;
  padding:10px 12px;border-radius:var(--radius-control);
  background:var(--surface2);border:1px solid var(--border);
}
.teacher-quiz-bar .mini-note{margin:0;flex:1;min-width:180px}
.teacher-quiz-bar .btn:disabled{opacity:.6;cursor:wait}

/* Photo context chip (shown while the chat is about an uploaded photo). */
.teacher-photo-chip{
  display:flex;gap:8px;align-items:center;
  padding:7px 10px;border-radius:999px;
  background:#e3f2fd;border:1px solid #90caf9;
  color:#1565c0;font-size:.82rem;font-weight:600;
}
.teacher-photo-chip-label{display:flex;align-items:center;gap:6px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.teacher-photo-chip-clear{
  flex:none;width:22px;height:22px;border-radius:50%;
  display:grid;place-items:center;background:#fff;color:#1565c0;
  font-size:.8rem;line-height:1;cursor:pointer;border:1px solid #90caf9;
}
.teacher-photo-chip-clear:hover{background:#1565c0;color:#fff}

/* Photo inside a chat message. */
.teacher-photo-msg img{
  display:block;max-width:230px;width:100%;height:auto;
  border-radius:12px;border:1px solid var(--border);
}
.teacher-photo-btn{
  flex:none;width:48px;height:48px;border-radius:50%;
  display:grid;place-items:center;
  background:var(--surface2);color:var(--text2);cursor:pointer;
  border:1px solid var(--border);
}
.teacher-photo-btn:hover{background:var(--accent-soft);color:var(--accent)}
.teacher-photo-btn:disabled{opacity:.5;cursor:not-allowed}

/* Chat card inside the modal — fills the remaining height; the input
 * bar is pinned at its bottom (flex:none) and never scrolls away. */
.teacher-chat-card{
  flex:1 1 auto;min-height:200px;
  display:flex;flex-direction:column;
  padding:0;overflow:hidden;
}
/* Part 2 — off-screen chat rows cost nothing to render: the browser
 * skips layout/paint for rows outside the viewport until scrolled to. */
.teacher-modal .chat-row{content-visibility:auto;contain-intrinsic-size:auto 72px}
.teacher-modal .chat-row,.teacher-modal .chat-msg{animation:none}
.teacher-chat-card .chat-input-area{
  flex:none;display:flex;gap:8px;align-items:center;
  padding:12px;padding-bottom:calc(12px + env(safe-area-inset-bottom, 0px));
  border-top:1px solid var(--border);
}
.teacher-chat-card .chat-input{
  flex:1;min-width:0;min-height:48px;font-size:1rem; /* 16px = no iOS zoom */
}
.teacher-chat-card .chat-send{flex:none;width:48px;height:48px}

/* Voice buttons (NEW 1) — mic (speech-to-text) + speaker toggle
 * (text-to-speech). Same 48px touch target as the send button. */
.teacher-voice-btn{
  flex:none;width:48px;height:48px;border-radius:50%;
  display:grid;place-items:center;
  background:var(--surface2);color:var(--text2);cursor:pointer;
  border:1px solid var(--border);
}
.teacher-voice-btn:hover{background:var(--accent-soft);color:var(--accent)}
.teacher-voice-btn:disabled{opacity:.5;cursor:not-allowed}
.teacher-voice-btn.on{background:#e8f5e9;border-color:#66bb6a;color:#2e7d32}
.teacher-voice-btn.listening{
  background:#ffebee;border-color:#ef5350;color:#c62828;
  animation:teacherMicPulse 1.2s ease-in-out infinite;
}
@keyframes teacherMicPulse{0%,100%{box-shadow:0 0 0 0 rgba(239,83,80,.35)}50%{box-shadow:0 0 0 7px rgba(239,83,80,0)}}

/* Quick-action chips (NEW 3 + NEW 4) — one tap asks for a daily plan,
 * a study routine, advice, or a lesson note. Horizontally scrollable
 * so they never squeeze the chat on a small phone. */
.teacher-quick-chips{
  flex:none;display:flex;gap:6px;align-items:center;
  padding:8px 12px 0;overflow-x:auto;scrollbar-width:none;
}
.teacher-quick-chips::-webkit-scrollbar{display:none}
.teacher-chip{
  flex:none;display:inline-flex;align-items:center;gap:6px;
  padding:8px 12px;border-radius:999px;min-height:36px;
  background:var(--surface2);border:1px solid var(--border);
  color:var(--text);font-size:.82rem;font-weight:600;cursor:pointer;
  white-space:nowrap;
}
.teacher-chip:hover{background:var(--accent-soft);border-color:var(--accent);color:var(--accent)}
.teacher-chip .ico{width:15px;height:15px}

/* Reused-answer note (NEW 2) — honest label on a cached reply. */
.teacher-cache-note{
  margin-top:6px;padding-top:6px;border-top:1px dashed var(--border);
  font-size:.75rem;color:var(--text2);font-weight:600;
}

/* Generated-note card (NEW 4) — the + button adds it to Notes. */
.teacher-note-card{
  padding:12px;border-radius:var(--radius-control);
  background:linear-gradient(135deg,#e8f5e9,#e3f2fd);
  border:1px solid #a5d6a7;
}
.teacher-note-title{font-weight:800;color:#1b5e20;font-size:.92rem}
.teacher-note-preview{
  margin:6px 0 10px;color:var(--text);font-size:.85rem;line-height:1.55;
  white-space:pre-wrap;word-wrap:break-word;
  display:-webkit-box;-webkit-line-clamp:6;-webkit-box-orient:vertical;overflow:hidden;
}
.teacher-note-add{
  display:inline-flex;align-items:center;gap:8px;
  min-height:44px;padding:8px 16px;border-radius:999px;
  background:#2e7d32;color:#fff;font-weight:700;font-size:.88rem;
  border:none;cursor:pointer;
}
.teacher-note-add:hover{background:#1b5e20}
.teacher-note-add:disabled{opacity:.65;cursor:default}
.teacher-note-add .ico{width:18px;height:18px}

/* Mobile: full-viewport, tighter padding; chat keeps ≥180px. */
@media (max-width:640px){
  #teacher-modal.teacher-modal-overlay .teacher-modal{
    max-width:none;width:100%;height:100%;height:100vh;height:100dvh;max-height:none;
    border-radius:0;
  }
  .teacher-modal-overlay .modal-header{padding:12px 14px}
  .teacher-modal-overlay .teacher-modal .modal-body{padding:10px 12px}
  .teacher-chat-card{min-height:180px}
}
