/* ==========================================================================
   Trifid Idiomas - CSS System
   ========================================================================== */

:root {
  /* Colors - Dark Mode Default */
  --bg-main: #0B0E14;
  --bg-card: #151A23;
  --bg-hover: #1E2532;
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  
  --primary: #6366F1;
  --primary-hover: #4F46E5;
  --danger: #EF4444;
  --success: #10B981;
  
  /* Layout */
  --header-height: 70px;
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* Typography */
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
}

[data-theme="light"] {
  --bg-main: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-hover: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

/* ==========================================================================
   Components
   ========================================================================== */

.app-header {
  height: var(--header-height);
  padding: 0 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background-color: rgba(11, 14, 20, 0.8);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #A855F7);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.app-container {
  min-height: calc(100vh - var(--header-height));
  position: relative;
}

.view {
  display: none;
  animation: fadeIn 0.4s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Selection View
   ========================================================================== */

#selection-view {
  padding: 60px 5%;
  max-width: 1400px;
  margin: 0 auto;
}

.hero-section {
  text-align: center;
  margin-bottom: 60px;
}

.hero-section h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: 16px;
}

.text-gradient {
  background: linear-gradient(135deg, var(--primary), #A855F7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-section p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto;
}

.filters {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 40px;
}

.filter-btn {
  padding: 8px 24px;
  border-radius: var(--radius-full);
  background-color: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-weight: 500;
  transition: all 0.2s;
}

.filter-btn:hover {
  background-color: var(--bg-hover);
}

.filter-btn.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

.professors-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 30px;
}

.professor-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: transform 0.3s, box-shadow 0.3s;
  display: flex;
  flex-direction: column;
}

.professor-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.card-header {
  height: 220px;
  position: relative;
  overflow: hidden;
}

.card-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  transition: transform 0.5s;
}

.professor-card:hover .card-bg {
  transform: scale(1.05);
}

.card-flag {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 1.2rem;
}

.card-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-body h3 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.tagline {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.tag {
  background-color: rgba(255, 255, 255, 0.05);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.btn-start {
  margin-top: auto;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  background-color: var(--primary);
  color: white;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background-color 0.2s;
}

.btn-start:hover {
  background-color: var(--primary-hover);
}

/* ==========================================================================
   Classroom View
   ========================================================================== */

#classroom-view {
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

.classroom-layout {
  display: grid;
  grid-template-columns: 1fr 350px;
  height: 100%;
}

@media (max-width: 992px) {
  .classroom-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 35vh; /* Less height for captions on mobile */
  }
  
  .hero-section h1 {
    font-size: 2rem;
  }
  
  .professors-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .app-header {
    padding: 0 16px;
  }
  
  .logo span {
    display: none; /* Hide text logo on very small screens */
  }
  
  .classroom-layout {
    grid-template-rows: 1fr 300px;
  }
  
  .video-container {
    padding: 12px;
  }
  
  .video-header {
    margin-bottom: 12px;
  }
  
  .class-info {
    padding: 6px 12px;
    gap: 8px;
    font-size: 0.9rem;
  }
  
  .mode-selector select {
    padding: 6px 12px;
    font-size: 0.85rem;
  }
  
  .professor-video-frame {
    border-radius: var(--radius-md);
  }
  
  .avatar-container img {
    max-height: 70%;
  }
  
  .student-pip {
    width: 100px;
    height: 75px;
    bottom: 12px;
    right: 12px;
  }
  
  .video-controls {
    gap: 16px;
    margin-top: 16px;
  }
  
  .icon-circle {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
  }
  
  .btn-start-call {
    padding: 12px 24px;
    font-size: 1rem;
  }
}

.video-container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-main);
  position: relative;
  min-height: 0;
}

.video-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-secondary);
  font-weight: 500;
}

.btn-back:hover {
  color: var(--text-primary);
}

.class-info {
  display: flex;
  align-items: center;
  gap: 16px;
  background-color: var(--bg-card);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.live-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--success);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.timer {
  font-family: monospace;
  font-size: 1.1rem;
}

.mode-selector select {
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  outline: none;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
}

.professor-video-frame {
  flex: 1;
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 100px rgba(0,0,0,0.5);
  min-height: 0;
}

.avatar-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  position: relative;
}

.avatar-container img {
  max-width: 100%;
  max-height: 85%;
  object-fit: contain;
  filter: drop-shadow(0 20px 30px rgba(0,0,0,0.5));
  transition: transform 0.2s;
}

/* Speaking Animation - Subtle scale instead of bobbing */
.avatar-container.speaking img {
  /* animation: bob 2s infinite alternate ease-in-out; */
  transform: scale(1.02);
}

@keyframes bob {
  0% { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

.mouth-overlay {
  position: absolute;
  /* Match the main image layout */
  max-width: 100%;
  max-height: 85%;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  object-fit: contain;
  pointer-events: none;
  display: none;
  z-index: 10;
  /* Coordinates set via inline styles in app.js */
  clip-path: ellipse(var(--mouth-w, 4%) var(--mouth-h, 3%) at var(--mouth-x, 50%) var(--mouth-y, 75%));
  transform-origin: var(--mouth-x, 50%) var(--mouth-y, 75%);
  filter: brightness(1.08) contrast(1.05);
}

.avatar-container.speaking .mouth-overlay {
  display: block;
}

.speaking-indicator {
  position: absolute;
  bottom: 40px;
  display: none;
  gap: 4px;
  align-items: center;
  height: 30px;
  background: rgba(0,0,0,0.5);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  backdrop-filter: blur(4px);
}

.avatar-container.speaking .speaking-indicator {
  display: flex;
}

.speaking-indicator .bar {
  width: 4px;
  background-color: white;
  border-radius: 2px;
  animation: soundwave 1s infinite alternate ease-in-out;
}

.speaking-indicator .bar:nth-child(1) { height: 40%; animation-delay: 0.1s; }
.speaking-indicator .bar:nth-child(2) { height: 80%; animation-delay: 0.2s; }
.speaking-indicator .bar:nth-child(3) { height: 100%; animation-delay: 0.3s; }
.speaking-indicator .bar:nth-child(4) { height: 60%; animation-delay: 0.4s; }
.speaking-indicator .bar:nth-child(5) { height: 50%; animation-delay: 0.5s; }

@keyframes soundwave {
  0% { transform: scaleY(0.5); opacity: 0.7; }
  100% { transform: scaleY(1); opacity: 1; }
}

.professor-nameplate {
  position: absolute;
  bottom: 24px;
  left: 24px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.student-pip {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 160px;
  height: 120px;
  background-color: #000;
  border-radius: var(--radius-md);
  border: 2px solid rgba(255,255,255,0.1);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 20px rgba(0,0,0,0.3);
}

.student-placeholder {
  font-size: 2rem;
  color: var(--text-secondary);
}

.start-call-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius-lg);
}

.btn-start-call {
  background-color: var(--primary);
  color: white;
  padding: 16px 32px;
  border-radius: var(--radius-full);
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-start-call:hover {
  transform: scale(1.05);
  background-color: var(--primary-hover);
}

.btn-start-call i {
  font-size: 1.5rem;
}

.video-controls {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
}

.control-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.control-btn:hover {
  color: var(--text-primary);
}

.icon-circle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.2s;
}

.control-btn:hover .icon-circle {
  background-color: var(--bg-hover);
  transform: translateY(-2px);
}

.control-btn.active .icon-circle {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: white;
  color: white;
}

/* Mic button states */
#btn-mic .icon-circle {
  background-color: var(--bg-hover);
}
#btn-mic.listening .icon-circle {
  background-color: var(--primary);
  color: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.3);
}

.control-btn.danger:hover .icon-circle {
  background-color: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: white;
  color: #333;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease-out;
  border-left: 4px solid var(--primary);
  font-weight: 500;
}

.toast.success { border-left-color: #10B981; }
.toast.error { border-left-color: #EF4444; }
.toast.info { border-left-color: #3B82F6; }

.toast i { font-size: 1.2rem; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* Sidebar */
.sidebar {
  background-color: var(--bg-card);
  border-left: 1px solid rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.tab-btn {
  flex: 1;
  padding: 16px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
  min-height: 0;
}

.tab-content.active {
  display: flex;
}

.captions-toolbar {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

/* Toggle Switch */
.toggle-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch .slider {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  background-color: var(--bg-hover);
  border-radius: 20px;
  transition: 0.4s;
}

.toggle-switch .slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  transition: 0.4s;
}

.toggle-switch input:checked + .slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .slider:before {
  transform: translateX(16px);
  background-color: white;
}

.captions-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.captions-container::-webkit-scrollbar {
  width: 6px;
}
.captions-container::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 3px;
}

.system-message {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 8px 0;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.professor {
  align-self: flex-start;
  background-color: var(--bg-hover);
  border-bottom-left-radius: 4px;
}

.chat-bubble.student {
  align-self: flex-end;
  background-color: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
  transition: all 0.3s ease;
}

.chat-bubble.student.corrected {
  animation: highlight 1s ease;
}

@keyframes highlight {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); background-color: var(--primary-hover); }
  100% { transform: scale(1); }
}

.chat-bubble.interim {
  opacity: 0.7;
  font-style: italic;
}

.translation {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-style: italic;
}

.translation-loading {
  display: block;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.listening-status {
  padding: 16px;
  background-color: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--primary);
  border-top: 1px solid rgba(255,255,255,0.05);
  opacity: 0;
  transition: opacity 0.2s;
}

.listening-status.active {
  opacity: 1;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  background-color: var(--primary);
  border-radius: 50%;
  animation: pulse-primary 1s infinite;
}

@keyframes pulse-primary {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

/* Info Tab */
#tab-info {
  padding: 24px;
  overflow-y: auto;
}

.professor-details h3 {
  margin-bottom: 8px;
}

.professor-details p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 20px;
}

.class-tips {
  background-color: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  padding: 16px;
  border-radius: var(--radius-md);
  margin-top: 24px;
}

.class-tips h3 {
  color: var(--primary);
  font-size: 1rem;
  margin-bottom: 12px;
}

.class-tips ul {
  padding-left: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.class-tips li {
  margin-bottom: 8px;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */

.loading-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--bg-main);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255,255,255,0.1);
  border-left-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Settings Modal
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.3s ease;
  overflow: hidden;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-size: 1.25rem;
}

.btn-close {
  font-size: 1.5rem;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.btn-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
}

.modal-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.form-group label i {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 4px;
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrapper i.ri-key-2-line {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
}

.input-wrapper input {
  width: 100%;
  padding: 12px 40px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.input-wrapper input:focus {
  outline: none;
  border-color: var(--primary);
}

.input-wrapper input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-toggle-visibility {
  position: absolute;
  right: 12px;
  color: var(--text-muted);
  transition: color 0.2s;
}

.btn-toggle-visibility:hover {
  color: var(--text-primary);
}

.form-group small {
  display: block;
  margin-top: 6px;
  font-size: 0.8rem;
}

.form-group small a {
  color: var(--primary);
  text-decoration: none;
}

.form-group small a:hover {
  text-decoration: underline;
}

.modal-footer {
  padding: 16px 24px;
  background-color: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-secondary, .btn-primary {
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: all 0.2s;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

/* ==========================================================================
   New Pedagogical Features
   ========================================================================== */

/* Pronunciation Indicator */
.pronunciation-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
}

.pronunciation-indicator .score-label {
  font-weight: 600;
}

.pronunciation-indicator.good .score-label { color: #10B981; }
.pronunciation-indicator.fair .score-label { color: #F59E0B; }
.pronunciation-indicator.poor .score-label { color: #EF4444; }

.pronunciation-indicator .score-notes {
  font-style: italic;
  opacity: 0.85;
  margin-left: 4px;
}

/* Colored border glow on student bubble */
.chat-bubble.student.pronunciation-good {
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.5);
}
.chat-bubble.student.pronunciation-fair {
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.5);
}
.chat-bubble.student.pronunciation-poor {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.5);
}

/* Alternatives */
.alternatives-container {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  animation: slideIn 0.3s ease;
}

.alternatives-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: #A855F7;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.alternative-item {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 3px 0;
  line-height: 1.4;
}

/* ==========================================================================
   UI/UX Premium Mobile & Responsive System (Antigravity Refinement)
   ========================================================================== */

/* Button System Refinement (Generic CSS framework) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--bg-hover);
  color: var(--text-primary);
}

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

/* Scrollable Filter Pills on Mobile */
@media (max-width: 600px) {
  .filters {
    display: flex;
    justify-content: flex-start !important;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding: 4px 16px;
    margin-left: -5%;
    margin-right: -5%;
    scrollbar-width: none; /* Firefox */
  }
  
  .filters::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
  }
  
  .filter-btn {
    flex: 0 0 auto;
    padding: 6px 16px;
    font-size: 0.9rem;
  }
  
  .hero-section {
    margin-bottom: 30px;
    padding: 0 10px;
  }
}

/* Mobile Bottom Navigation Bar Styles */
.mobile-nav-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 65px;
  background-color: rgba(21, 26, 35, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  justify-content: space-around;
  align-items: center;
  z-index: 999;
  padding: 4px 10px 10px 10px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .mobile-nav-bar {
  background-color: rgba(255, 255, 255, 0.9);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  background: none;
  border: none;
  width: 25%;
  height: 100%;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.mobile-nav-item i {
  font-size: 1.35rem;
  transition: transform 0.2s;
}

.mobile-nav-item:hover, .mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item.active i {
  transform: translateY(-2px);
}

@media (max-width: 768px) {
  /* Show bottom nav, hide some header actions in mobile */
  .mobile-nav-bar {
    display: flex;
  }
  
  .app-header .header-actions {
    gap: 8px;
  }
  
  /* Hide unnecessary header elements that are now on bottom nav */
  .app-header .header-actions a[href="/dashboard"],
  .app-header .header-actions #theme-toggle,
  .app-header #settings-toggle {
    display: none !important;
  }
  
  /* Make sure app body doesn't get covered by bottom nav */
  body {
    padding-bottom: 65px;
  }
}

/* Live Subtitles HUD (Overlay on Video) */
.live-subtitles-hud {
  position: absolute;
  bottom: 85px;
  left: 5%;
  right: 5%;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  text-align: center;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: slideInUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.subtitles-text {
  color: #FFFFFF;
  font-size: 1rem;
  line-height: 1.4;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

@keyframes slideInUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Immersive Classroom Video & Controls for Mobile */
@media (max-width: 992px) {
  #classroom-view {
    height: 100vh;
    padding-bottom: 0;
  }
  
  /* When classroom is active, hide mobile nav and lock viewport to prevent scrolling */
  body.classroom-active {
    padding-bottom: 0 !important;
    overflow: hidden !important;
    height: 100vh !important;
    position: fixed !important;
    width: 100% !important;
  }
  
  body.classroom-active .app-header {
    display: none !important;
  }
  
  body.classroom-active .mobile-nav-bar {
    display: none !important;
  }
  
  .classroom-layout {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important; /* Video fills the screen, sidebar is an overlay */
    position: relative;
    overflow: hidden;
  }
  
  .video-container {
    height: 100% !important;
    padding: 12px;
  }
  
  /* Clean stacked layout for the video header on mobile */
  .video-header {
    z-index: 30;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0) 100%);
    margin: 0;
    padding: 12px 16px;
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    border-radius: var(--radius-md);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
  }
  
  /* Make header elements look premium and transparent over video */
  .video-header .btn-back {
    color: white;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    flex: 0 0 auto;
  }
  
  .video-header .class-info {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    font-size: 0.85rem;
    flex: 0 0 auto;
  }
  
  .video-header .mode-selector {
    flex: 1 0 100%;
    width: 100%;
    margin-top: 4px;
  }
  
  .video-header .mode-selector select {
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(6px);
    width: 100%;
    text-align: center;
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: var(--radius-full);
  }

  .professor-video-frame {
    height: 100%;
    border-radius: var(--radius-lg);
    box-shadow: none;
  }
  
  /* Floating overlay controls with glassmorphism */
  .video-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    margin-top: 0 !important;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  }
  
  .control-btn span {
    display: none; /* Hide control text on mobile to save space */
  }
  
  .icon-circle {
    width: 52px !important;
    height: 52px !important;
    font-size: 1.35rem !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: white !important;
  }
  
  #btn-mic.listening .icon-circle {
    background-color: var(--primary) !important;
    box-shadow: 0 0 15px var(--primary) !important;
  }
  
  .control-btn.danger .icon-circle {
    background-color: rgba(239, 68, 68, 0.8) !important;
  }
  
  /* Mobile Chat/Legendas Toggle button styles */
  .chat-toggle-btn {
    display: flex !important;
  }
  
  .chat-toggle-btn.active .icon-circle {
    background-color: var(--primary) !important;
    color: white !important;
  }

  /* PIP positioning on mobile */
  .student-pip {
    width: 90px !important;
    height: 120px !important; /* Portrait mode for mobile PIP */
    top: 90px !important;
    bottom: auto !important;
    right: 16px !important;
    border-radius: var(--radius-md) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
  }
  
  /* Sidebar as a sliding Bottom Sheet on Mobile */
  .sidebar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 48%;
    background-color: rgba(21, 26, 35, 0.95);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-left: none;
    z-index: 900;
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
    transform: translateY(105%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  }
  
  [data-theme="light"] .sidebar {
    background-color: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }
  
  .sidebar.active {
    transform: translateY(0);
  }
  
  /* Add drag handle at the top of the Bottom Sheet */
  .sidebar::before {
    content: "";
    display: block;
    width: 40px;
    height: 5px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    margin: 12px auto 8px auto;
    flex-shrink: 0;
  }
  
  [data-theme="light"] .sidebar::before {
    background-color: rgba(0, 0, 0, 0.2);
  }

  /* Prevent shrinking of top level elements in Bottom Sheet flex container */
  .sidebar-tabs {
    flex-shrink: 0;
  }

  /* Modern horizontally scrollable compact pill-switch row for mobile screens */
  .captions-toolbar {
    flex-shrink: 0;
    background-color: var(--bg-card);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-start !important;
    gap: 12px !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    flex-wrap: nowrap !important;
    padding: 10px 16px !important;
    scrollbar-width: none !important; /* Firefox */
    z-index: 10;
  }

  .captions-toolbar::-webkit-scrollbar {
    display: none !important; /* Chrome/Safari */
  }

  .captions-toolbar .toggle-switch {
    flex: 0 0 auto !important;
  }

  [data-theme="light"] .captions-toolbar {
    background-color: var(--bg-card);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }
}

@media (min-width: 993px) {
  /* Hide mobile chat toggle button on desktop */
  .chat-toggle-btn {
    display: none !important;
  }
}

/* Light/Dark Theme Switching Transitions */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.app-header, .sidebar, .mobile-nav-bar, .professor-card, .metric-card {
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}


