/* ShowIt - Professional Video Conferencing */
/* Clean Zoom-inspired design */

:root {
  /* Dark theme - Zoom-like */
  --bg-dark: #0d0d0d;
  --bg-main: #1a1a1a;
  --bg-elevated: #242424;
  --bg-surface: #2d2d2d;
  --bg-hover: #383838;
  
  /* Accent colors */
  --blue-primary: #0d6efd;
  --blue-hover: #0b5ed7;
  --green: #26d97f;
  --red: #e53935;
  --red-hover: #c62828;
  --orange: #ff9800;
  
  /* Text */
  --text-white: #ffffff;
  --text-light: #e4e4e4;
  --text-muted: #9b9b9b;
  --text-dim: #666666;
  
  /* Borders */
  --border: #3d3d3d;
  --border-light: #4a4a4a;
  
  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 50%;
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-dark);
  color: var(--text-light);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ================================================
   HOME & JOIN PAGES
   ================================================ */

.home-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg-dark);
}

.auth-card {
  background: var(--bg-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
}

.auth-card .logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-card .logo-icon {
  width: 64px;
  height: 64px;
  background: var(--blue-primary);
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 28px;
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-white);
  margin-bottom: 6px;
}

.auth-card .subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.auth-card .meeting-info {
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 24px;
  text-align: center;
  border: 1px solid var(--border);
}

.auth-card .meeting-info .label {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.auth-card .meeting-info .name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-white);
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-white);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--blue-primary);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.form-input::placeholder {
  color: var(--text-dim);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 15px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--blue-primary);
  color: white;
  width: 100%;
}

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

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-light);
  border: 1px solid var(--border);
}

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

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

.btn-danger:hover {
  background: var(--red-hover);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 18px;
}

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

/* ================================================
   MEETING ROOM - MAIN LAYOUT
   ================================================ */

.meeting-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  background: var(--bg-dark);
  overflow: hidden;
}

/* Header */
.meeting-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: 52px;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.meeting-info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.meeting-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-white);
}

.meeting-id {
  font-size: 12px;
  color: var(--text-dim);
  padding: 4px 10px;
  background: var(--bg-surface);
  border-radius: 4px;
}

.meeting-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.meeting-timer .dot {
  width: 6px;
  height: 6px;
  background: var(--green);
  border-radius: var(--radius-full);
}

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

/* Main Content Area */
.meeting-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.video-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: var(--bg-dark);
  overflow: hidden;
}

/* ================================================
   VIDEO GRID - Zoom Layout
   ================================================ */

.video-grid {
  display: grid;
  gap: 6px;
  width: 100%;
  height: 100%;
  max-width: 100%;
}

.video-grid.grid-1 {
  grid-template-columns: 1fr;
  max-width: 960px;
  margin: 0 auto;
}

.video-grid.grid-2 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 1200px;
  margin: 0 auto;
}

.video-grid.grid-3,
.video-grid.grid-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.video-grid.grid-5,
.video-grid.grid-6 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

.video-grid.grid-7,
.video-grid.grid-8,
.video-grid.grid-9 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
}

.video-grid.grid-many {
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
}

/* Video Tile */
.video-tile {
  position: relative;
  background: var(--bg-main);
  border-radius: var(--radius-md);
  overflow: hidden;
  aspect-ratio: 16/9;
}

.video-tile.speaking {
  box-shadow: inset 0 0 0 3px var(--green);
}

.video-tile.screen-share {
  grid-column: 1 / -1;
  aspect-ratio: auto;
  min-height: 50vh;
}

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

.video-tile.local video {
  transform: scaleX(-1);
}

/* Tile Name Overlay */
.tile-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 12px;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.participant-name {
  font-size: 13px;
  font-weight: 500;
  color: white;
  display: flex;
  align-items: center;
  gap: 6px;
}

.participant-name .host-badge {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--blue-primary);
  border-radius: 3px;
  font-weight: 600;
}

.tile-status {
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  border-radius: 4px;
  font-size: 12px;
}

.status-icon.muted {
  background: var(--red);
}

/* Avatar Placeholder */
.avatar-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
}

.avatar-circle {
  width: 88px;
  height: 88px;
  border-radius: var(--radius-full);
  background: var(--blue-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
}

/* ================================================
   SIDEBAR
   ================================================ */

.meeting-sidebar {
  width: 300px;
  background: var(--bg-main);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.2s ease, opacity 0.2s ease;
}

.meeting-sidebar.hidden {
  width: 0;
  opacity: 0;
  overflow: hidden;
  border: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-white);
}

.sidebar-close {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 16px;
}

.sidebar-close:hover {
  background: var(--bg-hover);
  color: var(--text-white);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Participant List */
.participant-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.participant-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s;
}

.participant-item:hover {
  background: var(--bg-elevated);
}

.participant-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--blue-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.participant-details {
  flex: 1;
  min-width: 0;
}

.participant-details .name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.participant-details .role {
  font-size: 12px;
  color: var(--text-dim);
}

.participant-actions {
  display: flex;
  gap: 4px;
}

/* ================================================
   CONTROL BAR
   ================================================ */

.meeting-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg-main);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.control-wrapper {
  position: relative;
}

.control-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 64px;
  height: 52px;
  background: var(--bg-surface);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-light);
  cursor: pointer;
  transition: background-color 0.15s;
}

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

.control-btn.active {
  background: var(--green);
  color: var(--bg-dark);
}

.control-btn.muted {
  background: var(--red);
  color: white;
}

.control-btn.danger {
  background: var(--red);
  color: white;
}

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

.control-btn .icon {
  font-size: 20px;
  line-height: 1;
}

.control-btn .label {
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
}

.control-btn .dropdown-arrow {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 8px;
  color: var(--text-dim);
}

.control-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  margin: 0 8px;
}

/* Device Menu */
.device-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px;
  min-width: 260px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 1000;
  display: none;
}

.device-menu.visible {
  display: block;
}

.device-menu-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 10px 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.device-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-light);
  transition: background-color 0.15s;
}

.device-menu-item:hover {
  background: var(--bg-hover);
}

.device-menu-item.selected {
  background: rgba(13, 110, 253, 0.15);
  color: var(--blue-primary);
}

.device-menu-item .check {
  width: 16px;
  font-size: 12px;
  color: var(--blue-primary);
}

.device-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* ================================================
   MODALS & OVERLAYS
   ================================================ */

.modal-overlay,
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

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

.modal {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 420px;
  padding: 28px;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.visible .modal {
  transform: scale(1);
}

.modal h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-white);
  margin-bottom: 4px;
}

.modal .subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.copy-field {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.copy-field input {
  flex: 1;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 13px;
  font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.copy-field button {
  padding: 10px 16px;
  background: var(--blue-primary);
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.15s;
}

.copy-field button:hover {
  background: var(--blue-hover);
}

/* Settings Panel */
.settings-panel {
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 520px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.settings-overlay.visible .settings-panel {
  transform: scale(1);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.settings-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-white);
}

.settings-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.settings-section {
  margin-bottom: 28px;
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-label {
  font-size: 14px;
  color: var(--text-light);
}

.settings-value {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Device Preview */
.device-preview {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--bg-dark);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 12px;
}

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

/* Volume Meter */
.volume-meter {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 20px;
}

.volume-bar {
  width: 4px;
  height: 100%;
  background: var(--bg-surface);
  border-radius: 2px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.volume-bar .fill {
  width: 100%;
  height: 0%;
  background: var(--green);
  border-radius: 2px;
  transition: height 0.1s;
}

/* Background Selector */
.background-selector {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.background-option {
  aspect-ratio: 16/9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  transition: border-color 0.15s;
  position: relative;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.background-option:hover {
  border-color: var(--text-dim);
}

.background-option.selected {
  border-color: var(--blue-primary);
}

.background-option .label {
  position: absolute;
  bottom: 2px;
  left: 2px;
  right: 2px;
  font-size: 9px;
  color: white;
  text-align: center;
  background: rgba(0,0,0,0.6);
  padding: 2px;
  border-radius: 2px;
}

/* ================================================
   SCREEN SHARE BANNER
   ================================================ */

.screen-share-banner {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: var(--bg-dark);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.screen-share-banner .stop-btn {
  background: rgba(0,0,0,0.2);
  border: none;
  color: inherit;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.screen-share-banner .stop-btn:hover {
  background: rgba(0,0,0,0.3);
}

/* ================================================
   TOAST NOTIFICATIONS
   ================================================ */

.toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-light);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastSlide 0.25s ease;
  pointer-events: auto;
}

.toast.success {
  border-left: 3px solid var(--green);
}

.toast.error {
  border-left: 3px solid var(--red);
}

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

/* ================================================
   RESPONSIVE DESIGN
   ================================================ */

@media (max-width: 1024px) {
  .meeting-sidebar {
    position: fixed;
    right: 0;
    top: 52px;
    bottom: 76px;
    z-index: 500;
    box-shadow: -4px 0 16px rgba(0,0,0,0.3);
  }
  
  .video-grid.grid-5,
  .video-grid.grid-6 {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .meeting-header {
    height: 48px;
    padding: 0 12px;
  }
  
  .meeting-info-bar {
    gap: 8px;
  }
  
  .meeting-name {
    font-size: 13px;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .meeting-id {
    display: none;
  }
  
  .video-area {
    padding: 8px;
  }
  
  .video-grid {
    gap: 4px;
  }
  
  .video-grid.grid-1 {
    max-width: 100%;
  }
  
  .video-grid.grid-2,
  .video-grid.grid-3,
  .video-grid.grid-4 {
    grid-template-columns: 1fr 1fr;
  }
  
  .meeting-controls {
    padding: 10px 12px;
    gap: 4px;
  }
  
  .control-btn {
    width: 52px;
    height: 48px;
  }
  
  .control-btn .label {
    display: none;
  }
  
  .control-divider {
    margin: 0 4px;
    height: 28px;
  }
  
  .meeting-sidebar {
    width: 100%;
    top: 48px;
    bottom: 68px;
  }
  
  .auth-card {
    padding: 28px 20px;
  }
  
  .modal {
    padding: 24px 20px;
  }
  
  .settings-panel {
    max-height: 85vh;
  }
  
  .background-selector {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .header-actions .btn-icon:not(:last-child) {
    display: none;
  }
  
  .control-btn {
    width: 48px;
    height: 44px;
  }
  
  .control-btn .icon {
    font-size: 18px;
  }
  
  .avatar-circle {
    width: 64px;
    height: 64px;
    font-size: 24px;
  }
  
  .video-grid.grid-2,
  .video-grid.grid-3,
  .video-grid.grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ================================================
   UTILITIES
   ================================================ */

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

.text-muted {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Safe area for mobile */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .meeting-controls {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}
