/* ============================================================
   WHALE OS — Floating Sidebar + AI Command Bar DNA
   Spec: 02. Floating Sidebar / 03. AI Command Bar
   ============================================================ */

/* ══════════════════════════════════════════════════════════
   02. FLOATING SIDEBAR
   ══════════════════════════════════════════════════════════ */

:root {
  --sidebar-w-collapsed: 68px;
  --sidebar-w-expanded: 240px;
  --sidebar-transition: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  --header-h: 64px;
}

/* Sidebar - Clean Relate White SaaS */
.sidebar {
  position: fixed !important;
  top: var(--header-h) !important;
  right: 0 !important;
  height: calc(100vh - var(--header-h)) !important;
  width: var(--sidebar-w-collapsed) !important;
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-left: 1px solid var(--stone-divider, #e2e8f0) !important;
  outline: none !important;
  z-index: 900 !important;
  transition: width var(--sidebar-transition) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 12px 0 !important;
  box-shadow: 0 1px 3px rgba(2, 5, 32, 0.02) !important;
}

[dir="ltr"] .sidebar {
  right: auto !important;
  left: 0 !important;
  border-left: none !important;
  border-right: 1px solid var(--stone-divider, #e2e8f0) !important;
}

.sidebar.expanded,
.sidebar:hover {
  width: var(--sidebar-w-expanded) !important;
  box-shadow: 0 4px 16px rgba(2, 5, 32, 0.06) !important;
}

/* Sidebar logo / brand area */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 14px;
  border-bottom: 1px solid var(--stone-divider, #e2e8f0);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-brand-logo {
  width: 34px;
  height: 34px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sidebar-brand:hover .sidebar-brand-logo {
  transform: scale(1.05);
}

.sidebar-brand-texts {
  display: flex;
  flex-direction: column;
  gap: 1px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--sidebar-transition), transform var(--sidebar-transition);
  min-width: 0;
}

.sidebar.expanded .sidebar-brand-texts,
.sidebar:hover .sidebar-brand-texts {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-brand-text {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--midnight-ink, #020520);
  font-family: var(--font-english, 'Inter', sans-serif);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.sidebar-brand-powered {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--ash-helper, #6b7280);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Nav items container */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 10px;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

/* Nav item - Relate Pill Style */
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 9999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  position: relative;
  color: var(--slate-caption, #475569);
  text-decoration: none;
  margin-bottom: 3px;
  border: 1px solid transparent;
  background: transparent;
  width: 100%;
  text-align: right;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
}

[dir="ltr"] .sidebar-nav-item {
  text-align: left;
}

.sidebar-nav-item:hover {
  background: #f1f5f9;
  color: var(--midnight-ink, #020520);
}

.sidebar-nav-item.active {
  background: var(--lavender-wash, #f0f4fe) !important;
  color: var(--primary, #145aff) !important;
  font-weight: 600 !important;
  border-color: transparent !important;
}

.sidebar-nav-item.active::before {
  display: none !important;
}

.sidebar-nav-icon {
  font-size: 16px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.sidebar-nav-label {
  font-size: 13px;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity var(--sidebar-transition), transform var(--sidebar-transition);
  flex: 1;
}

.sidebar.expanded .sidebar-nav-label,
.sidebar:hover .sidebar-nav-label {
  opacity: 1;
  transform: translateX(0);
}

/* Section divider */
.sidebar-divider {
  height: 1px;
  background: var(--stone-divider, #e2e8f0);
  margin: 8px 10px;
  opacity: 0.8;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 8px 10px;
  border-top: 1px solid var(--stone-divider, #e2e8f0);
}

/* Adjust main viewport padding when sidebar is present */
.main-viewport {
  margin-right: var(--sidebar-w-collapsed) !important;
  margin-left: 0 !important;
  transition: margin-right var(--sidebar-transition) !important;
}

[dir="ltr"] .main-viewport {
  margin-right: 0 !important;
  margin-left: var(--sidebar-w-collapsed) !important;
  transition: margin-left var(--sidebar-transition) !important;
}

/* ══════════════════════════════════════════════════════════
   03. AI COMMAND BAR
   ══════════════════════════════════════════════════════════ */

/* Global AI Command Bar — clean white floating pill */
.dna-ai-command-bar {
  position: fixed;
  top: calc(var(--header-h) + 14px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 850;
  width: 100%;
  max-width: 640px;
  padding: 0 16px;
  pointer-events: none;
}

.dna-ai-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 9999px;
  box-shadow: var(--shadow-relate-card);
  cursor: pointer;
  pointer-events: all;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.dna-ai-bar-inner:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-relate-card-hover);
}

.dna-ai-logo {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--lavender-wash, #f0f4fe);
  color: var(--primary, #145aff);
  display: grid;
  place-items: center;
  font-size: 15px;
  flex-shrink: 0;
}
.dna-ai-bar-placeholder {
  flex: 1;
  font-size: 13.5px;
  color: var(--ash-helper, #6b7280);
}
.dna-ai-bar-placeholder span { color: var(--ash-helper, #6b7280); font-weight: 400; }

.dna-ai-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.dna-ai-bar-shortcut {
  padding: 3px 8px;
  background: var(--fog-surface, #f8fafc);
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 6px;
  font-size: 11px;
  color: var(--slate-caption, #475569);
  font-family: var(--font-english, 'Inter', monospace);
}

.dna-ai-voice-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid transparent;
  display: grid;
  place-items: center;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  color: var(--ash-helper, #6b7280);
}
.dna-ai-voice-btn:hover {
  background: #f1f5f9;
  color: var(--primary, #145aff);
}

/* Quick Actions under AI bar */
.dna-ai-quick-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  pointer-events: all;
  justify-content: center;
}
.dna-ai-qa-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: #ffffff;
  border: 1px solid var(--stone-divider, #e2e8f0);
  border-radius: 9999px;
  font-size: 12px;
  color: var(--slate-caption, #475569);
  cursor: pointer;
  transition: all 0.15s ease;
  pointer-events: all;
  white-space: nowrap;
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(2, 5, 32, 0.03);
}
.dna-ai-qa-chip:hover {
  background: var(--lavender-wash, #f0f4fe);
  border-color: rgba(20, 90, 255, 0.2);
  color: var(--primary, #145aff);
}

/* ══════════════════════════════════════════════════════════
   HEADER DNA UPGRADES
   ══════════════════════════════════════════════════════════ */

.header-desktop {
  height: var(--header-h) !important;
  background: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid var(--stone-divider, #e2e8f0) !important;
  box-shadow: 0 1px 2px rgba(2, 5, 32, 0.03) !important;
  z-index: 950 !important;
}

/* Mobile: hide sidebar, full width */
@media (max-width: 768px) {
  .sidebar {
    display: none !important;
  }
  .main-viewport {
    margin-right: 0 !important;
  }
  .dna-ai-command-bar {
    max-width: calc(100vw - 32px);
  }
}
