/* ═══════════════════════════════════════════════════════════
   Top Navigation Bar + Bottom Dock
   Ported from V2 monolith, adapted for V3 variables & movita branding
   ═══════════════════════════════════════════════════════════ */

/* -------- Toolbar (desktop) -------- */
.toolbar {
  position: fixed; top: 14px; left: 14px; right: 14px; height: 42px;
  display: flex; gap: 8px; align-items: center;
  z-index: 10; pointer-events: none;
}
.toolbar > * { pointer-events: auto; }

/* -------- Brand -------- */
.brand {
  background: linear-gradient(145deg, rgba(22,14,42,.9) 0%, rgba(10,16,32,.93) 100%);
  backdrop-filter: blur(60px) saturate(1.8); -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 8px 14px;
  font-weight: 800;
  letter-spacing: .02em;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
}
/* Gradient brand text — flame: silver → amber → coral → pink → violet → teal tip */
.brand-desktop {
  background: linear-gradient(
    90deg,
    #c8cdd8 0%,       /* "m" — silver */
    #d4c8b8 25%,      /* "o" — warm silver */
    #ffb347 34%,      /* "v" start — bright amber */
    #f5944a 42%,      /* "v" end — warm orange */
    #ff7eb3 54%,      /* "i" — bright pink */
    #e87bc8 66%,      /* "t" start — orchid pink */
    #c98ef0 78%,      /* "t" end — bright violet */
    #a8b4f8 88%,      /* "a" start — periwinkle */
    #5ce0d6 100%      /* "a" tip — bright teal */
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: .02em;
}
.brand .count-info {
  color: var(--muted); font-weight: 500; margin-left: 6px;
  -webkit-text-fill-color: var(--muted);
}
.brand-mobile { display: none; }

/* -------- Search -------- */
.search-wrap { position: relative; display: flex; align-items: center; }
.search-btn {
  background: linear-gradient(145deg, rgba(22,14,42,.9) 0%, rgba(10,16,32,.93) 100%);
  backdrop-filter: blur(60px) saturate(1.8); -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  color: rgba(255,255,255,.5); padding: 6px 10px; cursor: pointer; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 5px; transition: background .15s, border-color .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  min-width: 280px;
}
.search-btn:hover {
  background: linear-gradient(145deg, rgba(30,20,50,.97) 0%, rgba(16,22,40,.97) 100%);
  color: var(--text); border-color: rgba(255,255,255,.18);
}
.search-flyout {
  position: absolute; top: calc(100% + 6px); left: 0;
  z-index: 65; width: 340px;
  background: linear-gradient(145deg, rgba(22,14,42,.92) 0%, rgba(10,16,32,.93) 50%, rgba(14,22,36,.92) 100%);
  backdrop-filter: blur(60px) saturate(1.8); -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.12); border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 1px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none; transform: translateY(-8px); transition: opacity .2s, transform .2s;
  overflow: hidden;
}
.search-flyout.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.search-flyout-head {
  display: flex; border-bottom: 1px solid rgba(255,255,255,.08); padding: 4px;
  background: rgba(255,255,255,.03);
}
.search-flyout-head button {
  flex: 1; padding: 8px; border: none; background: transparent; color: rgba(255,255,255,.4);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: color .15s, background .15s;
  border-radius: 8px;
}
.search-flyout-head button.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(139,92,246,.25), rgba(59,130,246,.2));
  box-shadow: 0 0 12px rgba(139,92,246,.15);
}
.search-flyout input {
  width: 100%; padding: 12px 16px; border: none; background: transparent;
  color: var(--text); font-size: 14px; outline: none;
  border-bottom: 1px solid rgba(255,255,255,.06); box-sizing: border-box;
}
.search-flyout input::placeholder { color: rgba(255,255,255,.3); }
.search-results { max-height: 280px; overflow-y: auto; }
.search-result {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer;
  transition: background .12s;
}
.search-result:hover { background: linear-gradient(135deg, rgba(139,92,246,.08), rgba(59,130,246,.06)); }
.search-result .sr-icon { font-size: 16px; width: 28px; text-align: center; flex-shrink: 0; opacity: .6; }
.search-result .sr-info { flex: 1; min-width: 0; }
.search-result .sr-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result .sr-meta { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* -------- View Mode Tabs (desktop center) -------- */
.viewmode {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: linear-gradient(145deg, rgba(22,14,42,.9) 0%, rgba(10,16,32,.93) 100%);
  backdrop-filter: blur(60px) saturate(1.8); -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 4px;
  display: flex; gap: 2px;
  box-shadow: 0 4px 16px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.08);
}
/* Sliding highlight indicator */
.viewmode-highlight {
  position: absolute;
  top: 4px; left: 4px;
  height: calc(100% - 8px);
  border-radius: 9px;
  background: linear-gradient(135deg, rgba(139,92,246,.22), rgba(59,130,246,.18));
  box-shadow: 0 0 12px rgba(139,92,246,.12), inset 0 0 0 1px rgba(255,255,255,.08);
  transition: left .3s cubic-bezier(.4, 0, .2, 1), width .3s cubic-bezier(.4, 0, .2, 1);
  pointer-events: none;
  z-index: 0;
}
.viewmode button {
  position: relative; z-index: 1;
  background: transparent; border: none; color: rgba(255,255,255,.4);
  padding: 6px 12px; border-radius: 9px; font-weight: 600; cursor: pointer;
  font-size: 12px; display: flex; align-items: center; gap: 5px;
  transition: color .2s ease;
}
.viewmode button:hover { color: rgba(255,255,255,.65); }
.viewmode button.active {
  color: #fff;
}

/* -------- Spacer -------- */
.spacer { flex: 1; }

/* -------- Bell / Notifications -------- */
/* -------- Galactic Button -------- */
.galactic-btn {
  background: linear-gradient(145deg, rgba(22,14,42,.9) 0%, rgba(10,16,32,.93) 100%);
  backdrop-filter: blur(60px) saturate(1.8); -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(196,113,237,.25); border-radius: 10px;
  padding: 6px 10px; cursor: pointer;
  font-size: 16px; line-height: 1;
  transition: all .2s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,.25), 0 0 8px rgba(196,113,237,.1);
}
.galactic-btn:hover {
  border-color: rgba(196,113,237,.5);
  box-shadow: 0 2px 12px rgba(0,0,0,.3), 0 0 16px rgba(196,113,237,.25);
  transform: scale(1.05);
}

.bell-wrap { position: relative; }
.bell-btn {
  position: relative;
  background: linear-gradient(145deg, rgba(22,14,42,.9) 0%, rgba(10,16,32,.93) 100%);
  backdrop-filter: blur(60px) saturate(1.8); -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.12); border-radius: 10px;
  color: rgba(255,255,255,.5); padding: 6px 8px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.bell-btn:hover {
  color: var(--text); border-color: rgba(255,255,255,.18);
}
.bell-dot {
  position: absolute; top: 4px; right: 4px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: none;
  animation: pulse-dot 2s ease-in-out infinite;
}
.bell-dot.active { display: block; }

/* -------- Bell Flyout (Notifications panel) -------- */
.bell-flyout {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 320px; max-height: 420px;
  background: linear-gradient(160deg, rgba(22,14,42,.92) 0%, rgba(10,16,32,.93) 50%, rgba(14,22,36,.92) 100%);
  backdrop-filter: blur(60px) saturate(1.8); -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.12); border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.08);
  overflow: hidden; z-index: 55;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none; transform: translateY(-8px);
  transition: opacity .2s, transform .2s;
}
.bell-flyout.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.bell-head {
  padding: 12px 14px; font-weight: 800; font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; justify-content: space-between; align-items: center;
}
.bell-head small { font-weight: 500; color: var(--muted); font-size: 11px; }
.bell-list { overflow-y: auto; padding: 4px 0; max-height: 360px; }
.bell-list .bell-empty {
  padding: 24px 14px; text-align: center;
  color: var(--muted); font-size: 12px;
}
.bell-item {
  padding: 10px 14px; display: flex; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 12px; transition: background .12s;
}
.bell-item:last-child { border-bottom: none; }
.bell-item:hover { background: rgba(139,92,246,.06); }
.bell-item.unread { background: rgba(124,156,255,.06); }
.bell-item .bi-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface2); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text);
}
.bell-item .bi-body { flex: 1; min-width: 0; line-height: 1.35; }
.bell-item .bi-body b { color: var(--text); }
.bell-item .bi-body .bi-text {
  color: var(--muted); display: block; margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bell-item .bi-time { font-size: 10px; color: var(--muted); flex-shrink: 0; }

/* -------- Me / Avatar -------- */
.me {
  position: relative; cursor: pointer;
  background: linear-gradient(145deg, rgba(22,14,42,.9) 0%, rgba(10,16,32,.93) 100%);
  backdrop-filter: blur(60px) saturate(1.8); -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 6px 10px 6px 6px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.me .av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 12px;
  overflow: hidden;
}
.me .av img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}

/* -------- Avatar Dropdown -------- */
.me-dropdown {
  display: none;
  position: absolute; top: 100%; right: 0;
  margin-top: 4px;
  background: linear-gradient(155deg, rgba(22,14,42,.92) 0%, rgba(10,16,32,.93) 50%, rgba(14,22,36,.92) 100%);
  backdrop-filter: blur(60px) saturate(1.8); -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(255,255,255,.12); border-radius: 14px;
  padding: 4px; min-width: 140px; z-index: 60;
  box-shadow: 0 12px 36px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.08);
}
.me-dropdown.open { display: block; }
.me-dropdown button {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 8px 12px; font-size: 13px; font-weight: 500; border-radius: 8px; cursor: pointer;
}
.me-dropdown button:hover {
  background: linear-gradient(135deg, rgba(139,92,246,.1), rgba(59,130,246,.08));
}

/* -------- Sign-in CTA -------- */
.nav-cta {
  background: var(--accent); color: var(--bg);
  border-radius: var(--radius-sm); padding: 8px 18px;
  font-weight: 700; font-size: 13px;
  transition: filter var(--transition);
}
.nav-cta:hover { filter: brightness(1.15); }

/* -------- Mobile bottom dock (hidden on desktop) -------- */
.mobile-dock { display: none; }

/* ═══════════════════════════════════════════════════════════
   Mobile Responsive (max-width: 760px)
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  /* --- Top bar --- */
  .toolbar {
    top: 0; left: 0; right: 0;
    padding: 8px 10px;
    gap: 6px; flex-wrap: nowrap;
    background: rgba(11,13,16,.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }

  /* Brand = page title on mobile */
  .brand {
    padding: 0; font-size: 15px; font-weight: 800; border: none; background: none;
    order: 1; margin-right: 0; letter-spacing: -.01em;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  .brand .count-info { display: none; }
  .brand-desktop { display: none; }
  .brand-mobile { display: inline; }

  /* Hide desktop viewmode tabs on mobile — dock replaces them */
  .viewmode { display: none !important; }

  /* Search: icon-only on mobile */
  .search-wrap { order: 4; }
  .search-btn {
    font-size: 0; padding: 6px 8px; gap: 0;
    border: none; background: none; min-width: auto;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  .search-btn svg { width: 18px; height: 18px; }
  .search-flyout {
    position: fixed !important; top: 60px !important; left: 50% !important; right: auto !important;
    transform: translateX(-50%) translateY(-8px) !important;
    width: calc(100vw - 32px) !important; max-width: 380px;
    -webkit-backdrop-filter: blur(50px) saturate(1.8) !important;
    backdrop-filter: blur(50px) saturate(1.8) !important;
  }
  .search-flyout.open { transform: translateX(-50%) translateY(0) !important; }

  /* Spacer pushes right group to end */
  .spacer { order: 3; flex: 1; display: block; }

  /* Bell: right side */
  .bell-wrap { order: 4; }
  .bell-btn {
    width: 30px; height: 30px; font-size: 13px;
    border: none; background: none;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  .bell-flyout {
    position: fixed !important; top: 52px !important; right: 8px !important;
    width: calc(100vw - 16px) !important; max-width: 360px;
  }

  /* Me/avatar: far right */
  .me {
    position: relative;
    padding: 0; border: none; background: none;
    z-index: 11;
    order: 5;
    margin-left: 0;
    backdrop-filter: none; -webkit-backdrop-filter: none;
    box-shadow: none;
  }
  .me .av { width: 30px; height: 30px; font-size: 11px; cursor: pointer; }
  .me-dropdown { left: auto; right: 0; }

  /* --- Bottom dock (Instagram-style) --- */
  .mobile-dock {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    height: 64px;
    background: linear-gradient(180deg, rgba(14,10,28,.88) 0%, rgba(8,12,22,.95) 100%);
    backdrop-filter: blur(40px) saturate(1.6);
    -webkit-backdrop-filter: blur(40px) saturate(1.6);
    border-top: 1px solid rgba(255,255,255,.08);
    z-index: 12;
    align-items: center;
    justify-content: center;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 24px rgba(0,0,0,.4);
  }
  .dock-tabs {
    display: flex; justify-content: space-around; align-items: center;
    width: 100%; max-width: 420px; padding: 0 8px;
  }
  .dock-tabs button {
    background: none; border: none; color: rgba(255,255,255,.4);
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 6px 8px; border-radius: 12px;
    cursor: pointer; transition: color .2s, transform .15s;
    -webkit-tap-highlight-color: transparent;
  }
  .dock-tabs button svg {
    transition: transform .2s, filter .2s;
  }
  .dock-tabs button .dock-label {
    font-size: 9px; font-weight: 600; letter-spacing: .03em;
    text-transform: uppercase; line-height: 1;
  }
  .dock-tabs button.active {
    color: #fff;
  }
  .dock-tabs button.active svg {
    filter: drop-shadow(0 0 6px rgba(139,92,246,.35));
  }
  .dock-tabs button:active {
    transform: scale(0.9);
  }

  /* Give content room for top bar and bottom dock */
  #app {
    padding-top: 52px;
    padding-bottom: 72px;
  }
}

/* Desktop: show brand-desktop, hide brand-mobile */
@media (min-width: 761px) {
  .brand-desktop { display: inline; }
  .brand-mobile { display: none; }
}
