/**
 * Components Styles
 * Shared UI components: toasts, modals, buttons, badges
 */

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 90%;
  max-width: 350px;
  pointer-events: none;
}

@media (min-width: 769px) {
  .toast-container {
    left: auto;
    right: 20px;
    transform: none;
    max-width: 300px;
  }
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
  max-width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.toast.success {
  background: #2ecc71;
  color: #fff;
}

.toast.error {
  background: #e74c3c;
  color: #fff;
}

.toast.warning {
  background: #f39c12;
  color: #fff;
}

.toast.info {
  background: var(--accent-primary);
  color: #fff;
}

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  to { opacity: 0; transform: translateX(100%); }
}

/* ==========================================
   MODAL
   ========================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

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

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background var(--transition-fast), color var(--transition-fast);
  line-height: 1;
}

.modal-close-btn:hover {
  background: var(--border-color);
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ==========================================
   FILTER MODAL SPECIFIC
   ========================================== */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
}

.filter-preset-btn {
  padding: 10px 16px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.filter-preset-btn:hover {
  background: var(--bg-secondary);
  border-color: var(--accent-primary);
}

.filter-preset-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.filter-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.filter-control-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-group label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.slider-group input[type="range"] {
  width: 100%;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--bg-tertiary);
  border-radius: 3px;
  outline: none;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
}

.slider-group input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: none;
}

.color-picker-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.color-picker-group label {
  font-size: 13px;
  color: var(--text-secondary);
}

.color-picker-group input[type="color"] {
  width: 60px;
  height: 40px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-tertiary);
  cursor: pointer;
  padding: 4px;
}

/* ==========================================
    PARTICIPANTS DROPDOWN - Recessed design
    ========================================== */

/* Wrapper positioned relative to titlebar */
.participants-dropdown-wrapper {
  position: absolute;
  top: 50%;
  right: 48px;
  transform: translateY(-50%);
  z-index: 400;
}

/* Dropdown panel - recessed style matching landing card */
.participants-dropdown-panel {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%) scale(0.95);
  width: 280px;
  max-height: 360px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  /* Recessed effect: inset shadows create depth */
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.03),
    inset 0 -1px 4px rgba(0, 0, 0, 0.2),
    0 8px 32px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Dropdown visible state */
.participants-dropdown-wrapper.active .participants-dropdown-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) scale(1);
}

/* Dropdown header - subtle accent background */
.participants-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(91, 192, 190, 0.05);
}

.participants-dropdown-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
}

.participants-dropdown-close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: background var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.participants-dropdown-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

/* Dropdown list */
.participants-dropdown-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
  overflow-y: auto;
  max-height: 300px;
}

/* Individual participant item - subtle hover matching mockup */
.participant-item {
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-size: 14px;
  transition: all 0.25s ease;
  border-radius: 8px;
  margin: 0 4px;
  cursor: default;
}

.participant-item:hover {
  background: rgba(91, 192, 190, 0.04);
  color: var(--text-primary);
}

.participant-item.self {
  color: var(--text-secondary);
}

.participant-item.self .participant-name {
  font-style: italic;
}

/* Status dot indicator */
.participant-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.participant-status-dot.online {
  background: var(--accent-primary);
}

.participant-status-dot.speaking {
  background: #2ecc71;
  box-shadow: 0 0 6px rgba(46, 204, 113, 0.5);
  animation: pulse 1.5s ease infinite;
}

.participant-status-dot.mic-off {
  background: #e74c3c;
}

.participant-status-dot.camera-off {
  background: var(--accent-warning);
}

/* Participant name */
.participant-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

/* Status badges - colored text pills */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  flex-shrink: 0;
  margin-left: 4px;
}

/* Badge variants */
.status-badge.muted {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
}

.status-badge.no-cam {
  background: rgba(243, 156, 18, 0.15);
  color: #f39c12;
  border: 1px solid rgba(243, 156, 18, 0.3);
}

.status-badge.encrypted {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.3);
}

.status-badge.cbr {
  background: rgba(91, 192, 190, 0.15);
  color: #5bc0be;
  border: 1px solid rgba(91, 192, 190, 0.3);
}

.status-badge.speaking-badge {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.3);
  animation: pulse 1.5s ease infinite;
}

.status-badge.self-label {
  background: rgba(139, 149, 165, 0.1);
  color: var(--text-secondary);
  border: 1px solid rgba(139, 149, 165, 0.2);
}

/* Participant info container (name + badges) */
.participant-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.participant-info-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Empty state */
.participants-dropdown-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Scrollbar styling */
.participants-dropdown-list::-webkit-scrollbar {
  width: 6px;
}

.participants-dropdown-list::-webkit-scrollbar-track {
  background: transparent;
}

.participants-dropdown-list::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.participants-dropdown-list::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

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

.spinner.large {
  width: 60px;
  height: 60px;
  border-width: 4px;
}

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

/* ==========================================
   GRADIENT OVERLAY FOR TITLES
   ========================================== */
.video-title-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent);
  pointer-events: none;
  z-index: 2;
}