:root {
  --primary-blue: #4c47f7;
  --bg-color: #f0f4f9;
  --agent-bubble: #f1f3f4;
  --user-bubble: #4c47f7;
  --text-dark: #3c4043;
}

* { 
  margin: 0; 
  padding: 0; 
  box-sizing: border-box; 
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

header {
  background: var(--primary-blue);
  color: white;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

/* Main Layout Container */
.main-layout {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px;
  gap: 20px;
  min-height: 0; /* Important for flex child scrolling */
}

/* Content Wrapper - This creates the 50/50 split */
.content-wrapper {
  display: flex;
  flex: 1;
  gap: 20px;
  min-height: 0;
}

/* Left Column: Video (50%) */
.meeting-column {
  flex: 1; 
  display: flex;
  flex-direction: column;
  gap: 15px;
  min-width: 0;
}

.video-box {
  flex: 1;
  background: #1a1a1a;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid transparent;
  transition: border-color 0.3s ease;
}

/* Visual cue for when someone is speaking */
.video-box.speaking-active {
  border-color: var(--primary-blue);
}

.media-fit-container {
  width: 100%;
  height: 100%;
}

.media-fit-container img, 
.media-fit-container video {
  width: 100%;
  height: 100%;
  object-fit: cover; 
  object-position: center 20%; 
}

/* Mirror the user's camera feed correctly */
#cameraPreview {
  transform: scaleX(-1);
}

/* Right Column: Transcript (50%) */
.transcript-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 16px;
  border: 1px solid #ddd;
  min-width: 0;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.transcript-header {
  padding: 15px 20px;
  font-weight: bold;
  font-size: 1.1rem;
  border-bottom: 1px solid #eee;
  color: var(--text-dark);
}

/* Ensure the message row doesn't restrict height */
.message {
  display: flex;
  width: 100%;
  margin-bottom: 12px;
  height: auto; /* Allow the row to grow with the bubble */
}

/* Make sure the transcript list handles its children correctly */
#messages {
  flex-grow: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 20px;
}

/* Agent (Teacher) on the left */
.message.agent {
  justify-content: flex-start;
}

/* User (You) on the right */
.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: 85%; /* Give a bit more room */
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.5;
  
  /* CRITICAL FIXES FOR CUT-OFF TEXT */
  height: auto;           /* Let it grow vertically */
  word-wrap: break-word;   /* Wrap long words */
  overflow-wrap: anywhere; /* Break anywhere if necessary */
  display: block;          /* Ensure it's not restricted by flex/inline */
}

/* Styling for Agent Bubbles */
.message.agent .bubble {
  background-color: var(--agent-bubble);
  color: var(--text-dark);
  border-bottom-left-radius: 4px;
}

/* Styling for User Bubbles */
.message.user .bubble {
  background-color: var(--user-bubble);
  color: white;
  border-bottom-right-radius: 4px;
}

/* Typing Indicator Styling */
.typing-indicator {
  display: inline-block;
  margin-left: 5px;
}

.typing-indicator::after {
  content: '...';
  animation: blink 1.5s infinite;
}

@keyframes blink {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

/* Controls Bar at Bottom */
.controls-bar {
  display: flex;
  justify-content: center;
  gap: 15px;
  padding: 15px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.btn-start, .btn-camera {
  padding: 12px 30px;
  border-radius: 30px;
  border: none;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-start { background-color: #34a853; }
.btn-camera { background-color: #ea4335; }

.btn-start:hover, .btn-camera:hover {
  opacity: 0.9;
}

/* Participant Labels */
.participant-label {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  pointer-events: none;
}