/* Base Reset & Variables */
:root {
  --bg-color: #0b0b0b;
  --surface-color: #1a1a1a;
  --primary-color: #4a90e2;
  --danger-color: #ea4335;
  --text-main: #ffffff;
  --text-muted: #b0b0b0;
  --border-radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.classroom-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background-color: var(--surface-color);
  border-bottom: 1px solid #333;
}

.class-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-badge {
  background-color: var(--danger-color);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
}

#class-title {
  font-size: 18px;
  font-weight: 500;
}

.status-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

/* Main Workspace (Grid) */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 16px;
  gap: 16px;
}

.main-stage {
  flex: 1;
  background-color: #000;
  border-radius: var(--border-radius);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-container {
  width: 100%;
  height: 100%;
  position: relative;
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name-badge {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background-color: rgba(0, 0, 0, 0.6);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
}

/* Students Sidebar */
.students-sidebar {
  width: 300px;
  background-color: var(--surface-color);
  border-radius: var(--border-radius);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #333;
}

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 500;
}

.students-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-content: flex-start;
}

/* The box injected by teacher.js */
.student-box {
  aspect-ratio: 16/9;
  background-color: #2a2a2a;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  border: 2px solid transparent;
}

/* Bottom Controls */
.controls-bar {
  height: 80px;
  background-color: var(--surface-color);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0 24px;
  position: relative;
}

.controls-group {
  display: flex;
  gap: 16px;
}

.controls-group.right {
  position: absolute;
  right: 24px;
}

.control-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background-color: #333;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background-color: #444;
}

.control-btn.active {
  background-color: var(--primary-color);
}

.end-btn {
  background-color: var(--danger-color);
}

.end-btn:hover {
  background-color: #c53027;
}
/* Login & Dashboard specific styles */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background-color: var(--surface-color);
  padding: 40px;
  border-radius: var(--border-radius);
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.input-group {
  display: flex;
  flex-direction: column;
  margin-top: 20px;
}

.input-group input {
  padding: 12px;
  margin-top: 8px;
  background-color: #2a2a2a;
  border: 1px solid #444;
  color: white;
  border-radius: 8px;
}

.primary-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 24px;
  width: 100%;
}

.error-text {
  color: var(--danger-color);
  margin-top: 12px;
  font-size: 14px;
  text-align: center;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.class-card {
  background-color: var(--surface-color);
  padding: 24px;
  border-radius: var(--border-radius);
  border: 1px solid #333;
}
.student-box {
  position: relative; 
}

/* The Raised Hand Icon */
.raised-hand-indicator {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #fbbc04; /* Google Meet Yellow */
  color: #202124;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  z-index: 10;
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
/* ==========================================
   CHAT PANEL STYLES
   ========================================== */
.chat-panel {
  position: fixed;
    right: 20px;
    bottom: 100px;
    width: 320px;
    height: 400px;
    background:#1e1e1e;
    border-radius:12px;
    display:flex;
    flex-direction:column;
    box-shadow:0 8px 24px rgba(0,0,0,.5);
    border:1px solid #333;
    overflow:hidden;
    z-index:100;
    transition:transform .3s ease,opacity .3s ease;
    visibility:visible;
}

.chat-header {
  background: #2a2a2a;
  padding: 12px;
  font-weight: bold;
  text-align: center;
  border-bottom: 1px solid #444;
  font-size: 14px;
}

.chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  background: #333;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  max-width: 85%;
  line-height: 1.4;
  word-wrap: break-word;
}

.chat-message.self {
  background: #007bff;
  align-self: flex-end;
}

.chat-input-area {
  display: flex;
  padding: 10px;
  background: #111;
  border-top: 1px solid #333;
}

#chat-input {
  flex: 1;
  padding: 10px 15px;
  border-radius: 20px;
  border: none;
  background: #2a2a2a;
  color: white;
  outline: none;
  font-size: 13px;
}

#send-chat-btn {
  background: transparent;
  border: none;
  color: #007bff;
  cursor: pointer;
  margin-left: 8px;
  display: flex;
  align-items: center;
  padding: 5px;
}
#send-chat-btn:hover {
  color: #339af0;
}
.student-box {
  order: 0; /* Default position for everyone */
  transition: all 0.3s ease; /* Smooth animation when they start/stop speaking */
}

.student-box.speaking {
  order: -1; /* Negative order instantly bumps them to the very top/front! */
  border: 4px solid #4CAF50 !important; /* Green glowing border */
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.8);
  transform: scale(1.02); 
  z-index: 100;
}
html,
body {
    height: 100%;
    margin: 0;
}

body {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.top-bar {
    flex-shrink: 0;
}

.scrollable-workspace {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.chat-panel.hidden {
    transform: translateX(110%);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}