/*
 * Mobile bottom navigation bar (flag-gated: new_bet_slip).
 * MLB pilot (Phase 2). Renders ONLY on phones (<768px); desktop keeps the
 * existing top navbar untouched. 5 tabs:
 *   Howlboard · Sports · Slip (center) · HoundMind · Live
 * Matches the approved MLBPage.tsx mockup.
 */

#ph-botnav { display: none; }

@media (max-width: 767px) {
  #ph-botnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9035;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2px;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(13, 17, 48, 0.96);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
    font-family: inherit;
  }

  .ph-botnav-item {
    flex: 1 1 0;
    min-width: 0;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #8b91b0;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    -webkit-tap-highlight-color: transparent;
  }
  .ph-botnav-ico {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .ph-botnav-ico svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .ph-botnav-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.2px;
    line-height: 1;
    white-space: nowrap;
  }
  .ph-botnav-item:active { transform: scale(0.94); }

  /* active tab */
  .ph-botnav-item.is-active { color: #00ff88; }
  .ph-botnav-item.is-active .ph-botnav-ico svg {
    filter: drop-shadow(0 0 6px rgba(0, 255, 136, 0.5));
  }
  .ph-botnav-item.is-active::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 3px;
    border-radius: 3px;
    background: #00ff88;
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.8);
  }

  /* center Slip button — elevated circular */
  .ph-botnav-slip .ph-botnav-ico {
    width: 46px;
    height: 46px;
    margin-top: -20px;
    border-radius: 50%;
    background: #00ff88;
    box-shadow: 0 4px 14px rgba(0, 255, 136, 0.45);
    border: 3px solid #0d1130;
  }
  .ph-botnav-slip .ph-botnav-ico svg {
    width: 22px;
    height: 22px;
    stroke: #05210f;
  }
  .ph-botnav-slip .ph-botnav-label { color: #00ff88; }
  .ph-botnav-slip:active { transform: none; }
  .ph-botnav-slip:active .ph-botnav-ico { transform: scale(0.94); }

  .ph-botnav-badge {
    position: absolute;
    top: -26px;
    left: 50%;
    transform: translateX(18px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ff4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center;
    justify-content: center;
    border: 2px solid #0d1130;
  }
  .ph-botnav-badge.is-on { display: inline-flex; }

  /* keep the last page content clear of the fixed bar */
  body.ph-has-botnav {
    padding-bottom: calc(var(--ph-botnav-h, 64px) + 8px);
  }

  /* HoundMind moves into the nav as a tab on the pilot mobile page, so hide
     its floating launcher button only. Do NOT hide #houndmind-widget — the
     chat panel (#houndmind-panel) lives INSIDE that widget, and the tab opens
     the panel; hiding the widget would hide the panel too. */
  body.ph-has-botnav #houndmind-fab,
  body.ph-has-botnav .houndmind-fab {
    display: none !important;
  }

  /* transient toast (e.g. Live tab) */
  .ph-botnav-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--ph-botnav-h, 64px) + 16px);
    transform: translateX(-50%) translateY(10px);
    z-index: 9060;
    background: #1a1e3a;
    color: #fff;
    border: 1px solid rgba(0, 255, 136, 0.3);
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
    white-space: nowrap;
  }
  .ph-botnav-toast.is-on {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ---- Sports picker sheet (opened by the bottom-nav Sports tab) ---------- */
@media (max-width: 767px) {
  #ph-botnav-sports {
    position: fixed;
    inset: 0;
    z-index: 9055;
    display: none;
  }
  #ph-botnav-sports.is-open { display: block; }
  .ph-sportsheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
  }
  .ph-sportsheet-card {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    background: #0d1130;
    border-top: 1px solid rgba(0, 255, 136, 0.25);
    border-radius: 18px 18px 0 0;
    padding: 14px 16px calc(var(--ph-botnav-h, 64px) + 20px);
    box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.55);
    transform: translateY(100%);
    transition: transform 0.28s ease;
  }
  #ph-botnav-sports.is-open .ph-sportsheet-card { transform: translateY(0); }
  .ph-sportsheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 4px 2px 12px;
  }
  .ph-sportsheet-close {
    background: none;
    border: none;
    color: #8b91b0;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
  }
  .ph-sportsheet-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .ph-sportsheet-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 14px;
    border-radius: 12px;
    background: #141a44;
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
  }
  .ph-sportsheet-item.is-here {
    border-color: rgba(0, 255, 136, 0.5);
    background: rgba(0, 255, 136, 0.1);
  }
  .ph-sportsheet-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    opacity: 0.7;
  }
  .ph-sportsheet-icon svg {
    width: 22px;
    height: 22px;
  }
  .ph-sportsheet-item:hover .ph-sportsheet-icon,
  .ph-sportsheet-item.is-here .ph-sportsheet-icon { opacity: 1; }
}
