/* ==========================================================================
   Friendse — Search Dock fix layer (fp-search-dock.css)
   --------------------------------------------------------------------------
   1) Desktop: search bar topbar ke andar hi, logo ke saath ek hi row me
      (modern pill look) — na neeche girta hai, na content par overlap karta hai.
   2) Mobile: scroll ke dauran topbar/search chhupta nahi — hamesha pinned.
   Purely presentational. Koi functionality / markup change nahi.

   LOAD LAST (fp-overlay-fix.css ke baad).
   ========================================================================== */

/* ---------- 1. Topbar row: ek hi line, kabhi wrap nahi ---------- */
.friende-topbar-inner {
    flex-wrap: nowrap !important;
    position: relative;
    overflow: visible;
}

/* ---------- 2. Desktop search dock (logo ke bilkul baad) ---------- */
.friende-topbar-inner .fp-smart-search--header {
    position: relative;
    top: 0;
    align-self: center;
    flex: 0 1 min(440px, 34vw);
    width: min(440px, 34vw);
    min-width: 0;
    margin: 0 0 0 14px;
    transform: none;
}

.friende-topbar-inner .fp-smart-search--header .fp-smart-search__row {
    min-height: 42px;
    padding: 3px 4px 3px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--c-text, #0f172a) 4%, var(--c-surface, #fff));
    border: 1px solid color-mix(in srgb, var(--c-border, #e5e7eb) 85%, transparent);
    box-shadow: none;
}

.friende-topbar-inner .fp-smart-search--header .fp-smart-search__row:focus-within {
    background: var(--c-surface, #fff);
    border-color: color-mix(in srgb, var(--c-primary, #4f46e5) 55%, var(--c-border, #e5e7eb));
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-primary, #4f46e5) 12%, transparent);
}

.friende-topbar-inner .fp-smart-search--header .fp-smart-search__icon {
    width: 20px;
    flex: 0 0 20px;
    font-size: 19px;
}

.friende-topbar-inner .fp-smart-search--header .fp-smart-search__input {
    height: 32px;
    font-size: 13.5px;
}

.friende-topbar-inner .fp-smart-search--header .fp-smart-search__submit {
    width: 34px;
    height: 34px;
    border-radius: 999px;
}

/* Suggestion panel topbar ke neeche hi khule, page par float na kare. */
.friende-topbar-inner .fp-smart-search--header .fp-smart-search__panel {
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 300;
}

/* Right-side icon cluster hamesha kinare par */
.friende-topbar-inner > .ml-auto { margin-left: auto !important; }

/* ---------- 3. Mobile: search bar scroll par gayab na ho ---------- */
@media (max-width: 900px) {
    .friende-topbar {
        position: sticky !important;
        top: 0 !important;
        z-index: 80 !important;
        transform: none !important;
    }

    /* fp-experience.css ka auto-hide behaviour band */
    body.fx-nav-hidden .friende-topbar,
    body.fx-scrolled.fx-nav-hidden .friende-topbar {
        transform: none !important;
    }

    .friende-topbar-inner .fp-smart-search--header {
        flex: 1 1 auto;
        width: auto;
        margin-left: 8px;
    }
}

/* Chhote phones par bhi search bar dikhta rahe (pehle hide ho jata tha) */
@media (max-width: 420px) {
    .friende-topbar-inner form.fp-smart-search--header {
        display: block !important;
    }

    .friende-topbar-inner .fp-smart-search--header .fp-smart-search__row {
        min-height: 40px;
        padding-left: 10px;
    }

    .friende-topbar-inner .fp-smart-search--header .fp-smart-search__submit {
        width: 32px;
        height: 32px;
    }

    .friende-logo-box { --friende-logo-h: 26px !important; }
}

/* ==========================================================================
   FIX (user report): mobile view me profile avatar par click karne se
   dropdown screen ke right kinare se bahar nikal jata tha — sirf ek patli
   si scrollbar nazar aati thi. Ab chhoti screens par menu viewport ke saath
   fixed hota hai, is liye poora menu pehle ki tarah dikhta hai.
   Sirf presentation — koi markup/JS/route change nahi.
   ========================================================================== */
@media (max-width: 900px) {
    .friende-topbar,
    .friende-topbar-inner { overflow: visible !important; }

    .fp-profile-menu {
        position: fixed !important;
        top: 72px !important;
        right: 8px !important;
        left: auto !important;
        width: min(16rem, calc(100vw - 16px)) !important;
        max-height: calc(100vh - 96px) !important;
        overflow-y: auto !important;
        z-index: 9999 !important;
    }
}

@media (max-width: 420px) {
    .fp-profile-menu {
        top: 64px !important;
        right: 6px !important;
        width: min(15rem, calc(100vw - 12px)) !important;
        max-height: calc(100vh - 84px) !important;
    }
}


/* Fix: Mobile header search hide */
@media (max-width: 900px) {
  .friende-topbar-inner .fp-smart-search--header,
  .friende-topbar-inner form.fp-smart-search--header,
  header.friende-topbar .fp-smart-search--header { display: none !important; }
}
