/* =====================================================================
   Mobil alt menyu (variant 3, 2026-11-30) + Satget AI düyməsi
   Mockup: yeni görünüm/alt-nav. Bu fayl BÜTÜN köhnə qaydaların
   (new_style / chatbot / home / profile / messages / favorites_glass)
   SONUNDA yüklənir və id seçiciləri ilə onları üstələyir.
   Söhbət paneli (#aiChatPanel) BU FAYLDA DƏYİŞMİR.
   ===================================================================== */

@media (max-width: 768px) {

  /* ---------- tokenlər (yalnız bu iki elementə aid) ---------- */
  #mobileBottomNav, #aiChatFab {
    --bn-h: 62px;
    --bn-gap: 0px;
    --bn-safe: env(safe-area-inset-bottom, 0px);
    --bn-brand: #6D28D9;
    --bn-brand-2: #7C3AED;
    --bn-brand-deep: #4C1D95;
    --bn-soft: #EDE9FE;
    --bn-soft-line: rgba(109, 40, 217, .16);
    --bn-ink: #5B6579;
    --bn-glass: rgba(255, 255, 255, .82);
    --bn-solid: #FFFFFF;
    --bn-line: rgba(30, 16, 80, .08);
    --bn-shadow: 0 4px 8px rgba(30, 16, 80, .04), 0 18px 40px -16px rgba(46, 16, 120, .32);
    --bn-surface: #FFFFFF;
    --bn-text: #0F172A;
    --bn-spring: cubic-bezier(.34, 1.56, .64, 1);
    --bn-out: cubic-bezier(.2, .8, .2, 1);
    --ai-a: #7C3AED;
    --ai-b: #EC4899;
    --ai-c: #22D3EE;
  }
  /* koyu tema yoxdur: mobildə sayt həmişə açıq rəngə məcbur edilir (new_style.css) —
     əvvəl koyu tema seçənlərdə açıq səhifədə tünd menyu/düymə görünürdü */

  /* menyu üçün altda yer saxla */
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
  /* mesajlar səhifəsi söhbət hündürlüyünü bu dəyişəndən hesablayır */
  :root { --bnav-h: calc(62px + env(safe-area-inset-bottom, 0px)); }
  html.kb-open { --bnav-h: 0px; }

  /* =========================== ALT MENYU (variant 3) ===========================
     Yapışıq, sakit zolaq (mask/filter yoxdur — köhnə Android-də yüngül, Safari-də
     kölgə/maska xətası yoxdur). Aktiv bölmədə ikonun arxasında həb mərkəzdən
     açılır (JS mövqe hesablamır → ölçü dəyişəndə/ilk boyamada sıçrayış yoxdur).
     «Sat» eyni ölçülü, həmişə dolu bənövşəyi həbdir — sıra pozulmur. */
  #mobileBottomNav {
    --bn-pill: #EDE9FE;
    --bn-pill-press: rgba(109, 40, 217, .10);
    --bn-strong: #1E1B2E;
    --bn-glow-a: rgba(243, 232, 255, .9);
    --bn-glow-b: rgba(224, 231, 255, .9);
  }

  body #mobileBottomNav {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    position: fixed; z-index: 9999;
    left: 0; right: 0; width: auto; bottom: 0;
    max-width: 560px; margin: 0 auto;
    height: calc(var(--bn-h) + var(--bn-safe));
    padding: 0 4px var(--bn-safe);
    border: 0; border-radius: 20px 20px 0 0;
    background: none;
    box-shadow: 0 -1px 0 var(--bn-line), 0 -12px 28px -14px rgba(46, 16, 120, .22);
    filter: none;
    transform: translate3d(0, 0, 0);
    transition: transform .32s var(--bn-out);
    -webkit-user-select: none; user-select: none;
    -webkit-touch-callout: none;
  }
  /* gizlənmə sürətli (.24s), görünmə yumşaq (.32s) */
  body #mobileBottomNav.bn-hidden { transform: translate3d(0, calc(100% + 8px), 0); transition-duration: .24s; }
  /* Android: klaviatura açılanda fixed menyu klaviaturanın üstünə qalxıb sahələri örtürdü */
  html.kb-open body #mobileBottomNav,
  body:has(.conv-panel.hide-mobile) #mobileBottomNav { display: none; }

  /* fon: hero-dakı yüngül bənövşəyi/mavi parıltı */
  #mobileBottomNav .bn-bg {
    position: absolute; inset: 0; z-index: 0; pointer-events: none;
    border-radius: inherit;
    background:
      radial-gradient(45% 140% at 0% 0%, var(--bn-glow-a), transparent 70%),
      radial-gradient(45% 140% at 100% 0%, var(--bn-glow-b), transparent 70%),
      var(--bn-surface);
  }
  #mobileBottomNav .bn-bar { display: none; }

  #mobileBottomNav .mbn-item {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    min-width: 0; min-height: 48px;
    padding: 0;
    color: var(--bn-ink);
    text-decoration: none;
    font-size: 11px; font-weight: 500; letter-spacing: -.005em; line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
    outline: none;
  }
  #mobileBottomNav .mbn-item > span:not(.bn-ico):not(.mbn-post-icon) {
    max-width: 100%; padding: 0 2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    font-size: inherit; font-weight: inherit; color: inherit;
    background: none;
    transition: color .2s;
  }
  #mobileBottomNav .mbn-item.active:not(.mbn-post) { color: var(--bn-brand); }
  #mobileBottomNav .mbn-item.active:not(.mbn-post) > span:not(.bn-ico) { color: var(--bn-strong); font-weight: 650; }

  /* ikon yuvası + arxasındakı həb (Material 3 tipli göstərici) */
  #mobileBottomNav .bn-ico,
  #mobileBottomNav .mbn-post-icon {
    position: relative; isolation: isolate;
    width: 56px; height: 30px;
    display: grid; place-items: center;
    border-radius: 15px;
  }
  #mobileBottomNav .bn-ico::before {
    content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
    background: var(--bn-pill);
    transform: scaleX(.35); opacity: 0;
    transition: transform .42s var(--bn-spring), opacity .2s, background-color .2s;
  }
  #mobileBottomNav .mbn-item.active .bn-ico::before { transform: none; opacity: 1; }
  /* toxunanda həb dərhal görünür — reaksiya 0 ms deyil */
  #mobileBottomNav .mbn-item:not(.active):active .bn-ico::before { background: var(--bn-pill-press); transform: scaleX(.9); opacity: 1; transition-duration: .15s; }

  #mobileBottomNav .bn-ico svg {
    width: 22px; height: 22px; display: block;
    fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
    transition: transform .3s var(--bn-spring), stroke-width .2s;
  }
  #mobileBottomNav .bn-ico .o { fill: currentColor; fill-opacity: 0; transition: fill-opacity .25s; }
  #mobileBottomNav .mbn-item.active .bn-ico .o { fill-opacity: .2; }
  #mobileBottomNav .mbn-item.active .bn-ico svg { stroke-width: 2; }
  #mobileBottomNav #mbn-fav.active .bn-ico .o { fill-opacity: 1; }
  #mobileBottomNav .mbn-item:active .bn-ico svg { transform: scale(.88); }
  #mobileBottomNav .mbn-item.is-pop .bn-ico svg { animation: bnPop .45s var(--bn-spring); }
  #mobileBottomNav #mbn-fav.is-pop .bn-ico svg { animation: bnBeat .6s ease; }

  #mobileBottomNav .mbn-item:focus-visible .bn-ico,
  #mobileBottomNav .mbn-item:focus-visible .mbn-post-icon { outline: 2px solid var(--bn-brand); outline-offset: 3px; }

  /* mesaj nişanı (messages.js doldurur) */
  #mobileBottomNav .mbn-badge {
    position: absolute; top: -4px; left: 31px; right: auto;
    min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
    border: 0; border-radius: 9px;
    background: #EF4444; color: #fff;
    font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
    box-shadow: 0 0 0 2px var(--bn-surface);
    animation: bnBadge .45s var(--bn-spring);
  }
  #mobileBottomNav .mbn-badge[hidden] { display: none; }

  /* «Sat» — eyni ölçülü, dolu həb; arabir üzərindən işıq keçir */
  #mobileBottomNav .mbn-post { color: var(--bn-brand); font-weight: 700; }
  #mobileBottomNav .mbn-post-icon {
    top: auto; left: auto; margin: 0;
    overflow: hidden;
    color: #fff; font-size: 0;
    background: linear-gradient(135deg, var(--bn-brand-2), var(--bn-brand-deep));
    box-shadow: 0 6px 14px -6px rgba(109, 40, 217, .8), inset 0 1px 0 rgba(255, 255, 255, .22);
    transform: translateZ(0);
    transition: transform .3s var(--bn-spring), box-shadow .2s;
  }
  #mobileBottomNav .mbn-post-icon::before { content: none; }
  #mobileBottomNav .mbn-post-icon::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .38) 50%, transparent 65%);
    transform: translate3d(-100%, 0, 0);
    animation: bnShine 7s 2s ease-in-out infinite;
  }
  #mobileBottomNav .mbn-post-icon svg {
    position: relative; width: 20px; height: 20px;
    fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round;
    transition: transform .4s var(--bn-spring);
  }
  #mobileBottomNav .mbn-post:active .mbn-post-icon { transform: scale(.92); box-shadow: 0 3px 8px -4px rgba(109, 40, 217, .8); }
  #mobileBottomNav .mbn-post:active .mbn-post-icon svg,
  #mobileBottomNav .mbn-post.is-pop .mbn-post-icon svg { transform: rotate(90deg); }
  /* menyu gizliykən işıq animasiyası boşuna işləməsin */
  #mobileBottomNav.bn-hidden .mbn-post-icon::after { animation-play-state: paused; }

  /* köhnə hover qaydalarını neytrallaşdır (iOS-da toxunuşdan sonra "ilişib qalırdı") */
  #mobileBottomNav .mbn-item:hover { color: var(--bn-ink); }
  #mobileBottomNav .mbn-item.active:hover, #mobileBottomNav .mbn-post:hover { color: var(--bn-brand); }
  #mobileBottomNav .mbn-post:hover .mbn-post-icon { transform: translateZ(0); }

  /* mesajlar: şəkil baxışı / təsdiq pəncərəsi (z 2000–3000) açıqkən menyu (9999) onları örtürdü */
  body:has(.lightbox-overlay.show) #mobileBottomNav,
  body:has(.modal-overlay.show) #mobileBottomNav { display: none; }
  /* mesajlar: alt bildiriş (bottom 26px) menyunun arxasında görünmürdü */
  body:has(.conv-panel) #toast.toast { bottom: calc(var(--bnav-h, 62px) + 14px); z-index: 10050; }

  /* bildiriş kartları iPhone-da (safe-area) menyunun altında qalırdı */
  #pushPromptCard, #installPromptCard, #tipPromptCard { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }

  /* ========================= SATGET AI DÜYMƏSİ ========================= */
  body #aiChatFab {
    display: block;
    position: fixed; z-index: 10040;
    right: 12px; left: auto;
    bottom: calc(var(--bn-h) + var(--bn-gap) + var(--bn-safe) + 12px + var(--fab-lift, 0px));
    width: 56px; height: 56px; padding: 0;
    border: 0; border-radius: 50%;
    background: none; box-shadow: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transform: translateZ(0);
    transition: bottom .4s var(--bn-out), transform .35s var(--bn-spring), opacity .25s;
  }
  body #aiChatFab::before { content: none; display: none; animation: none; }   /* köhnə nəbz halqası */
  body #aiChatFab:hover { transform: translateZ(0); box-shadow: none; }
  body #aiChatFab:active { transform: scale(.9); }
  body #aiChatFab:focus-visible { outline: 3px solid #C4B5FD; outline-offset: 4px; }
  body #aiChatFab.ai-orb-intro { animation: aiIn .7s .3s var(--bn-spring) both; }

  /* menyu gizlənəndə düymə aşağı enir */
  body.bn-is-hidden:not(.is-detail-page) #aiChatFab { bottom: calc(var(--bn-gap) + var(--bn-safe) + 14px + var(--fab-lift, 0px)); }
  /* elan səhifəsi: menyu yox, "Zəng et / Mesaj yaz" panelinin üstündə */
  body.is-detail-page #aiChatFab { bottom: calc(92px + env(safe-area-inset-bottom, 0px) + var(--fab-lift, 0px)); }
  /* klaviatura açıqkən sahələri örtməsin */
  html.kb-open body:not(.ai-chat-open) #aiChatFab { opacity: 0; pointer-events: none; }

  #aiChatFab .ai-orb-ring {
    position: absolute; inset: 0; border-radius: 50%;
    background: conic-gradient(from 0deg, var(--ai-a), var(--ai-b), var(--ai-c), var(--ai-a));
    box-shadow: 0 10px 26px -8px rgba(124, 58, 237, .7);
    animation: aiSpin 5s linear infinite;
    will-change: transform;
  }
  #aiChatFab .ai-orb-ring::after {
    content: ""; position: absolute; inset: -5px; border-radius: 50%;
    background: inherit; filter: blur(10px); opacity: .4;
    animation: aiBreath 3.2s ease-in-out infinite;
  }
  #aiChatFab .ai-orb-core {
    position: absolute; inset: 3px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--bn-surface);
    overflow: hidden;
  }
  body #aiChatFab .ai-orb-core img {
    width: 42px; height: 42px; max-width: none; object-fit: contain;
    animation: aiFloat 3.2s ease-in-out infinite;
  }
  #aiChatFab .ai-orb-spark {
    position: absolute; width: 10px; height: 10px; pointer-events: none;
    background: var(--ai-c);
    -webkit-clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
    opacity: 0;
    animation: aiTwinkle 2.6s ease-in-out infinite;
  }
  #aiChatFab .ai-orb-spark.s1 { top: -4px; right: 2px; }
  #aiChatFab .ai-orb-spark.s2 { bottom: 2px; left: -5px; width: 7px; height: 7px; background: var(--ai-b); animation-delay: 1.3s; }

  /* "Nə axtarırsınız?" balonu */
  #aiChatFab .ai-orb-tip {
    position: absolute; right: calc(100% + 10px); top: 50%; margin-top: -18px;
    height: 36px; display: flex; align-items: center;
    white-space: nowrap;
    padding: 0 14px;
    border-radius: 16px 16px 4px 16px;
    background: var(--bn-surface); color: var(--bn-text);
    font-size: 14px; font-weight: 600; line-height: 1;
    box-shadow: 0 0 0 1px var(--bn-soft-line), 0 12px 28px -12px rgba(46, 16, 120, .35);
    transform-origin: right center;
    transform: translate3d(16px, 0, 0) scale(.4);
    opacity: 0; pointer-events: none;
    transition: transform .45s var(--bn-spring), opacity .25s;
  }
  #aiChatFab .ai-orb-tip::before {
    content: ""; flex: none; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%;
    background: linear-gradient(135deg, var(--ai-a), var(--ai-b));
  }
  #aiChatFab.tip-on .ai-orb-tip { transform: none; opacity: 1; pointer-events: auto; }
  #aiChatFab .ai-orb-tip-t { display: inline-block; transition: opacity .2s, transform .2s; }
  #aiChatFab .ai-orb-tip-t.is-swap { opacity: 0; transform: translate3d(0, 6px, 0); }
}

/* Yalnız siçanlı cihazlarda hover (iOS-da toxunuşdan sonra ilişib qalmasın) */
@media (max-width: 768px) and (hover: hover) and (pointer: fine) {
  body #aiChatFab:hover { transform: scale(1.06); }
  #mobileBottomNav .mbn-item:hover { color: var(--bn-brand); }
}

@keyframes bnPop { 0% { transform: scale(.7) translateY(2px); } 60% { transform: scale(1.14) translateY(-2px); } 100% { transform: none; } }
@keyframes bnBeat { 0%, 100% { transform: scale(1); } 25% { transform: scale(1.25); } 45% { transform: scale(.92); } 65% { transform: scale(1.1); } }
@keyframes bnBadge { 0% { transform: scale(.4); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
@keyframes bnShine { 0%, 82% { transform: translate3d(-100%, 0, 0); } 100% { transform: translate3d(100%, 0, 0); } }
@keyframes aiIn { from { transform: scale(0) rotate(-90deg); opacity: 0; } }
@keyframes aiSpin { to { transform: rotate(360deg); } }
@keyframes aiBreath { 0%, 100% { opacity: .28; transform: scale(.92); } 50% { opacity: .55; transform: scale(1.06); } }
@keyframes aiFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes aiTwinkle { 0%, 100% { transform: scale(0) rotate(0); opacity: 0; } 45% { transform: scale(1) rotate(90deg); opacity: 1; } 70% { opacity: 0; } }

/* hərəkət istəməyənlər + batareya qənaəti */
@media (prefers-reduced-motion: reduce) {
  #mobileBottomNav *, #mobileBottomNav, #aiChatFab, #aiChatFab * { animation: none !important; transition-duration: .01ms !important; }
}
/* panel açıq ikən arxadakı düymənin sonsuz animasiyaları dayansın */
body.ai-chat-open #aiChatFab *,
body.ai-chat-open #aiChatFab *::after { animation-play-state: paused; }
