/* ============================================
   SCREEN LINK — MINIMALIST FLAT DESIGN SYSTEM
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg-main: #202124;       /* Google Meet dark gray */
  --bg-card: #2d2e30;       /* Lighter flat gray */
  --bg-input: #3c4043;      /* Input background */
  
  --color-primary: #1a73e8; /* Flat Google Blue */
  --color-primary-hover: #1557b0;
  
  --color-danger: #ea4335;  /* Flat Google Red */
  --color-danger-hover: #c5221f;
  
  --color-success: #1e8e3e; /* Flat Green */
  
  --text-main: #e8eaed;
  --text-sub: #9aa0a6;
  --border-color: #3c4043;
  
  --radius: 8px;
  --transition: 0.2s ease;
}

/* --- Base Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ============================================
   LOBBY / LANDING PAGE
   ============================================ */

.landing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.brand {
  text-align: center;
  margin-bottom: 40px;
}

.brand-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.brand h1 {
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

.brand p {
  color: var(--text-sub);
  margin-top: 6px;
  font-size: 1rem;
}

/* Role Selection Grid */
.role-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  max-width: 680px;
  width: 100%;
}

.role-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.role-card:hover {
  background: #35363a;
  border-color: var(--color-primary);
}

.role-card-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.role-card h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #fff;
}

.role-card p {
  font-size: 0.9rem;
  color: var(--text-sub);
}

.role-features {
  list-style: none;
  margin-top: 16px;
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
}

.role-features li {
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-features li::before {
  content: '✓';
  color: var(--color-success);
  font-weight: bold;
}

/* ============================================
   MODALS (FLAT STYLE)
   ============================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: #fff;
}

.modal p {
  color: var(--text-sub);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.room-code-display {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.room-code-display code {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--color-primary);
  flex: 1;
}

.copy-btn {
  background: #4f5054;
  border: none;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background var(--transition);
}

.copy-btn:hover {
  background: #5f6064;
}

.copy-btn.copied {
  background: var(--color-success);
}

/* --- Input Fields --- */
.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.input-group input {
  width: 100%;
  padding: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: #fff;
  font-size: 1.1rem;
  text-align: center;
  outline: none;
  transition: border-color var(--transition);
}

.input-group input:focus {
  border-color: var(--color-primary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  outline: none;
  width: 100%;
  transition: background var(--transition);
}

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

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

.btn-secondary {
  background: #3c4043;
  color: #fff;
}

.btn-secondary:hover {
  background: #4f5054;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions .btn {
  flex: 1;
}

/* ============================================
   ROOM PAGE (FLAT SCREEN LAYOUT)
   ============================================ */

.room-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #171717; /* Dark background */
  position: relative;
}

/* Room Header */
.room-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-color);
  z-index: 10;
}

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

.room-header-logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.room-id-badge {
  background: #2d2e30;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.8rem;
  color: var(--text-sub);
}

.room-id-badge code {
  color: var(--color-primary);
  font-weight: bold;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-sub);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5f6368;
}

.status-dot.connecting {
  background: #f2994a;
  animation: pulse 1.5s ease infinite;
}

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

.status-dot.disconnected {
  background: var(--color-danger);
}

/* Main Workspace Video Grid */
.video-grid {
  flex: 1;
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

/* Video Containers */
.video-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-container .video-label {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(0, 0, 0, 0.7);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.8rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  pointer-events: none;
  z-index: 2;
}

/* Screen Share is always the full background */
.screen-share-container {
  z-index: 1;
}

/* Remote Camera Float (Viewer's camera overlay on Host screen) */
.remote-camera-container {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 240px;
  height: 180px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  z-index: 5;
  background: #000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.remote-camera-container video {
  object-fit: cover;
}

/* Self Camera Float */
.pip-camera {
  position: absolute;
  bottom: 16px;
  right: 16px;
  width: 240px;
  height: 180px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  z-index: 5;
  background: #000;
  cursor: grab;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.pip-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.pip-camera .video-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #fff;
}

/* Remote PiP Camera (Host's camera overlay on Viewer screen) */
.pip-remote-camera {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 240px;
  height: 180px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-color);
  z-index: 5;
  background: #000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.pip-remote-camera video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pip-remote-camera .video-label {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #fff;
}

/* Waiting Overlay */
.waiting-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #171717;
  z-index: 3;
}

.waiting-overlay .spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 16px;
}

.waiting-overlay p {
  color: var(--text-main);
  font-size: 0.95rem;
}

.waiting-overlay .waiting-hint {
  color: var(--text-sub);
  font-size: 0.8rem;
  margin-top: 8px;
}

/* ============================================
   COLLAPSIBLE CONTROL BAR (FLAT & CLEAN)
   ============================================ */

.control-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg-main);
  border-top: 1px solid var(--border-color);
  z-index: 10;
  position: relative;
  transition: transform var(--transition);
}

.control-bar.collapsed {
  transform: translateY(calc(100% - 24px));
}

.control-bar-toggle {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: var(--text-sub);
  padding: 2px 20px;
  font-size: 0.75rem;
  cursor: pointer;
  z-index: 12;
  transition: all var(--transition);
  outline: none;
}

.control-bar-toggle:hover {
  background: #2d2e30;
  color: #fff;
}

.control-bar.collapsed .control-bar-toggle {
  transform: translateX(-50%) rotate(180deg);
  top: -26px;
  border-bottom: 1px solid var(--border-color);
  border-radius: 4px;
}

.control-buttons-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.control-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: #3c4043;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  position: relative;
}

.control-btn:hover {
  background: #4f5054;
}

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

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

.control-btn-end {
  width: 60px;
  height: 48px;
  border-radius: 24px;
  background: var(--color-danger);
  border: none;
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.control-btn-end:hover {
  background: var(--color-danger-hover);
}

.control-btn-tooltip {
  display: none; /* Hide complex tooltips for cleaner minimalist look */
}

/* ============================================
   TOASTS & ANIMATIONS
   ============================================ */

.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 12px 20px;
  color: #fff;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: slideInRight 0.2s ease forwards;
}

.toast.success { border-left: 3px solid var(--color-success); }
.toast.error { border-left: 3px solid var(--color-danger); }
.toast.info { border-left: 3px solid var(--color-primary); }

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

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

@keyframes slideInRight {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(30px); opacity: 0; }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
  .role-cards {
    grid-template-columns: 1fr;
  }

  .role-card {
    padding: 24px;
  }

  .remote-camera-container, .pip-remote-camera, .pip-camera {
    width: 140px;
    height: 105px;
  }

  .remote-camera-container {
    top: 12px;
    right: 12px;
  }

  .pip-remote-camera {
    top: 12px;
    right: 12px;
  }

  .pip-camera {
    bottom: 12px;
    right: 12px;
  }
}

@media (max-width: 480px) {
  .brand h1 {
    font-size: 1.7rem;
  }

  .remote-camera-container, .pip-remote-camera, .pip-camera {
    width: 100px;
    height: 75px;
  }
}

/* --- PiP Hide & Show Buttons --- */
.pip-camera {
  position: relative;
}

.pip-hide-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  z-index: 10;
  transition: background var(--transition);
  outline: none;
  font-weight: 500;
}

.pip-hide-btn:hover {
  background: rgba(0, 0, 0, 0.8);
}

.pip-show-btn {
  position: absolute;
  bottom: 16px;
  right: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: #fff;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  z-index: 15;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: background var(--transition);
}

.pip-show-btn:hover {
  background: #35363a;
}

/* Align SVGs in buttons */
.control-btn svg, .control-btn-end svg, .control-bar-toggle svg {
  display: block;
  stroke: currentColor;
  fill: none;
}

.hidden {
  display: none !important;
}
