/* =====================================================================
 * Binary mobile innovations — additive layer.
 * Hooks into the existing trade page (#chart-container, #higherBtn,
 * #lowerBtn, #vxPositions). Nothing here overrides the base UI; every
 * element is injected/positioned on top and is mobile-first.
 * ===================================================================== */

/* ---- floating live P&L pill ---- */
.bmi-pnl {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    bottom: 132px;
    z-index: 1190;
    display: none;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .2px;
    color: #fff;
    background: rgba(18, 23, 33, .92);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 8px 26px rgba(0, 0, 0, .45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: none;
    white-space: nowrap;
}
.bmi-pnl.on {
    display: inline-flex;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.bmi-pnl__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #02d428;
    box-shadow: 0 0 0 0 rgba(2, 212, 40, .5);
    animation: bmiPulse 1.4s infinite;
}
.bmi-pnl__val.up { color: #28e07a; }
.bmi-pnl__val.down { color: #ff5b5d; }
.bmi-pnl__lbl { color: #8a93a6; font-weight: 600; }
@keyframes bmiPulse {
    0% { box-shadow: 0 0 0 0 rgba(2, 212, 40, .5); }
    70% { box-shadow: 0 0 0 8px rgba(2, 212, 40, 0); }
    100% { box-shadow: 0 0 0 0 rgba(2, 212, 40, 0); }
}

/* ---- win-streak flame badge ---- */
.bmi-streak {
    position: fixed;
    top: 64px;
    right: 10px;
    z-index: 1185;
    display: none;
    align-items: center;
    gap: 5px;
    padding: 5px 11px 5px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    color: #ffd479;
    background: linear-gradient(135deg, rgba(255, 122, 0, .22), rgba(255, 60, 0, .22));
    border: 1px solid rgba(255, 150, 40, .45);
    box-shadow: 0 6px 18px rgba(255, 90, 0, .25);
    animation: bmiStreakPop .4s ease;
}
.bmi-streak.on { display: inline-flex; }
.bmi-streak__flame { font-size: 14px; filter: drop-shadow(0 0 4px rgba(255, 140, 0, .8)); }
@keyframes bmiStreakPop {
    0% { transform: scale(.4); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

/* ---- live trader sentiment bar ---- */
.bmi-sentiment {
    margin: 10px 0 2px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .03);
    border: 1px solid rgba(255, 255, 255, .07);
}
.bmi-sentiment__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #8a93a6;
    margin-bottom: 7px;
}
.bmi-sentiment__head b { color: #c7cedb; font-weight: 700; }
.bmi-sentiment__bar {
    display: flex;
    height: 9px;
    border-radius: 6px;
    overflow: hidden;
    background: #1b2230;
}
.bmi-sentiment__up {
    background: linear-gradient(90deg, #0aa83a, #28e07a);
    transition: width .6s cubic-bezier(.4, 0, .2, 1);
}
.bmi-sentiment__down {
    background: linear-gradient(90deg, #ff5b5d, #b3262a);
    transition: width .6s cubic-bezier(.4, 0, .2, 1);
}
.bmi-sentiment__legend {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 700;
}
.bmi-sentiment__legend .up { color: #28e07a; }
.bmi-sentiment__legend .down { color: #ff5b5d; }

/* ---- swipe-to-trade arming control + hint ---- */
.bmi-swipe-toggle {
    position: fixed;
    right: 10px;
    bottom: 196px;
    z-index: 1186;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    color: #8a93a6;
    background: rgba(18, 23, 33, .92);
    border: 1px solid rgba(255, 255, 255, .12);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.bmi-swipe-toggle.on {
    color: #fff;
    border-color: rgba(2, 212, 40, .55);
    box-shadow: 0 0 14px rgba(2, 212, 40, .25);
}
.bmi-swipe-toggle i { font-size: 13px; }
.bmi-swipe-hint {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    background: rgba(10, 14, 20, .82);
    pointer-events: none;
    opacity: 0;
    transition: opacity .12s ease;
}
.bmi-swipe-hint.show { opacity: 1; }
.bmi-swipe-hint.up { color: #28e07a; }
.bmi-swipe-hint.down { color: #ff5b5d; }

/* ---- landscape fullscreen chart toggle ---- */
.bmi-fs-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 7;
    display: none;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    color: #c7cedb;
    background: rgba(18, 23, 33, .8);
    border: 1px solid rgba(255, 255, 255, .12);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.bmi-fs-toggle i { font-size: 15px; }
#chart-container.bmi-fs {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 4000 !important;
    background: #0b0f16 !important;
    margin: 0 !important;
    border-radius: 0 !important;
}
.bmi-fs-exit {
    position: fixed;
    z-index: 4001;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    color: #fff;
    background: rgba(0, 0, 0, .55);
    border: 1px solid rgba(255, 255, 255, .2);
    font-size: 18px;
    cursor: pointer;
}
#chart-container.bmi-fs .bmi-fs-exit { display: flex; }

/* ---- confetti ---- */
.bmi-confetti {
    position: fixed;
    inset: 0;
    z-index: 3500;
    pointer-events: none;
    overflow: hidden;
}
.bmi-confetti i {
    position: absolute;
    top: -14px;
    width: 9px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
    will-change: transform, opacity;
    animation: bmiFall linear forwards;
}
@keyframes bmiFall {
    0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(108vh) rotate(720deg); opacity: .9; }
}

/* ---- price alerts ---- */
.bmi-alert-btn {
    position: fixed;
    right: 10px;
    bottom: 240px;
    z-index: 1187;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #c7cedb;
    background: rgba(18, 23, 33, .92);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.bmi-alert-btn i { font-size: 16px; }
.bmi-alert-btn.has-alerts { color: #ffd479; border-color: rgba(255, 180, 60, .5); }
.bmi-alert-btn__count {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #ff5b5d;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 17px;
    text-align: center;
    display: none;
}
.bmi-alert-btn.has-alerts .bmi-alert-btn__count { display: block; }
.bmi-alert-panel {
    position: fixed;
    right: 10px;
    bottom: 290px;
    z-index: 1188;
    width: 270px;
    max-width: calc(100vw - 20px);
    padding: 14px;
    border-radius: 14px;
    background: rgba(18, 23, 33, .98);
    border: 1px solid rgba(255, 255, 255, .12);
    box-shadow: 0 14px 40px rgba(0, 0, 0, .55);
    display: none;
}
.bmi-alert-panel.on { display: block; }
.bmi-alert-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 4px;
}
.bmi-alert-panel__close { background: none; border: 0; color: #8a93a6; font-size: 16px; cursor: pointer; }
.bmi-alert-panel__cur { font-size: 11px; color: #8a93a6; margin-bottom: 10px; }
.bmi-alert-panel__cur b { color: #c7cedb; }
.bmi-alert-panel__row { display: flex; gap: 7px; }
.bmi-alert-panel__row input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 10px;
    border-radius: 9px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: #0e131c;
    color: #fff;
    font-size: 13px;
}
.bmi-alert-panel__add {
    flex: 0 0 auto;
    padding: 0 14px;
    border-radius: 9px;
    border: 0;
    background: #1677ff;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
}
.bmi-alert-list { list-style: none; margin: 11px 0 0; padding: 0; max-height: 150px; overflow-y: auto; }
.bmi-alert-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 0;
    border-top: 1px solid rgba(255, 255, 255, .07);
    font-size: 12px;
    color: #c7cedb;
}
.bmi-alert-list .dir { font-weight: 800; }
.bmi-alert-list .dir.up { color: #28e07a; }
.bmi-alert-list .dir.down { color: #ff5b5d; }
.bmi-alert-list .rm { background: none; border: 0; color: #8a93a6; cursor: pointer; font-size: 14px; }
.bmi-alert-empty { font-size: 12px; color: #6a7282; padding: 10px 0 2px; text-align: center; }
.bmi-alert-note { margin-top: 10px; font-size: 10px; line-height: 1.4; color: #6a7282; text-align: center; }

/* show the mobile-only controls on phones / small tablets only */
@media (max-width: 991px) {
    .bmi-swipe-toggle { display: inline-flex; }
    .bmi-fs-toggle { display: flex; }

    /* compact sentiment bar so it fits the mobile trade panel */
    .bmi-sentiment { margin: 6px 0 0; padding: 6px 9px; border-radius: 9px; }
    .bmi-sentiment__head { font-size: 10px; margin-bottom: 4px; }
    .bmi-sentiment__head b { font-size: 10px; }
    .bmi-sentiment__bar { height: 6px; border-radius: 4px; }
    .bmi-sentiment__legend { font-size: 9px; margin-top: 4px; }
}
