/**
 * NobarTV AI Search — Floating Search Button & Modal
 * Version: 2.1.0 — z-index dinaikkan ke maksimum CSS (2147483647) agar selalu
 * mengalahkan widget chat/FAB pihak ketiga apapun namanya.
 */

/* ══════════════════════════════════════════════════════════════════════════
   WRAP — satu container fixed, menampung quote box + tombol
   ════════════════════════════════════════════════════════════════════════ */
#nbtFloatWrap {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483646; /* nyaris z-index maksimum CSS — menang dari FAB plugin lain yang biasanya pakai 2147483647 */
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    pointer-events: none;
}
#nbtFloatWrap > * {
    pointer-events: all;
}

/* ══════════════════════════════════════════════════════════════════════════
   FLOATING BUTTON
   ════════════════════════════════════════════════════════════════════════ */
.nbt-float-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: #0a0a0a;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 50px;
    padding: 10px 16px 10px 13px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: .01em;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,.55), 0 1px 4px rgba(0,0,0,.3);
    transition: transform .16s cubic-bezier(.4,0,.2,1), box-shadow .16s, background .16s, border-color .16s;
    white-space: nowrap;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    line-height: 1;
    touch-action: manipulation;
    position: relative; /* bukan fixed — posisi dari wrap */
}
.nbt-float-btn:hover {
    background: #1a1a1a;
    border-color: rgba(255,255,255,.38);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,.6), 0 2px 8px rgba(0,0,0,.35);
}
.nbt-float-btn:active { transform: scale(.95); }
.nbt-float-btn svg { color: #fff; fill: currentColor; }
.nbt-float-btn__text { line-height: 1; font-size: 13px; color: #fff; }

@keyframes nbt-float-pulse {
    0%   { box-shadow: 0 4px 16px rgba(0,0,0,.55), 0 0 0 0 rgba(255,255,255,.2); }
    70%  { box-shadow: 0 4px 16px rgba(0,0,0,.55), 0 0 0 9px rgba(255,255,255,0); }
    100% { box-shadow: 0 4px 16px rgba(0,0,0,.55), 0 0 0 0 rgba(255,255,255,0); }
}
.nbt-float-btn--pulse { animation: nbt-float-pulse 2s ease-out 2; }

/* ══════════════════════════════════════════════════════════════════════════
   QUOTE BOX (.nbt-qb)
   ════════════════════════════════════════════════════════════════════════ */
.nbt-qb {
    width: 248px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,.13), 0 1px 6px rgba(0,0,0,.07);
    border: 1px solid rgba(0,0,0,.08);
    padding: 14px 14px 12px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    position: relative;
    opacity: 0;
    transform: translateY(8px);
    animation: nbtQbIn .35s cubic-bezier(.4,0,.2,1) .8s forwards;
}
@keyframes nbtQbIn {
    to { opacity: 1; transform: translateY(0); }
}

.nbt-qb__close {
    position: absolute;
    top: 8px; right: 8px;
    width: 20px; height: 20px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.07);
    color: #888;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    padding: 0; line-height: 1;
    transition: background .15s;
}
.nbt-qb__close:hover { background: rgba(0,0,0,.15); color: #333; }

.nbt-qb__eye {
    display: block;
    font-size: 9px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: #9ca3af; margin-bottom: 5px;
    padding-right: 20px;
}
.nbt-qb__kw {
    display: block;
    font-size: 14px; font-weight: 700;
    color: #0f172a; text-decoration: none;
    line-height: 1.3; margin-bottom: 4px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.nbt-qb__kw:hover { color: #2563eb; }
.nbt-qb__text {
    font-size: 11.5px; color: #64748b;
    line-height: 1.5; margin: 0 0 8px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    border-top: 1px solid #f1f5f9;
    padding-top: 6px;
}
.nbt-qb__cta {
    display: block;
    font-size: 11px; font-weight: 600;
    color: #2563eb; text-decoration: none;
    border-top: 1px solid rgba(0,0,0,.06);
    padding-top: 8px; margin-top: 4px;
    transition: color .15s;
}
.nbt-qb__cta:hover { color: #1d4ed8; }

/* ══════════════════════════════════════════════════════════════════════════
   OVERLAY & MODAL
   ════════════════════════════════════════════════════════════════════════ */
.nbt-float-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483647; /* z-index maksimum 32-bit CSS — selalu di atas widget chat/FAB pihak ketiga */
    background: rgba(10,14,23,.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 68px 16px 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.nbt-float-overlay--open {
    opacity: 1;
    pointer-events: all;
}

.nbt-float-modal {
    background: #f1f5f9;
    border-radius: 16px;
    width: 100%;
    max-width: 620px;
    padding: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,.22), 0 6px 20px rgba(0,0,0,.1);
    transform: translateY(-14px) scale(.97);
    transition: transform .2s cubic-bezier(.4,0,.2,1);
    /* v4.22.1: overflow:hidden SEBELUMNYA memotong popup dropdown bahasa
       (.nbt-lang-dd__list) yang muncul di luar tinggi card ini. */
    overflow: visible;
}
.nbt-float-overlay--open .nbt-float-modal {
    transform: translateY(0) scale(1);
}

.nbt-float-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.nbt-float-modal__title {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 11px; font-weight: 700;
    letter-spacing: .1em; text-transform: uppercase;
    color: #64748b;
}
.nbt-float-modal__close {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.07);
    color: #555;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0;
    transition: background .15s;
}
.nbt-float-modal__close:hover { background: rgba(0,0,0,.13); color: #111; }

.nbt-float-searchrow {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border-radius: 12px;
    padding: 6px 6px 6px 14px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    position: relative; /* anchor untuk dropdown autocomplete */
}
.nbt-float-searchrow__logo { flex-shrink: 0; }
.nbt-float-searchrow__logo .nbt-float-modal__logo-img { height: 28px; width: auto; display: block; }
.nbt-float-searchrow__input {
    flex: 1;
    border: none; outline: none;
    background: transparent;
    font-size: 15px; color: #0f172a;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-width: 0;
}
.nbt-float-searchrow__input::placeholder { color: #94a3b8; }
/* ── Dropdown bahasa (icon bendera kompak) — override konteks modal float ──
   Struktur & popup datang dari assets/css/lang-select.css (di-enqueue
   bersamaan); di sini hanya menyesuaikan ukuran/warna tombol trigger supaya
   menyatu dengan search row modal "Cari Pertandingan". */
.nbt-float-searchrow .nbt-lang-dd__btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #f1f5f9;
    color: #0f172a;
}
.nbt-float-searchrow .nbt-lang-dd__btn:hover,
.nbt-float-searchrow .nbt-lang-dd.is-open .nbt-lang-dd__btn { background: #e2e8f0; }

.nbt-float-searchrow__btn {
    flex-shrink: 0;
    width: 38px; height: 38px;
    border-radius: 9px;
    border: none;
    background: #0a0a0a; color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.nbt-float-searchrow__btn:hover { background: #222; }
.nbt-float-searchrow__btn:active { transform: scale(.93); }

/* ── Autocomplete dropdown ───────────────────────────────────────────────
   Sengaja self-contained (hard-coded warna, bukan var(--c-*)) — konsisten
   dengan pola seluruh floating-search.css lainnya, supaya popup ini tetap
   tampil benar di site apa pun terlepas dari tema/CSS var yang tersedia. */
.nbt-float-autocomplete {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    margin-top: 6px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,.14), 0 4px 10px rgba(0,0,0,.06);
    z-index: 5;
    max-height: 260px;
    overflow-y: auto;
}
.nbt-float-autocomplete.is-open { display: block; }

.nbt-float-autocomplete__item {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f1f5f9;
    transition: background .12s;
    min-height: 40px;
}
.nbt-float-autocomplete__item:last-child { border-bottom: none; }
.nbt-float-autocomplete__item:hover,
.nbt-float-autocomplete__item.is-active { background: #f8fafc; }

.nbt-float-autocomplete__type {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em;
    color: #94a3b8;
    flex-shrink: 0; white-space: nowrap;
}
.nbt-float-autocomplete__label {
    font-size: 14px; font-weight: 500;
    color: #0f172a;
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nbt-float-autocomplete__hits {
    font-size: 11px; font-weight: 600;
    color: #94a3b8;
    flex-shrink: 0;
}

.nbt-float-search-mode {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}
.nbt-float-search-mode__option {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    color: #64748b;
    user-select: none;
}
.nbt-float-search-mode__option input[type="radio"] {
    accent-color: #0a0a0a;
    width: 14px; height: 14px;
    cursor: pointer;
    flex-shrink: 0;
}
.nbt-float-search-mode__option:has(input:checked) { color: #0a0a0a; }

.nbt-float-modal__recents {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.nbt-float-modal__recents-label {
    font-size: 10px; font-weight: 700;
    letter-spacing: .08em; text-transform: uppercase;
    color: #94a3b8;
    display: flex; align-items: center; gap: 4px;
    flex-shrink: 0;
}
.nbt-float-modal__pills {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.nbt-float-modal__pill {
    display: inline-block;
    padding: 4px 11px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    font-size: 12px; color: #475569;
    text-decoration: none;
    transition: background .13s, border-color .13s, color .13s;
    white-space: nowrap;
}
.nbt-float-modal__pill:hover { background: #0a0a0a; color: #fff; border-color: #0a0a0a; }

/* ── Mobile ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    #nbtFloatWrap { bottom: 14px; right: 14px; }
    .nbt-qb { width: 220px; padding: 12px 12px 10px; }
    .nbt-qb__kw { font-size: 13px; }
    .nbt-qb__text { font-size: 11px; -webkit-line-clamp: 2; }
    .nbt-float-overlay { padding: 16px 12px calc(24px + env(safe-area-inset-bottom)); align-items: flex-end; }
    .nbt-float-modal { border-radius: 16px 16px 12px 12px; padding: 18px 14px 20px; max-height: 80vh; overflow-y: auto; transform: translateY(24px); }
    .nbt-float-overlay--open .nbt-float-modal { transform: translateY(0); }
    .nbt-float-searchrow__input { font-size: 16px; }
    .nbt-float-searchrow .nbt-lang-dd__btn { width: 32px; height: 32px; }
    .nbt-float-searchrow .nbt-lang-dd__flag { width: 18px; height: 13px; }
    .nbt-float-modal__recents-label { width: 100%; margin-bottom: 2px; }
    .nbt-float-modal__pills { width: 100%; flex: unset; }
}
@media (max-width: 380px) {
    .nbt-float-btn__text { display: inline; font-size: 12px; }
    .nbt-float-btn { padding: 9px 13px 9px 11px; border-radius: 50px; }
    .nbt-float-modal__pill { font-size: 10px; padding: 3px 9px; }
}
