/* ── Mimr Guide Panel CSS ──────────────────────────────────────────────── */

/* ── Right-panel tab bar ──────────────────────────────────────────────── */

.rp-tab-bar {
  display: flex;
  border-bottom: 1px solid var(--line, #e2e8f0);
  background: var(--card, #fff);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
}

.rp-tab {
  flex: 1;
  padding: 10px 8px 9px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted, #64748b);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  font-family: inherit;
  text-align: center;
}

.rp-tab:hover {
  color: var(--text, #172033);
}

.rp-tab.rp-tab--active {
  color: var(--primary, #2563eb);
  border-bottom-color: var(--primary, #2563eb);
}

.rp-tab .rp-tab-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  margin-left: 5px;
  vertical-align: middle;
  opacity: 0;
  transition: opacity 0.2s;
}

.rp-tab .rp-tab-dot.is-visible {
  opacity: 1;
}

/* ── Tab panes ─────────────────────────────────────────────────────────── */

.rp-pane-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rp-pane {
  display: contents;
}

.rp-pane.rp-pane--hidden {
  display: none;
}

/* ── Guide panel container ─────────────────────────────────────────────── */

#guideMount {
  display: flex;
  flex-direction: column;
  background: var(--card, #fff);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 12px;
  overflow: hidden;
  min-height: 280px;
}

/* ── Guide header ──────────────────────────────────────────────────────── */

.gp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line, #e2e8f0);
  flex-shrink: 0;
}

.gp-header-left {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.gp-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text, #172033);
  letter-spacing: 0.02em;
}

.gp-subtitle {
  font-size: 10.5px;
  color: var(--muted, #64748b);
}

.gp-lost-btn {
  font-size: 11px;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 20px;
  padding: 4px 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}

.gp-lost-btn:hover {
  background: #fde68a;
  border-color: #f59e0b;
}

/* ── Main content area ─────────────────────────────────────────────────── */

.gp-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Empty state ───────────────────────────────────────────────────────── */

.gp-empty {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gp-empty-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted, #64748b);
  margin-bottom: 2px;
}

.gp-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gp-action-btn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg, #f3f6fb);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  font-family: inherit;
}

.gp-action-btn:hover {
  background: #edf2fb;
  border-color: rgba(37, 99, 235, 0.2);
}

.gp-action-btn:active {
  transform: scale(0.97);
}

.gp-action-icon {
  font-size: 16px;
  line-height: 1;
}

.gp-action-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #172033);
}

.gp-action-desc {
  font-size: 10.5px;
  color: var(--muted, #64748b);
  line-height: 1.3;
}

/* ── Loading state ─────────────────────────────────────────────────────── */

.gp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  flex: 1;
}

.gp-loading-dots {
  display: flex;
  gap: 6px;
}

.gp-loading-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  opacity: 0.3;
  animation: gp-dot-pulse 1.2s ease-in-out infinite;
}

.gp-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.gp-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes gp-dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.25); }
}

.gp-loading-label {
  font-size: 11.5px;
  color: var(--muted, #64748b);
}

/* ── Card ──────────────────────────────────────────────────────────────── */

.gp-card {
  padding: 16px;
  animation: gp-card-in 0.22s ease both;
}

@keyframes gp-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.gp-card-mode {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary, #2563eb);
  margin-bottom: 10px;
}

.gp-card-body {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text, #172033);
  margin-bottom: 14px;
}

.gp-card-body strong {
  font-weight: 700;
}

.gp-card-body em {
  font-style: italic;
}

.gp-card-body p {
  margin: 0 0 10px;
}

.gp-card-body p:last-child {
  margin-bottom: 0;
}

.gp-card-body ol,
.gp-card-body ul {
  margin: 6px 0 10px;
  padding-left: 20px;
}

.gp-card-body li {
  margin-bottom: 4px;
}

/* ── Confidence badge ──────────────────────────────────────────────────── */

.gp-confidence {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 20px;
  padding: 3px 9px;
  margin-bottom: 14px;
}

.gp-confidence::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.gp-conf-direct {
  background: #dcfce7;
  color: #15803d;
}
.gp-conf-direct::before { background: #16a34a; }

.gp-conf-partial {
  background: #fef9c3;
  color: #854d0e;
}
.gp-conf-partial::before { background: #ca8a04; }

.gp-conf-absent {
  background: #fee2e2;
  color: #991b1b;
}
.gp-conf-absent::before { background: #dc2626; }

/* ── Empty state hint ──────────────────────────────────────────────────── */

.gp-empty-hint {
  font-size: 11.5px;
  color: var(--muted, #64748b);
  line-height: 1.4;
  margin-top: -4px;
}

/* ── Card action row (copy + save) ─────────────────────────────────────── */

.gp-card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.gp-action-link {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted, #64748b);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.12s;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: transparent;
}

.gp-action-link:hover {
  color: var(--text, #172033);
  text-decoration-color: currentColor;
}

.gp-save-btn {
  color: #0d9488;
}

.gp-save-btn:hover {
  color: #0f766e;
  text-decoration-color: currentColor;
}

.gp-save-btn--saved {
  color: #15803d !important;
  text-decoration: none !important;
  cursor: default;
}

.gp-save-btn--saved:hover {
  color: #15803d !important;
}

.gp-remove-btn {
  color: #dc2626;
  font-size: 11px;
}

.gp-remove-btn:hover {
  color: #b91c1c;
  text-decoration-color: currentColor;
}

.gp-remove-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── Follow-up chips ───────────────────────────────────────────────────── */

.gp-followups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.gp-followup-btn {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--primary, #2563eb);
  background: var(--primary-soft, #dbeafe);
  border: none;
  border-radius: 20px;
  padding: 5px 11px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s;
}

.gp-followup-btn:hover {
  background: var(--primary-light, #bfdbfe);
}

/* ── Feedback row ──────────────────────────────────────────────────────── */

.gp-feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line, #e2e8f0);
  padding-top: 12px;
}

.gp-feedback-lbl {
  font-size: 11px;
  color: var(--muted, #64748b);
  flex: 1;
}

.gp-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.1);
  background: transparent;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s;
  font-family: inherit;
  line-height: 1;
}

.gp-thumb:hover {
  background: rgba(0, 0, 0, 0.06);
}

.gp-thumb.is-selected-positive {
  background: #dcfce7;
  border-color: #86efac;
  color: #15803d;
}

.gp-thumb.is-selected-negative {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

/* ── Recovery panel (shown after thumbs down) ──────────────────────────── */

.gp-recovery {
  margin-top: 14px;
  padding: 12px;
  background: #fef3c7;
  border: 1px solid #fde68a;
  border-radius: 10px;
}

.gp-recovery-lbl {
  font-size: 11px;
  font-weight: 600;
  color: #92400e;
  display: block;
  margin-bottom: 8px;
}

.gp-recovery-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.gp-recovery-btn {
  font-size: 11px;
  font-weight: 500;
  color: #92400e;
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 7px;
  padding: 7px 8px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  line-height: 1.3;
  transition: background 0.12s;
}

.gp-recovery-btn:hover {
  background: #fffbeb;
  border-color: #f59e0b;
}

/* ── I'm Lost panel ────────────────────────────────────────────────────── */

.gp-lost {
  padding: 16px;
  animation: gp-card-in 0.2s ease both;
}

.gp-lost-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #172033);
  margin-bottom: 4px;
}

.gp-lost-desc {
  font-size: 12px;
  color: var(--muted, #64748b);
  margin-bottom: 14px;
  line-height: 1.4;
}

.gp-lost-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.gp-lost-option {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--bg, #f3f6fb);
  border: 1px solid rgba(0, 0, 0, 0.07);
  border-radius: 10px;
  padding: 11px 12px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
  font-family: inherit;
}

.gp-lost-option:hover {
  background: #fef9c3;
  border-color: #fde68a;
}

.gp-lost-option-icon {
  font-size: 16px;
}

.gp-lost-option-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text, #172033);
}

.gp-lost-option-desc {
  font-size: 10.5px;
  color: var(--muted, #64748b);
  line-height: 1.3;
}

.gp-lost-back {
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--primary, #2563eb);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Teaching Style row ────────────────────────────────────────────────── */

.gp-style-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--line, #e2e8f0);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.gp-style-lbl {
  font-size: 10.5px;
  color: var(--muted, #64748b);
  white-space: nowrap;
  margin-right: 2px;
}

.gp-style-chip {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted, #64748b);
  background: transparent;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 20px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.gp-style-chip:hover {
  border-color: var(--primary, #2563eb);
  color: var(--primary, #2563eb);
}

.gp-style-chip.is-active {
  background: var(--primary-soft, #dbeafe);
  border-color: transparent;
  color: var(--primary, #2563eb);
  font-weight: 600;
}

/* ── Input row ─────────────────────────────────────────────────────────── */

.gp-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line, #e2e8f0);
  flex-shrink: 0;
}

.gp-input {
  flex: 1;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--text, #172033);
  background: var(--bg, #f3f6fb);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 8px 10px;
  resize: none;
  line-height: 1.4;
  min-height: 36px;
  max-height: 80px;
  transition: border-color 0.15s;
  overflow-y: auto;
}

.gp-input::placeholder { color: var(--muted, #64748b); opacity: 0.6; }
.gp-input:focus { outline: none; border-color: var(--primary, #2563eb); }

.gp-send-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary, #2563eb);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  align-self: flex-end;
  transition: background 0.12s, opacity 0.12s;
  font-family: inherit;
}

.gp-send-btn:hover { background: var(--primary-dark, #1d4ed8); }
.gp-send-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.gp-send-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Previous link ─────────────────────────────────────────────────────── */

.gp-prev-link {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--primary, #2563eb);
  background: none;
  border: none;
  padding: 8px 16px;
  cursor: pointer;
  font-family: inherit;
  border-top: 1px solid var(--line, #e2e8f0);
  width: 100%;
  text-align: left;
  flex-shrink: 0;
}

.gp-prev-link:hover { text-decoration: underline; }

/* ── Mobile FAB ────────────────────────────────────────────────────────── */

#guideFab {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 400;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--primary, #2563eb);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: transform 0.15s, box-shadow 0.15s;
}

#guideFab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(37, 99, 235, 0.5);
}

#guideFab .gp-fab-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f97316;
  border: 2px solid #fff;
  display: none;
}

#guideFab .gp-fab-badge.is-visible {
  display: block;
}

@media (max-width: 1100px) {
  #guideFab {
    display: flex;
  }

  .lesson-resources-panel.rp-open {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    z-index: 350;
    max-height: 70vh;
    border-radius: 16px 16px 0 0;
    overflow-y: auto;
    background: var(--bg, #f3f6fb);
    box-shadow: 0 -4px 32px rgba(15, 23, 42, 0.2);
    padding: 16px;
    flex-direction: column;
    gap: 12px;
  }

  .lesson-resources-panel.rp-open::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.15);
    margin: 0 auto 8px;
    flex-shrink: 0;
  }

  .gp-action-grid,
  .gp-lost-grid,
  .gp-recovery-btns {
    grid-template-columns: 1fr;
  }
}

/* ── Selection tooltip ─────────────────────────────────────────────────── */

.sel-tooltip {
  position: absolute;
  z-index: 500;
  background: var(--dark, #101827);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 155px;
  pointer-events: all;
}

.sel-tooltip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom: none;
  border-top-color: var(--dark, #101827);
}

.sel-tooltip--below::after {
  bottom: auto;
  top: -6px;
  border-top: none;
  border-bottom: 6px solid var(--dark, #101827);
}

.sel-tooltip-sep {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 2px 0;
}

.sel-tooltip-btn {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 10px;
  text-align: left;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.sel-tooltip-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
