/* Video Call Styling - Global styles for video call components */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --dark-bg: #0a0e27;
  --card-bg: rgba(17, 25, 40, 0.75);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #a8b2d1;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --muted: #6b7280;
}



/* Animated background */

@keyframes float {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(-20px, -20px) rotate(1deg); }
  66% { transform: translate(20px, -10px) rotate(-1deg); }
}

/* Header */
.header {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  position: relative;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.room-badge {
  background: var(--primary-gradient);
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  letter-spacing: 0.5px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: pulse 2s ease-in-out infinite;
}

.status-dot.connected {
  background: var(--success);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.2); }
}

/* Main video container */
.main-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  max-height: calc(100vh - 180px);
  height: calc(100vh - 180px);
  width: 100%;
}

/* Video grid - Dynamic and scalable */
.video-grid {
  display: grid;
  gap: 1rem;
  width: 100%;
  height: 100%;
  max-width: 100%;
  padding: 0.5rem;
  align-items: stretch;
  justify-items: stretch;
}

/* Dynamic grid layouts based on participant count */
.video-grid[data-participants="1"] {
  grid-template-columns: 1fr;
  max-width: 800px;
}

.video-grid[data-participants="2"] {
  grid-template-columns: 1fr 1fr;
  max-width: 100%;
}

.video-grid[data-participants="3"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  max-width: 100%;
}

.video-grid[data-participants="4"] {
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  max-width: 100%;
}

.video-grid[data-participants="5"],
.video-grid[data-participants="6"] {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  max-width: 100%;
}

.video-grid[data-participants="7"],
.video-grid[data-participants="8"],
.video-grid[data-participants="9"] {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  max-width: 100%;
}

/* Video cards - Full width and height utilization */
.video-grid .video-card {
  width: 100%;
  height: 100%;
  min-height: 200px;
  aspect-ratio: unset;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-card {
  position: relative;
  background: var(--card-bg);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  width: 100%;
  height: 100%;
  min-height: 200px;
}

.video-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.video-card.speaking {
  border-color: var(--success);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.participant-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.participant-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  font-size: 1.2rem;
}

.participant-details {
  display: flex;
  flex-direction: column;
}

.participant-name {
  color: white;
  font-weight: 600;
  font-size: 0.95rem;
}

.participant-role {
  color: var(--text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.audio-indicator {
  padding: 0.25rem 0.5rem;
  background: var(--glass-bg);
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.audio-bars {
  display: flex;
  gap: 2px;
  height: 16px;
  align-items: flex-end;
}

.audio-bar {
  width: 3px;
  background: var(--success);
  border-radius: 2px;
  transition: height 0.1s ease;
}

.audio-bar:nth-child(1) { height: 40%; animation: audioWave 0.5s ease-in-out infinite; }
.audio-bar:nth-child(2) { height: 60%; animation: audioWave 0.5s ease-in-out infinite 0.1s; }
.audio-bar:nth-child(3) { height: 50%; animation: audioWave 0.5s ease-in-out infinite 0.2s; }
.audio-bar:nth-child(4) { height: 70%; animation: audioWave 0.5s ease-in-out infinite 0.3s; }

@keyframes audioWave {
  0%, 100% { height: 40%; }
  50% { height: 100%; }
}

.muted-indicator {
  color: var(--danger);
  font-size: 1.2rem;
}

.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, var(--glass-bg) 0%, transparent 70%);
}

.placeholder-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.3;
}

.placeholder-text {
  color: var(--text-primary);
  font-size: 1rem;
}

/* Control bar */
.control-bar {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  padding: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  position: relative;
  z-index: 100;
  flex-wrap: wrap;
  min-height: 90px;
}

.control-group {
  display: flex;
  gap: 0.75rem;
  padding: 0 1rem;
  border-right: 1px solid var(--glass-border);
  flex-shrink: 0;
}

.control-group:last-child {
  border-right: none;
}

.control-btn {
  position: relative;
  width: 50px;
  height: 50px;
  border: none;
  border-radius: 50%;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  transition: all 0.3s ease;
  overflow: hidden;
}

.control-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: var(--primary-gradient);
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
  z-index: -1;
}

.control-btn:hover::before {
  width: 100%;
  height: 100%;
}

.control-btn:hover {
  transform: translateY(-2px);
  border-color: transparent;
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

.control-btn.active {
  background: var(--primary-gradient);
  border-color: transparent;
}

.control-btn.muted {
  background: var(--danger);
  border-color: transparent;
}

.control-btn.recording {
  animation: recordPulse 1.5s ease-in-out infinite;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

@keyframes recordPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    transform: scale(1.05);
  }
}

.control-label {
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--text-secondary);
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.control-btn:hover .control-label {
  opacity: 1;
}

.end-call-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  width: 60px;
  border-radius: 30px;
}

.recording-indicator {
  background: var(--danger);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  display: none;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  animation: slideDown 0.3s ease;
  z-index: 1001;
  position: relative;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.recording-indicator.active {
  display: flex;
}

@keyframes slideDown {
  from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.recording-dot {
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  animation: recordBlink 1s ease-in-out infinite;
}

@keyframes recordBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* Timer */
.timer {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  padding: 0.75rem 1.5rem;
  border-radius: 15px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-primary);
    display: none;
  }
  
.timer.active {
  display: block;
}

/* Mobile-specific styles */
@media (max-width: 768px) {
  body {
    position: fixed;
    width: 100%;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
  
  .main-container {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 70px;
    padding: 0;
    max-height: none;
    height: calc(100vh - 130px);
    overflow: hidden;
  }
  
  .video-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    height: 100%;
    position: relative;
  }
  
  /* Keep side-by-side layout on mobile */
  .video-card {
    width: 100%;
    height: 100%;
    min-height: 200px;
    aspect-ratio: 16/9;
    border-radius: 12px;
  }
  
  .header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    z-index: 1000;
  }
  
  .header-right {
    gap: 0.5rem;
  }
  
  .recording-indicator {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
  }
  
  .room-badge {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .connection-status {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
  }
  
  .control-bar {
    position: fixed;
    bottom: 0;
    bottom: env(safe-area-inset-bottom);
    left: 0;
    right: 0;
    height: 70px;
    padding: 0.75rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    gap: 0.5rem;
    background: rgba(10, 14, 39, 0.98);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .control-btn {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }
  
  .control-group {
    gap: 0.5rem;
    padding: 0 0.5rem;
  }
  
  .control-label {
    display: none;
  }
  
  .end-call-btn {
    width: 50px;
  }
  
  .participant-info {
    gap: 0.5rem;
  }
  
  .participant-avatar {
    width: 30px;
    height: 30px;
    font-size: 1rem;
  }
  
  .participant-name {
    font-size: 0.85rem;
  }
  
  .participant-role {
    font-size: 0.7rem;
  }
  
  /* Hide recording controls on mobile for non-interviewers */
  #recordingControls {
    display: none !important;
  }
  
  /* Compact timer - position above control bar */
  .timer {
    position: fixed;
    top: auto;
    bottom: 75px;
    right: 10px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 20px;
    z-index: 99;
  }
  
  
  /* Ensure video doesn't go under controls */
  video {
    object-fit: contain;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .video-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
  }
  
  .video-card {
    min-height: 150px;
    border-radius: 8px;
  }
  
  .main-container {
    top: 50px;
    bottom: 65px;
    height: calc(100vh - 115px);
  }
  
  .header {
    height: 50px;
    padding: 0.5rem;
  }
  
  .control-bar {
    height: 65px;
    padding: 0.5rem;
  }
  
  .control-btn {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
  }
  
  .header {
    padding: 0.5rem;
  }
  
  .room-info {
    gap: 0.5rem;
  }
}

/* Responsive design for tablets */
@media (min-width: 769px) and (max-width: 1024px) {
  .main-container {
    padding: 0.75rem;
    align-items: center;
    justify-content: center;
  }
  
  .video-grid {
    gap: 0.75rem;
    padding: 0.25rem;
  }
  
  .video-grid[data-participants="2"] {
    grid-template-columns: 1fr 1fr;
  }
  
  .video-grid[data-participants="3"],
  .video-grid[data-participants="4"] {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
  }
  
  .video-card {
    min-height: 250px;
  }
}

/* Larger screens */
@media (min-width: 1025px) {
  .main-container {
    padding: 1rem;
    align-items: center;
    justify-content: center;
  }
  
  .video-grid {
    gap: 1rem;
    padding: 0.5rem;
  }
  
  .video-card {
    min-height: 300px;
  }
}

/* Transcript Panel */
.transcript-panel {
  position: fixed;
  right: 20px;
  top: 100px;
  bottom: 110px;
  width: 380px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 90;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.transcript-panel.active {
  display: flex;
}

.transcript-header {
  padding: 1rem 1.5rem;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.transcript-title {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.transcript-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.transcript-status-dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.transcript-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  scroll-behavior: smooth;
}

.transcript-content::-webkit-scrollbar {
  width: 6px;
}

.transcript-content::-webkit-scrollbar-track {
  background: var(--glass-bg);
  border-radius: 3px;
}

.transcript-content::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: 3px;
}

.transcript-content::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

.transcript-entry {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border-left: 3px solid transparent;
  transition: all 0.3s ease;
  animation: fadeInUp 0.3s ease;
}

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

.transcript-entry.local {
  border-left-color: var(--primary-gradient);
  background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, transparent 100%);
}

.transcript-entry.remote {
  border-left-color: var(--secondary-gradient);
  background: linear-gradient(90deg, rgba(240, 147, 251, 0.05) 0%, transparent 100%);
}

.transcript-entry.system {
  border-left-color: var(--warning);
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.05) 0%, transparent 100%);
  font-style: italic;
}

.transcript-speaker {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.transcript-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.5;
  word-wrap: break-word;
}

.transcript-timestamp {
  font-size: 0.65rem;
  color: var(--muted);
  margin-top: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.transcript-toggle-btn {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 60px;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  border-radius: 20px 0 0 20px;
  border-right: none;
  cursor: pointer;
  display: none; /* Hide by default - will show via JS for interviewer only */
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: var(--text-primary);
  transition: all 0.3s ease;
  z-index: 91;
}

.transcript-toggle-btn:hover {
  background: var(--primary-gradient);
  transform: translateY(-50%) translateX(-2px);
}

.transcript-toggle-btn.panel-open {
  right: 400px;
  border-radius: 0 20px 20px 0;
  border-left: none;
  border-right: 1px solid var(--glass-border);
}

.transcript-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 2rem;
  font-size: 0.875rem;
}

.transcript-listening {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 10px;
  margin-bottom: 1rem;
  animation: pulse 2s ease-in-out infinite;
}

.transcript-listening-text {
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Adjust main container when transcript panel is open */
.main-container.transcript-open {
  padding-right: 420px;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
  .transcript-panel {
    width: 320px;
  }
  
  .transcript-toggle-btn.panel-open {
    right: 340px;
  }
  
  .main-container.transcript-open {
    padding-right: 360px;
  }
}

@media (max-width: 1024px) {
  .transcript-panel {
    width: 100%;
    right: 0;
    left: 0;
    top: auto;
    bottom: 70px;
    height: 250px;
    border-radius: 20px 20px 0 0;
  }
  
  .transcript-toggle-btn {
    display: none;
  }
  
  .main-container.transcript-open {
    padding-right: 2rem;
    padding-bottom: 270px;
  }
}

@media (max-width: 768px) {
  .transcript-panel {
    width: 100%;
    height: 40vh;
    bottom: 70px;
  }
  
  .transcript-toggle-btn {
    /* Keep button visible on mobile for debugging */
    bottom: 100px;
    top: auto;
    transform: none;
  }
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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