/* =============================================================================
   FLOWORK OS — NANO-MODULAR COMPONENT: TOPBAR_HEADER.CSS
   Author: Flowork OS Sovereign Architect & Awenk Audico
   Co-authored-by: Flowork OS <agent@floworkos.com>
   
   Scope:
   - System Floating Topbar Bar & Navigation Architecture
   - Brand Capsule & Version Gem
   - Central Omni-Search Module
   - Connection / Sovereign Router Telemetry Pill & Spectrum Cyber Bars
   - Google Drive Storage Pool Beacon
   - Applications & Chat Toggle Pills
   - Sovereign User Profile Identity, Tier Badges & Session Controls
   ============================================================================= */

/* ==========================================================================
   1. SYSTEM TOPBAR MAIN CONTAINER
   ========================================================================== */
.system-topbar {
  height: 54px;
  background: rgba(4, 8, 16, 0.85) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom: 1px solid rgba(0, 229, 255, 0.22) !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  flex-shrink: 0;
  z-index: 100;
  position: relative;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6), inset 0 -1px 0 rgba(0, 229, 255, 0.12) !important;
}

/* ==========================================================================
   2. TOPBAR LEFT: BRAND CAPSULE
   ========================================================================== */
.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.brand-capsule {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 229, 255, 0.04);
  padding: 4px 12px 4px 5px;
  border-radius: 9999px;
  border: 1px solid rgba(0, 229, 255, 0.3);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.08);
  transition: all 0.2s ease;
  user-select: none;
}

.brand-capsule:hover {
  border-color: rgba(0, 229, 255, 0.6);
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.2);
}

.brand-gem {
  background: radial-gradient(circle at 35% 30%, #38bdf8 0%, #00e5ff 65%, #0284c7 100%);
  color: #030712;
  font-weight: 900;
  font-size: 12px;
  width: 22px;
  height: 22px;
  border-radius: 9999px;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 10px rgba(0, 229, 255, 0.6), inset 0 1px 1px rgba(255, 255, 255, 0.8);
}

.brand-text {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--text-main);
  text-transform: lowercase;
}

.brand-version-pill {
  font-size: 10px;
  font-family: var(--font-mono);
  color: #00e5ff;
  background: rgba(0, 229, 255, 0.12);
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 700;
  border: 1px solid rgba(0, 229, 255, 0.25);
}

/* ==========================================================================
   3. TOPBAR CENTER: OMNI-SEARCH CAPSULE
   ========================================================================== */
.topbar-center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  max-width: 520px;
  margin: 0 16px;
}

.search-capsule {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  background: rgba(8, 16, 32, 0.65) !important;
  border: 1.5px solid rgba(0, 229, 255, 0.28);
  border-radius: 9999px;
  padding: 6px 14px 6px 36px;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: all 0.25s ease;
  box-shadow: inset 0 0 10px rgba(0, 229, 255, 0.05);
}

.search-capsule:focus-within {
  border-color: #00e5ff;
  background: rgba(0, 229, 255, 0.08) !important;
  box-shadow: 0 0 18px rgba(0, 229, 255, 0.35) !important;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: #00e5ff;
  pointer-events: none;
}

.search-capsule input {
  width: 100%;
  background: transparent;
  border: none;
  font-size: 12px;
  color: var(--text-main);
  outline: none;
  font-family: inherit;
}

.search-capsule input::placeholder {
  color: var(--text-dim, #64748b);
}

.capsule-kbd {
  font-size: 10px;
  font-family: var(--font-mono);
  color: rgba(0, 229, 255, 0.85);
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 9999px;
  padding: 2px 7px;
  margin-left: 6px;
  white-space: nowrap;
}

/* ==========================================================================
   4. TOPBAR RIGHT: CONTROLS & TELEMETRY
   ========================================================================== */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

/* Generic Pill Buttons */
.topbar-pill-btn {
  background: rgba(0, 229, 255, 0.05);
  border: 1px solid rgba(0, 229, 255, 0.25);
  color: #94a3b8;
  border-radius: 9999px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar-pill-btn:hover {
  background: rgba(0, 229, 255, 0.18);
  color: #00e5ff;
  border-color: #00e5ff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
  transform: scale(1.05);
}

.topbar-pill-btn.pill-wide,
#btn-open-syncdrive,
#btn-record-promo,
#btn-toggle-chat,
#btn-toggle-workbench {
  width: auto !important;
  min-width: 36px;
  height: 32px !important;
  padding: 0 12px !important;
  gap: 6px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

#btn-toggle-workbench.is-hidden {
  opacity: 0.55;
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.03);
}

#btn-toggle-workbench.is-hidden:hover {
  opacity: 1;
  border-color: #00e5ff;
  color: #00e5ff;
}

.topbar-icon {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   5. FLOWORK SOVEREIGN ROUTER & CONNECTION PILL (DRFLOW SPEC)
   ========================================================================== */
.topbar-router-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: 9999px;
  background-color: rgba(7, 23, 44, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.35);
  font-size: 11px;
  color: #38bdf8;
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5), inset 0 0 8px rgba(0, 229, 255, 0.08);
  user-select: none;
}

.topbar-router-pill:hover {
  background-color: rgba(12, 35, 64, 0.95);
  border-color: #00e5ff;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.45);
  transform: translateY(-1px);
}

.router-pill-title {
  color: #ffffff;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.router-pill-model {
  color: #00e5ff;
  font-size: 10px;
  background: rgba(0, 229, 255, 0.12);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(0, 229, 255, 0.25);
}

/* Neural Equalizer Spectrum Cyber Bars */
.flw-cyber-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 14px;
}

.flw-cyber-bar {
  width: 2.5px;
  background: #00e5ff;
  border-radius: 1px;
  box-shadow: 0 0 6px #00e5ff;
  animation: none !important;
}

.flw-cyber-bar.b1 { height: 4px; }
.flw-cyber-bar.b2 { height: 12px; }
.flw-cyber-bar.b3 { height: 7px; }
.flw-cyber-bar.b4 { height: 13px; }

/* ==========================================================================
   6. GOOGLE DRIVE SYNC STORAGE BUTTON & BEACONS
   ========================================================================== */
.topbar-gdrive-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 9999px;
  background: rgba(0, 229, 255, 0.06);
  border: 1px solid rgba(0, 229, 255, 0.25);
  color: #00e5ff;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar-gdrive-btn:hover {
  background: rgba(0, 229, 255, 0.2);
  border-color: #00e5ff;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.4), inset 0 0 8px rgba(0, 229, 255, 0.2);
  transform: translateY(-1px);
}

.topbar-gdrive-btn .gdrive-beacon-dot {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  pointer-events: none;
}

.pulse-beacon {
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background-color: #00e5ff;
  box-shadow: 0 0 8px #00e5ff;
}

.beacon-pink { background-color: #00e5ff; box-shadow: 0 0 8px #00e5ff; }
.beacon-cyan { background-color: #00e5ff; box-shadow: 0 0 8px #00e5ff; }
.beacon-grape { background-color: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.beacon-emerald { background-color: #00f5a0; box-shadow: 0 0 8px #00f5a0; }

/* ==========================================================================
   7. USER PROFILE IDENTITY & SESSION CAPSULES
   ========================================================================== */
.user-profile-capsule {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(22, 17, 34, 0.85);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 9999px;
  padding: 4px 8px 4px 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  user-select: none;
}

.user-identity-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 4px;
}

.user-avatar-badge {
  font-size: 14px;
  line-height: 1;
}

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.user-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.user-role-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #00e5ff;
  letter-spacing: 0.04em;
}

.btn-topbar-logout {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-topbar-logout svg {
  width: 13px;
  height: 13px;
}

.btn-topbar-logout:hover {
  background: rgba(239, 68, 68, 0.35);
  border-color: #ef4444;
  color: #ffffff;
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}

.btn-topbar-login {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.15) 0%, rgba(56, 189, 248, 0.08) 100%);
  border: 1px solid rgba(0, 229, 255, 0.4);
  color: #00e5ff;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-topbar-login:hover {
  background: rgba(0, 229, 255, 0.25);
  border-color: #00e5ff;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
}

/* User Tier Badges */
.user-tier-pill {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 9px;
  border-radius: 9999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tier-enterprise {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(217, 119, 6, 0.12) 100%);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fbbf24;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}

.tier-pro {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.22) 0%, rgba(14, 116, 144, 0.12) 100%);
  border-color: rgba(6, 182, 212, 0.5);
  color: #22d3ee;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.2);
}

.tier-premium {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(4, 120, 87, 0.12) 100%);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
}

.tier-community,
.tier-free {
  background: rgba(148, 163, 184, 0.14);
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
}

/* ==========================================================================
   8. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1024px) {
  .topbar-center {
    max-width: 320px;
    margin: 0 10px;
  }
}

@media (max-width: 768px) {
  .system-topbar {
    padding: 0 10px;
  }
  .topbar-center {
    display: none;
  }
  .brand-version-pill {
    display: none;
  }
}

/* ==========================================================================
   9. VIRAL PROMO RECORDER BUTTON
   ========================================================================== */
.record-promo-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 0 12px !important;
  width: auto !important;
  height: 32px !important;
  background: rgba(239, 68, 68, 0.1) !important;
  border: 1px solid rgba(239, 68, 68, 0.35) !important;
  color: #fca5a5 !important;
  font-weight: 700 !important;
  font-size: 11px !important;
  border-radius: 9999px !important;
  cursor: pointer;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.record-promo-btn:hover {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.45) !important;
  transform: translateY(-1px);
}

.record-promo-btn.is-recording {
  background: rgba(239, 68, 68, 0.3) !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  box-shadow: 0 0 20px rgba(239, 68, 68, 0.6) !important;
}

.rec-beacon {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: #ef4444;
  box-shadow: 0 0 6px #ef4444;
  display: inline-block;
  flex-shrink: 0;
}

.record-promo-btn.is-recording .rec-beacon {
  animation: pulse-rec-dot 1s infinite alternate;
}

@keyframes pulse-rec-dot {
  0% { transform: scale(0.9); opacity: 0.7; box-shadow: 0 0 4px #ef4444; }
  100% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #ef4444; }
}

