/* ── Professor Bubble System ────────────────────────────────────────────── */

/* ── Card bubble (Layer 1) — small tag on live game card ── */
.prof-card-bubble {
  position: absolute;
  bottom: 10px;
  left: 10px;          /* LTR: right-side of card in RTL layout = left in DOM */
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 15, 30, 0.92);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 20px;
  padding: 4px 10px 4px 6px;
  cursor: pointer;
  max-width: calc(100% - 20px);
  backdrop-filter: blur(8px);
  animation: bubble-in 220ms ease-out;
  z-index: 10;
}

.prof-card-bubble:hover {
  border-color: rgba(255,255,255,0.20);
}

.prof-card-bubble .pb-grade {
  font-family: 'Anton', sans-serif;
  font-size: 11px;
  letter-spacing: 0.5px;
  background: var(--pb-grade-color, #22c55e);
  color: #0a0f1e;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.prof-card-bubble .pb-text {
  font-family: 'Heebo', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[dir="rtl"] .prof-card-bubble .pb-text { direction: rtl; }

/* ── Layer 2 — expanded bubble panel ── */
.prof-bubble-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 500;
  background: #111827;
  border-top: 1px solid rgba(255,255,255,0.10);
  border-radius: 18px 18px 0 0;
  padding: 16px 16px 20px;
  max-width: var(--app-max-width);
  margin: 0 auto;
  animation: panel-slide-up 260ms cubic-bezier(0.32, 0.72, 0, 1);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
}

.prof-bubble-panel.closing {
  animation: panel-slide-down 220ms ease-in forwards;
}

.pbp-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.pbp-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #1a2540;
  border: 1.5px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Anton', sans-serif;
  font-size: 14px;
  color: #e2e8f0;
  letter-spacing: 0.5px;
}

.pbd-close {
  margin-right: auto;
  background: none;
  border: none;
  color: #6b7fa8;
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.pbd-close:hover { color: #e2e8f0; }

.pbp-grade {
  font-family: 'Anton', sans-serif;
  font-size: 13px;
  color: #0a0f1e;
  background: var(--pb-grade-color, #22c55e);
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
  margin-top: 2px;
}

.pbp-headline {
  font-family: 'Heebo', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #f0f4ff;
  line-height: 1.3;
  flex: 1;
}
html[dir="rtl"] .pbp-headline { direction: rtl; }

.pbp-body {
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  font-weight: 400;
  color: #9aa5b4;
  line-height: 1.5;
  margin-bottom: 12px;
}
html[dir="rtl"] .pbp-body { direction: rtl; }

/* ── Mini chat ── */
.pbp-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pbp-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 120px;
  overflow-y: auto;
}

.pbc-msg {
  font-family: 'Heebo', sans-serif;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 10px;
  max-width: 90%;
  line-height: 1.4;
}
html[dir="rtl"] .pbc-msg { direction: rtl; }

.pbc-msg.user {
  background: #1d428a;
  color: #f0f4ff;
  align-self: flex-start;
}

.pbc-msg.professor {
  background: #1a2540;
  color: #cbd5e1;
  align-self: flex-end;
}

.pbp-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pbp-input {
  flex: 1;
  background: #1a2540;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  padding: 8px 14px;
  color: #f0f4ff;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  outline: none;
}
html[dir="rtl"] .pbp-input { direction: rtl; }

.pbp-input:focus { border-color: rgba(255,255,255,0.20); }
.pbp-input::placeholder { color: #6b7fa8; }

.pbp-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1d428a;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pbp-send:hover { background: #2a52a0; }

.pbp-send svg { width: 16px; height: 16px; stroke: #fff; }

/* ── "Continue in The Lab" button ── */
.pbp-lab-btn {
  display: none;
  width: 100%;
  margin-top: 8px;
  background: rgba(29, 66, 138, 0.25);
  border: 1px solid rgba(29, 66, 138, 0.5);
  border-radius: 10px;
  color: #93b4f0;
  font-family: 'Heebo', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 14px;
  cursor: pointer;
  text-align: center;
  transition: background 200ms;
}
html[dir="rtl"] /* ── "Continue in The Lab" button ── */
.pbp-lab-btn { direction: rtl; }

.pbp-lab-btn.visible { display: block; }
.pbp-lab-btn:hover { background: rgba(29, 66, 138, 0.40); }

/* ── Fuel mini-bar inside panel ── */
.pbp-fuel-bar {
  height: 3px;
  border-radius: 2px;
  background: #1a2540;
  margin-bottom: 12px;
  overflow: hidden;
}

.pbp-fuel-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 600ms ease;
}

/* ── Backdrop ── */
.prof-bubble-backdrop {
  position: fixed;
  inset: 0;
  z-index: 499;
  background: rgba(0,0,0,0.4);
  animation: fade-in 200ms ease;
}

/* ── Live pulse dot on tag ── */
.prof-card-bubble .pb-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: live-pulse 1.8s ease-in-out infinite;
}

/* ── Flash border when content updates ── */
.prof-card-bubble.bubble-updated {
  animation: bubble-flash 700ms ease-out;
}

/* ── Updated timestamp in panel ── */
.pbp-updated-time {
  font-family: 'Heebo', sans-serif;
  font-size: 10px;
  color: #4a5568;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
html[dir="rtl"] /* ── Updated timestamp in panel ── */
.pbp-updated-time { direction: rtl; }

.pbp-updated-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
  animation: live-pulse 1.8s ease-in-out infinite;
}

/* ── Animations ── */
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(6px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes bubble-flash {
  0%   { border-color: var(--pb-grade-color, #22c55e);
         box-shadow: 0 0 0 0 color-mix(in srgb, var(--pb-grade-color, #22c55e) 50%, transparent); }
  50%  { border-color: var(--pb-grade-color, #22c55e);
         box-shadow: 0 0 0 5px color-mix(in srgb, var(--pb-grade-color, #22c55e) 0%, transparent); }
  100% { border-color: rgba(255,255,255,0.10); box-shadow: none; }
}

@keyframes live-pulse {
  0%, 100% { opacity: 1;   transform: scale(1);   }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

@keyframes panel-slide-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes panel-slide-down {
  from { transform: translateY(0); }
  to   { transform: translateY(100%); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
