/**
 * Video Consultation Page Styles
 * Emergency Healthcare AI Platform
 */

body { padding-top: var(--navbar-height); background: var(--bg-body); }

/* ── Pre-Call Setup ── */
.pre-call-section { padding: var(--space-12) 0; }
.pre-call-card {
  background: var(--bg-surface);
  border-radius: var(--border-radius-xl);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-width: 900px;
  margin: 0 auto;
}
.pre-call-header {
  background: linear-gradient(135deg, var(--color-dark-3), var(--color-dark));
  padding: var(--space-10) var(--space-8);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.pre-call-header::before {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(6,214,160,0.15), transparent);
  top: -150px; right: -100px;
  pointer-events: none;
}
.pre-call-header h1 { color: var(--color-white); font-size: var(--text-3xl); margin-bottom: var(--space-3); }
.pre-call-header p  { color: rgba(255,255,255,0.6); font-size: var(--text-lg); }

.pre-call-body { padding: var(--space-8); }

.call-options { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6); margin-bottom: var(--space-8); }
.call-option {
  background: var(--bg-surface-2);
  border: 1.5px solid var(--border-color);
  border-radius: var(--border-radius-xl);
  padding: var(--space-8);
  text-align: center;
  transition: var(--transition-base);
}
.call-option:hover { border-color: var(--color-accent); box-shadow: var(--shadow-md); }
.call-option .option-icon {
  width: 64px; height: 64px;
  border-radius: var(--border-radius-lg);
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: var(--color-white);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto var(--space-4);
}
.call-option h3 { font-size: var(--text-xl); margin-bottom: var(--space-2); }
.call-option p  { font-size: var(--text-sm); color: var(--text-muted); margin-bottom: var(--space-5); }
.join-form { display: flex; gap: var(--space-2); }
.join-form .form-control { flex: 1; }

/* ── Device Check ── */
.device-check { border-top: 1px solid var(--border-color); padding-top: var(--space-8); }
.device-check h3 { font-size: var(--text-xl); margin-bottom: var(--space-6); }
.device-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.device-item { display: flex; flex-direction: column; gap: var(--space-3); }
.device-item label { font-size: var(--text-sm); font-weight: var(--font-semibold); color: var(--text-primary); }
.device-preview {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
}
.device-preview video { width: 100%; height: 100%; object-fit: cover; }
.audio-visualizer { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 var(--space-4); }
.audio-bar {
  flex: 1;
  background: var(--color-accent);
  border-radius: 2px;
  height: 20%;
  transition: height 0.1s ease;
}

/* ── Active Call ── */
.call-section {
  display: none;
  height: calc(100vh - var(--navbar-height));
  background: var(--color-dark);
  position: relative;
}
.call-section.active { display: flex; }

.video-area { flex: 1; position: relative; background: #0a1520; }
.video-grid { width: 100%; height: 100%; display: grid; grid-template-columns: 1fr; position: relative; }
.video-box { position: relative; background: #0d1b2a; overflow: hidden; }
.video-box video { width: 100%; height: 100%; object-fit: cover; }
.video-box img   { width: 100%; height: 100%; object-fit: cover; }
.video-label {
  position: absolute;
  bottom: var(--space-3); left: var(--space-3);
  background: rgba(0,0,0,0.6);
  color: var(--color-white);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--border-radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  backdrop-filter: blur(8px);
}
.local-pip {
  position: absolute;
  bottom: var(--space-5); right: var(--space-5);
  width: 180px;
  aspect-ratio: 16/9;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: var(--shadow-xl);
  z-index: 10;
}
.local-pip video { width: 100%; height: 100%; object-fit: cover; }

.connection-badge {
  position: absolute;
  top: var(--space-4); left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  color: var(--color-white);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--border-radius-full);
  font-size: var(--text-xs);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  z-index: 10;
}
.connection-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent); }
.connection-badge .dot.connecting { background: var(--color-warning); animation: pulse 1s infinite; }

/* ── Call Controls ── */
.call-controls {
  position: absolute;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: rgba(13,27,42,0.8);
  backdrop-filter: blur(16px);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--border-radius-full);
  border: 1px solid rgba(255,255,255,0.1);
  z-index: 20;
}
.ctrl-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--color-white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: var(--transition-base);
}
.ctrl-btn:hover { background: rgba(255,255,255,0.2); }
.ctrl-btn.active { background: var(--color-accent); border-color: var(--color-accent); }
.ctrl-btn.end-call { background: var(--color-primary); border-color: var(--color-primary); width: 56px; height: 56px; font-size: 1.2rem; }
.ctrl-btn.end-call:hover { background: var(--color-primary-dark); }
.ctrl-btn.muted { background: rgba(230,57,70,0.3); border-color: var(--color-primary); }

/* ── Meeting Info Bar ── */
.meeting-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  background: rgba(13,27,42,0.7);
  backdrop-filter: blur(8px);
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}
.meeting-id-display { display: flex; align-items: center; gap: var(--space-3); }
.meeting-id-display span { font-size: var(--text-xs); color: rgba(255,255,255,0.5); }
.meeting-id-display strong { font-size: var(--text-sm); color: var(--color-white); font-family: var(--font-mono); }
.meeting-timer { font-size: var(--text-sm); color: rgba(255,255,255,0.7); font-family: var(--font-mono); }

/* ── Chat Sidebar ── */
.chat-sidebar {
  width: 320px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.3s ease;
}
.chat-sidebar.hidden { transform: translateX(100%); }
.chat-sidebar-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-sidebar-header h3 { font-size: var(--text-base); }
.chat-messages { flex: 1; overflow-y: auto; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
.chat-msg { max-width: 85%; }
.chat-msg.sent { align-self: flex-end; }
.chat-msg.received { align-self: flex-start; }
.chat-msg.system { align-self: center; font-size: var(--text-xs); color: var(--text-muted); background: var(--bg-surface-2); padding: var(--space-1) var(--space-3); border-radius: var(--border-radius-full); }
.msg-sender { font-size: var(--text-xs); color: var(--text-muted); margin-bottom: 2px; }
.msg-bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--border-radius-lg);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}
.chat-msg.sent .msg-bubble { background: var(--color-accent); color: var(--color-dark); border-bottom-right-radius: 4px; }
.chat-msg.received .msg-bubble { background: var(--bg-surface-2); color: var(--text-primary); border-bottom-left-radius: 4px; }
.msg-time { font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.chat-msg.sent .msg-time { text-align: right; }
.chat-input-bar {
  padding: var(--space-4);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: var(--space-2);
}
.chat-input-bar .form-control { flex: 1; border-radius: var(--border-radius-full); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .call-options { grid-template-columns: 1fr; }
  .device-grid  { grid-template-columns: 1fr; }
  .chat-sidebar { position: absolute; right: 0; top: 0; bottom: 0; z-index: 30; }
  .local-pip    { width: 120px; }
}
