/* ==========================================================================
   Personal Workspace OS — Master Layout & Viewport Subsystems
   ========================================================================== */

/* 1. Global App Container */
#root {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-app);
}

/* 2. Master OS Header */
.os-header {
  height: 48px;
  background: #0d121c;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  user-select: none;
  z-index: 100;
}

.os-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 14px;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.os-logo-badge {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-purple));
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
}

.workspace-selector-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.workspace-selector-pill:hover {
  background: var(--bg-elevated);
  border-color: var(--border-active);
}

/* Omnibox / Global Search (⌘K) */
.os-omnibox {
  width: 380px;
  height: 30px;
  background: #070a10;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.os-omnibox:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.search-kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-surface);
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-default);
  color: var(--text-muted);
}

/* Actions Roster */
.os-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-presence-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.25);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

.device-presence-pill:hover {
  background: rgba(59, 130, 246, 0.2);
}

.cloud-metrics-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}

/* 3. Mode Switcher Nav Bar */
.mode-nav-bar {
  height: 40px;
  background: #101520;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  user-select: none;
}

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

.mode-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
}

.mode-pill:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.mode-pill.active {
  color: #ffffff;
  background: var(--accent-primary);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

/* 4. Master Workspace Viewport Container */
.os-workspace-viewport {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-app);
  position: relative;
}

/* Unified Matrix Layout Grid */
.matrix-grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 6px;
  padding: 6px;
  background: #080b10;
  overflow: hidden;
  height: 100%;
}

.matrix-tile {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  height: 100%;
}

.matrix-tile-header {
  height: 34px;
  background: #141a24;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  user-select: none;
  flex-shrink: 0;
}

/* Handoff Continuity Banner */
.handoff-banner {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.15), rgba(139, 92, 246, 0.15));
  border-bottom: 1px solid rgba(59, 130, 246, 0.3);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #e0e7ff;
  flex-shrink: 0;
}

.btn-handoff {
  background: var(--accent-primary);
  color: #ffffff;
  border: none;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-handoff:hover {
  background: var(--accent-hover);
}

/* 5. PERFECT CENTERED MODAL OVERLAYS & DIALOGS */
.modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(4, 7, 12, 0.75) !important;
  backdrop-filter: blur(10px) !important;
  -webkit-backdrop-filter: blur(10px) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  z-index: 99999 !important;
  padding: 20px;
}

.modal-dialog {
  background: #111622;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  animation: modalScaleIn 0.15s ease-out;
}

@keyframes modalScaleIn {
  from {
    transform: scale(0.96);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  height: 50px;
  background: #161d2b;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  flex-shrink: 0;
}

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

.modal-footer {
  height: 52px;
  background: #161d2b;
  border-top: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 18px;
  gap: 10px;
  flex-shrink: 0;
}
