/* Professor NewRolly chat — uses site CSS variables for theme (light/dark) */
.professor-chat {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.professor-chat__heading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.professor-chat__messages {
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 1rem;
  padding-right: 0.25rem;
}

.professor-chat__message {
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

.professor-chat__message p {
  margin: 0;
  color: var(--text);
}

.professor-chat__message--user {
  text-align: right;
}

.professor-chat__message--user p {
  display: inline-block;
  padding: 0.4rem 0.75rem;
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 12px 12px 4px 12px;
  max-width: 85%;
}

.professor-chat__message--bot p {
  color: var(--muted);
}

.professor-chat__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.professor-chat__chip {
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
  background: var(--bg);
  color: var(--link);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.professor-chat__chip:hover {
  border-color: var(--link);
  background: var(--bg-card);
}

.professor-chat__form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.professor-chat__input {
  flex: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}

.professor-chat__input::placeholder {
  color: var(--muted);
}

.professor-chat__input:focus {
  outline: none;
  border-color: var(--link);
}

.professor-chat__submit {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.professor-chat__submit:hover {
  filter: brightness(0.95);
}

.professor-chat__submit:focus {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

/* ===== Sim page layout: chat panel left, aligned with site header ===== */
.sim-page-with-chat {
  display: flex;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}
.sim-page-with-chat .professor-chat {
  width: 280px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  border-radius: 0;
  border: none;
  border-right: 1px solid var(--border);
  height: 100vh;
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
}
.sim-page-with-chat #professor-chat {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: 60vh;
  max-height: 60vh;
  min-height: 0;
}
/* Ad slot below chat (same column); add a child with class .professor-chat__ad when ready */
.sim-page-with-chat .professor-chat__ad {
  flex: 1;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.sim-page-with-chat .chat-column {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 280px;
  height: 100vh;
  max-height: 100vh;
  border-right: none;
  border-radius: 0 16px 16px 0;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  align-self: flex-start;
  background: var(--bg-card);
  overflow: hidden;
}
.sim-page-with-chat .chat-column .professor-chat {
  border-right: none;
  border-radius: 0;
}
html[data-theme="dark"] .sim-page-with-chat .chat-column {
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.3);
}
.sim-page-with-chat main,
.sim-page-with-chat .wrap {
  flex: 1;
  min-width: 0;
}

/* Drawer toggle and backdrop: hidden on desktop, shown on mobile */
.professor-chat__drawer-toggle,
.professor-chat__drawer-backdrop {
  display: none;
}

/* ===== Mobile: chat as swipeable drawer overlay ===== */
@media (max-width: 900px) {
  .professor-chat__drawer-toggle {
    display: flex;
  }
  .sim-page-with-chat .chat-column {
    width: 0;
    min-width: 0;
    flex: 0 0 0;
    overflow: visible;
    border-right: none;
    height: 0;
    max-height: none;
    padding: 0;
    margin: 0;
  }
  .sim-page-with-chat .professor-chat__ad {
    display: none;
  }
  .sim-page-with-chat {
    flex-direction: row;
    min-height: 100vh;
  }
  .sim-page-with-chat main,
  .sim-page-with-chat .wrap {
    padding-bottom: 5rem;
    padding-left: 1rem;
  }
  .sim-page-with-chat .professor-chat {
    position: fixed;
    top: 0;
    left: 0;
    width: min(320px, 88vw);
    max-width: 320px;
    height: 100vh;
    min-height: 100vh;
    z-index: 1001;
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 0.25s ease-out, box-shadow 0.25s ease-out;
    box-shadow: none;
    pointer-events: none; /* closed drawer must not block taps on main content */
  }
  .sim-page-with-chat .professor-chat.professor-chat--drawer-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
  }
  .professor-chat__drawer-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.2s;
  }
  .professor-chat__drawer-backdrop.professor-chat__drawer-backdrop--open {
    display: block;
    opacity: 1;
  }
  .professor-chat__drawer-toggle {
    position: fixed;
    bottom: 1.25rem;
    right: 1rem;
    left: auto;
    z-index: 999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: var(--accent-text);
    font-size: 1.25rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(254, 225, 97, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
  }
.professor-chat__drawer-toggle:hover {
  filter: brightness(0.95);
}
.professor-chat__drawer-toggle:focus {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}
  /* Tool cards and main content: ensure tappable on mobile */
  .sim-page-with-chat .tool-card {
    min-height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* ===== Panel layout: uses site theme vars (light/dark) ===== */
.professor-chat--panel {
  background: var(--bg-card);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}
.sim-page-with-chat .professor-chat--panel {
  height: 100%;
  max-height: 100vh;
  min-height: 0;
}
.professor-chat--panel .professor-chat__header {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  background: var(--bg-card);
}
.professor-chat--panel .professor-chat__drawer-close {
  display: none;
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
}
.professor-chat--panel .professor-chat__drawer-close:hover {
  color: var(--text);
}
.professor-chat--panel .professor-chat__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: url('../newrolly.png') no-repeat;
  background-size: 280%;
  background-position: 50% 10%;
  flex-shrink: 0;
}
.professor-chat--panel .professor-chat__name {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--link);
}
.professor-chat--panel .professor-chat__status {
  font-size: 0.62rem;
  color: var(--muted);
}
.professor-chat--panel .professor-chat__messages--panel {
  flex: 1;
  overflow-y: auto;
  padding: 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
  max-height: none;
  margin-bottom: 0;
  scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.professor-chat--panel .professor-chat__messages--panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.12);
}
.professor-chat--panel .professor-chat__messages--panel::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.25);
}
.professor-chat--panel .professor-chat__msg {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  animation: professorChatIn 0.3s ease;
}
.professor-chat--panel .professor-chat__msg--user {
  flex-direction: row-reverse;
}
.professor-chat--panel .professor-chat__msg-av {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  flex-shrink: 0;
  margin-top: 2px;
  background: url('../newrolly.png') no-repeat;
  background-size: 280%;
  background-position: 50% 10%;
}
.professor-chat--panel .professor-chat__bubble {
  background: var(--bg);
  border-radius: 2px 10px 10px 10px;
  padding: 0.4rem 0.6rem;
  font-size: 0.75rem;
  line-height: 1.45;
  max-width: 210px;
  color: var(--text);
  word-break: break-word;
}
.professor-chat--panel .professor-chat__bubble--user {
  background: var(--accent);
  color: var(--accent-text);
  border-radius: 10px 2px 10px 10px;
}
.professor-chat--panel .professor-chat__time {
  font-size: 0.5rem;
  color: var(--muted);
  margin-top: 0.15rem;
  display: block;
}
.professor-chat--panel .professor-chat__msg--user .professor-chat__time {
  text-align: right;
}
@keyframes professorChatIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.professor-chat--panel .professor-chat__chips {
  margin-bottom: 0.5rem;
}
.professor-chat--panel .professor-chat__chip {
  background: var(--bg-card);
  color: var(--link);
  border-color: var(--border);
}
.professor-chat--panel .professor-chat__chip:hover {
  border-color: var(--accent);
  background: var(--bg-card);
}
.professor-chat--panel .professor-chat__input-row {
  padding: 0.45rem 0.65rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.professor-chat--panel .professor-chat__real-input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.35rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text);
  outline: none;
}
.professor-chat--panel .professor-chat__real-input:focus {
  border-color: var(--accent);
}
.professor-chat--panel .professor-chat__real-input::placeholder {
  color: var(--muted);
}
.professor-chat--panel .professor-chat__send-btn {
  background: var(--accent);
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  color: var(--accent-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  transition: 0.15s;
}
.professor-chat--panel .professor-chat__send-btn:hover {
  filter: brightness(0.95);
}
