:root {
  --primary: #4f46e5;
  --primary-hover: #3730a3;
  --primary-glow: rgba(79, 70, 229, 0.15);
  --secondary: #475569;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #ca8a04;
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
  --pane-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(0, 0, 0, 0.08);
  --text-main: #0f172a;
  --text-muted: #475569;
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-xl: 0 20px 40px -15px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 20px -5px rgba(15, 23, 42, 0.04);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  overflow-x: hidden;
  padding: 1rem;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.container {
  width: 100%;
  max-width: 850px;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  padding: 0;
  box-shadow: none;
  margin: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h2 {
  text-align: center;
  font-weight: 800;
  font-size: clamp(1rem, 3vw, 1.5rem);
  margin: 0;
  background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

/* AV Panels */
.av {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  width: 100%;
}

.pane {
  background: var(--pane-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.pane:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05);
}

.video-wrapper {
  position: relative;
  width: 100%;
  line-height: 0;
}

.video-wrapper,
.avatar-container {
  width: 100%;
  aspect-ratio: 16/9;
  max-height: 200px;
  background: #e2e8f0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#userCam {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-container {
  background: radial-gradient(circle at center, #f8fafc 0%, #cbd5e1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#botVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: var(--transition);
  filter: drop-shadow(0 0 30px rgba(79, 70, 229, 0.3));
  display: block;
}

.caption {
  padding: 8px;
  text-align: center;
  background: white;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

/* Face Count Display */
#face-count-display {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  color: white;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
}

/* Voice Waves Animation */
.voice-waves {
  position: absolute;
  bottom: 20px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 30px;
  opacity: 0;
  transition: var(--transition);
}

.speaking .voice-waves {
  opacity: 1;
}

.voice-waves span {
  width: 3px;
  background: var(--primary);
  border-radius: 3px;
  animation: wave 1s infinite ease-in-out;
}

.voice-waves span:nth-child(1) { height: 10px; animation-delay: 0.0s; }
.voice-waves span:nth-child(2) { height: 15px; animation-delay: 0.1s; }
.voice-waves span:nth-child(3) { height: 20px; animation-delay: 0.2s; }
.voice-waves span:nth-child(4) { height: 15px; animation-delay: 0.15s; }
.voice-waves span:nth-child(5) { height: 10px; animation-delay: 0.05s; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(2); }
}

.speaking #botVideo {
  transform: scale(1.02);
  filter: drop-shadow(0 0 30px var(--primary-glow));
}

/* Chat Styles */
.chat {
  height: clamp(140px, 20vh, 250px);
  overflow-y: auto;
  padding: 16px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.5);
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  animation: fadeIn 0.3s ease-out;
}

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

.bot {
  align-self: flex-start;
  background: white;
  color: var(--text-main);
  border-bottom-left-radius: 4px;
}

.me {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}

.system {
  align-self: center;
  background: #f1f5f9;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 6px 16px;
  border-radius: 9999px;
  box-shadow: none;
}

/* Controls */
.rec-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

button {
  padding: 12px 24px;
  border-radius: var(--radius-md);
  border: none;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.95rem;
  white-space: nowrap;
}

.rec-controls #record {
  background: var(--danger);
  color: white;
  flex: 1;
  max-width: 200px;
}

.rec-controls #record:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 10px 15px -3px rgba(239, 68, 68, 0.4);
}

.rec-controls #record:active:not(:disabled) {
  transform: translateY(0);
}

.rec-controls #record.recording {
  animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.rec-controls #stop {
  background: var(--text-main);
  color: white;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

#stop:hover:not(:disabled) {
  background: #000;
  transform: translateY(-2px);
}

#timer {
  font-family: 'JetBrains Mono', 'Monaco', 'Courier New', monospace;
  font-weight: 700;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: var(--success);
  border: none;
  min-width: auto;
  text-align: center;
  font-size: 1.05rem;
}

#timer.on {
  color: var(--danger);
  border-color: var(--danger);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-content {
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.12);
  animation: modalScaleUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

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

.modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.modal-header h3 {
  margin: 0;
  color: #0f172a;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0 24px;
}

.tech-btn {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  justify-content: flex-start;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.tech-btn:hover, .tech-btn.active {
  background: white;
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.1);
}

.tech-btn .icon {
  font-size: 1.25rem;
  margin-right: 8px;
}

.user-info-section label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  color: #475569;
}

.user-info-section input, .user-info-section select {
  width: 100%;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  font-size: 0.95rem;
  transition: var(--transition);
}

.user-info-section input::placeholder {
  color: #94a3b8;
}

.user-info-section input:focus, .user-info-section select:focus {
  outline: none;
  background: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

.modal-footer {
  padding: 16px 24px 24px;
  padding-bottom: clamp(24px, 24px + env(safe-area-inset-bottom, 0px), 60px);
  background: #ffffff;
  display: flex;
  justify-content: center;
}

.primary-btn {
  background: var(--primary);
  color: white;
  padding: 14px 32px;
}

.primary-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

/* Responsive Overrides */
@media (max-width: 768px) {
  body {
    padding: 0;
    align-items: flex-start;
  }

  .container {
    max-width: none;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: none;
    padding: 12px;
    background: transparent;
    gap: 12px;
  }

  .av {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    align-items: flex-start !important;
    height: auto !important;
    margin-bottom: 8px !important;
  }

  .pane {
    box-shadow: none;
    border: 1px solid #e2e8f0;
    height: auto !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .video-wrapper, .avatar-container {
    width: 100% !important;
    height: 0 !important;
    padding-bottom: 56.25% !important; /* Forces perfect 16:9 ratio */
    position: relative !important;
    background: #000 !important;
    overflow: hidden !important;
    border-radius: var(--radius-sm);
    display: block !important; /* Override flex */
  }

  #userCam, #botVideo {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #userCam {
    object-fit: cover !important;
  }

  #botVideo {
    object-fit: contain !important;
    padding: 0 !important;
    max-height: 100% !important;
    max-width: 100% !important;
  }

  /* Ensure captions stay below the locked frames */
  .caption {
    padding: 6px !important;
    font-size: 0.7rem !important;
  }

  .chat {
    flex: 1;
    height: auto;
    min-height: 100px;
    padding: 8px;
    margin-bottom: env(safe-area-inset-bottom, 12px);
    order: 4;
  }

  .rec-controls {
    flex-direction: row;
    gap: 8px;
    padding: 4px 0;
    order: 3;
  }

  .rec-controls #record {
    flex: 2;
  }

  #timer {
    flex: 1;
    min-width: 60px;
    padding: 8px;
    font-size: 0.9rem;
  }

  .rec-controls #stop {
    flex: 1;
  }

  .tech-grid {
    grid-template-columns: 1fr;
  }

  .modal-overlay {
    padding: 0;
  }

  .modal-content {
    max-width: none;
    height: 100%;
    border-radius: 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 12px;
    gap: 12px;
  }

  h2 {
    font-size: 1.1rem;
  }

  .pane {
    border-radius: var(--radius-md);
  }

  .msg {
    max-width: 90%;
    padding: 10px 14px;
    font-size: 0.9rem;
  }

  button {
    padding: 10px 16px;
    font-size: 0.85rem;
  }
}

/* Fullscreen utility */
:-webkit-full-screen .container { width: 100vw; height: 100vh; border-radius: 0; }
:fullscreen .container { width: 100vw; height: 100vh; border-radius: 0; }

/* Report & Proctoring Overlays */
.report-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  padding: 20px;
  overflow-y: auto;
}

.report-card {
  background: #1e293b;
  padding: clamp(24px, 5vw, 48px);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  animation: modalScaleUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.report-card h1 {
  font-size: clamp(1.5rem, 5vw, 2rem);
  color: var(--primary);
  margin-bottom: 24px;
}

.report-card .icon-check {
  font-size: 64px;
  margin: 32px 0;
  display: block;
}

.report-card p {
  color: #e2e8f0;
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 24px;
}

.proctor-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(239, 68, 68, 0.95);
  color: white;
  padding: 24px;
  border-radius: var(--radius-lg);
  z-index: 2000;
  text-align: center;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 0 50px rgba(239, 68, 68, 0.5);
  border: 2px solid white;
  backdrop-filter: blur(8px);
  pointer-events: none;
  animation: pulse-red 2s infinite;
}

/* Global Loader Overlay */
.loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(8px);
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  color: white;
}

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

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

.loader-text {
  font-size: 1.1rem;
  font-weight: 500;
  color: #f8fafc;
}

.processing-glow {
  color: #64748b;
  font-style: italic;
  animation: textGlow 2s infinite ease-in-out;
  display: inline-block;
}

@keyframes textGlow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; color: var(--primary); }
}

.dot-jump {
  display: inline-block;
  animation: dotJump 1.4s infinite ease-in-out;
}
.dot-jump:nth-child(2) { animation-delay: 0.2s; }
.dot-jump:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotJump {
  0%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-5px); }
}

/* Premium Calling Screen Layout */
.calling-screen-container {
  background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
  color: white;
  position: relative;
  overflow: hidden;
  width: 100%;
}

.calling-screen-container::before {
  content: "";
  position: absolute;
  top: -150px;
  left: -150px;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(79, 70, 229, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.call-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 16px;
}

.call-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
}

.status-dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  animation: blink 1.5s infinite ease-in-out;
  box-shadow: 0 0 10px var(--success);
}

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

.call-avatar-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 10px 0;
}

.avatar-pulse-wrapper {
  position: relative;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-pulse-ring {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px dashed rgba(79, 70, 229, 0.4);
  animation: rotate-ring 20s linear infinite;
  pointer-events: none;
}

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

.avatar-pulse-glow {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.1);
  transform: scale(1);
  transition: transform 0.3s ease;
  pointer-events: none;
}

.speaking .avatar-pulse-glow {
  animation: speak-pulse 1.2s infinite ease-in-out;
  background: rgba(79, 70, 229, 0.2);
}

@keyframes speak-pulse {
  0% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.35); opacity: 0.3; }
  100% { transform: scale(1); opacity: 0.8; }
}

.caller-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, #334155 0%, #1e293b 100%);
  border: 4px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.speaking .caller-avatar {
  border-color: var(--primary);
  box-shadow: 0 0 25px var(--primary-glow);
}

.caller-info {
  text-align: center;
  margin-top: 16px;
}

.caller-name {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 0 0 4px 0;
  color: white;
  letter-spacing: -0.01em;
}

.caller-label {
  font-size: 0.8rem;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Accent & Voice Customizer */
.voice-settings-panel {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 16px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.voice-setting-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 12px;
}

.voice-setting-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.voice-accent-select {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  width: 100%;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.voice-accent-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.voice-accent-select option {
  background: #0f172a;
  color: white;
}

.voice-slider-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.voice-slider {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.2);
  outline: none;
  cursor: pointer;
  accent-color: var(--primary);
  -webkit-appearance: none;
  appearance: none;
}

.voice-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
  cursor: pointer;
}

.voice-slider-value {
  font-family: monospace;
  font-size: 0.85rem;
  color: #cbd5e1;
  min-width: 32px;
}

/* Call Actions Controls */
.call-controls-dashboard {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: 100%;
  margin-top: 4px;
}

.circle-control-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #64748b;
  padding: 0;
}

.circle-control-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  color: var(--primary);
  border-color: rgba(79, 70, 229, 0.3);
}

.circle-control-btn.record-btn {
  width: 64px;
  height: 64px;
  background: var(--danger);
  border-color: transparent;
  color: white;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.circle-control-btn.record-btn:hover:not(:disabled) {
  background: #dc2626;
  transform: scale(1.05);
  color: white;
  box-shadow: 0 10px 24px rgba(239, 68, 68, 0.5);
}

.circle-control-btn.record-btn.recording {
  animation: call-pulse-red 1.5s infinite;
  background: #dc2626;
}

@keyframes call-pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6), 0 8px 20px rgba(239, 68, 68, 0.3); }
  70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0), 0 8px 20px rgba(239, 68, 68, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0), 0 8px 20px rgba(239, 68, 68, 0.3); }
}

.circle-control-btn.end-btn {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.circle-control-btn.end-btn:hover:not(:disabled) {
  background: var(--danger);
  color: white;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.3);
}

.circle-control-btn.muted-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: #cbd5e1;
  color: #64748b;
}

.circle-control-btn.muted-btn.active {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--warning);
  color: var(--warning);
}

/* Hide legacy AV styling elements since they are now obsolete */
.av, .pane, .video-wrapper, .avatar-container {
  display: none !important;
}

/* Smartphone Call Mockup Frame */
.smartphone-frame {
  width: 100%;
  max-width: 340px;
  background: #000;
  border-radius: 40px;
  padding: 10px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), inset 0 0 2px 2px rgba(255, 255, 255, 0.2);
  margin: 15px auto;
  position: relative;
  border: 4px solid #1e293b;
}

.smartphone-screen {
  background: linear-gradient(to bottom, #0f172a, #020617);
  border-radius: 32px;
  height: 520px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  color: white;
  padding: 14px;
}

/* Simulated Notch & Status Bar */
.phone-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  z-index: 10;
}

.phone-notch {
  width: 100px;
  height: 20px;
  background: #000;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.phone-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-top: 8px;
  padding: 0 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
}

.phone-icons {
  display: flex;
  gap: 4px;
}

/* Call Body Elements */
.phone-call-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 15px;
}

.caller-avatar-circle {
  position: relative;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, #1e293b 0%, #0f172a 100%);
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: all 0.3s ease;
}

.speaking .caller-avatar-circle {
  border-color: var(--primary);
  box-shadow: 0 0 25px var(--primary-glow);
  transform: scale(1.02);
}

.caller-name {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 15px 0 4px 0;
  color: white;
  text-align: center;
}

.caller-status {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.call-timer-container {
  font-family: monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 5px;
}

/* Dynamic Wave Pulse */
.phone-wave-pulse {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
  margin-top: 12px;
}

.speaking .phone-wave-pulse {
  opacity: 1;
}

.phone-wave-pulse span {
  width: 3px;
  background: var(--primary);
  border-radius: 3px;
  animation: wave 1s infinite ease-in-out;
}

.phone-wave-pulse span:nth-child(1) { height: 6px; animation-delay: 0.0s; }
.phone-wave-pulse span:nth-child(2) { height: 12px; animation-delay: 0.1s; }
.phone-wave-pulse span:nth-child(3) { height: 18px; animation-delay: 0.2s; }
.phone-wave-pulse span:nth-child(4) { height: 12px; animation-delay: 0.15s; }
.phone-wave-pulse span:nth-child(5) { height: 6px; animation-delay: 0.05s; }

/* Phone Action Pad */
.phone-action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  padding: 8px 6px;
  margin-bottom: 12px;
}

.action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.phone-circle-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.phone-circle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.03);
}

.phone-circle-btn.record-btn {
  background: var(--success);
  border: none;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.phone-circle-btn.record-btn:hover {
  background: #059669;
}.phone-circle-btn.record-btn.recording {
  animation: call-pulse-green 1.5s infinite;
  background: var(--danger) !important;
}

.phone-circle-btn.record-btn.recording svg {
  display: none !important;
}

.phone-circle-btn.record-btn.recording::after {
  content: '';
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 2px;
  display: block;
}
@keyframes call-pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.phone-circle-btn.muted-btn.active {
  background: rgba(245, 158, 11, 0.2);
  border-color: var(--warning);
  color: var(--warning);
}

.action-label {
  font-size: 0.65rem;
  color: #94a3b8;
  margin-top: 4px;
  text-transform: capitalize;
  font-weight: 500;
}

/* End Call Row */
.phone-end-call-area {
  display: flex;
  justify-content: center;
  width: 100%;
  padding-bottom: 8px;
}

.phone-decline-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--danger);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.35);
  transition: all 0.2s ease;
  padding: 0;
}

.phone-decline-btn:hover {
  background: #dc2626;
  transform: scale(1.03) rotate(-135deg);
}

/* ==========================================================================
   B2B Dispatcher Practice Academy - Smartphone & Portal Layout Enhancements
   ========================================================================== */

/* 1. Prevent standard practice container from stretching to 100vh on mobile */
#standard-practice-wrapper .container {
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  padding: 10px !important;
  display: flex !important;
  flex-direction: column !important;
}

/* 2. Responsive adjustments for smartphone frame & notch */
.smartphone-frame {
  transition: var(--transition);
}

@media (max-width: 768px) {
  .smartphone-frame {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 !important;
    z-index: 999999 !important;
    box-shadow: none !important;
    background: #000 !important;
  }
  
  .smartphone-screen {
    height: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    padding: 24px 20px !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    background: linear-gradient(to bottom, #0f172a, #020617) !important;
  }
  
  .phone-notch {
    display: none !important;
  }
}

/* 3. High-fidelity centering and clipping fix for nested modal overlays inside simulated screens */
.smartphone-screen .modal-overlay {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: inherit !important;
  padding: 12px !important;
  box-sizing: border-box !important;
  z-index: 50 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(9, 13, 22, 0.92) !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
}

.smartphone-screen .modal-content {
  width: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  border-radius: 18px !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
}

.smartphone-screen .modal-header {
  padding: 16px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.smartphone-screen .modal-body {
  padding: 16px !important;
}

.smartphone-screen .modal-footer {
  padding: 16px !important;
  background: transparent !important;
  border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

