/* ══════════════════════════════════════════════════════════════════════
   TRADER TO TRADER (T2T) - MOBILE RESPONSIVE ADAPTATION
   Optimized for Smartphone Screens (Portrait, 360px - 768px)
   ══════════════════════════════════════════════════════════════════════ */

/* Default: Sembunyikan elemen mobile di layar Desktop */
.mobile-bottom-nav,
.mobile-more-sheet,
.mobile-sheet-backdrop,
.scalp-mobile-handle-bar {
  display: none;
}

@media (max-width: 768px) {

  /* ──────────────────────────────────────────────────────────────────
     1. BODY & APP CONTAINER
     ────────────────────────────────────────────────────────────────── */
  body {
    overflow-x: hidden !important;
    padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)) !important;
  }

  main {
    padding: 6px 8px !important;
    overflow-x: hidden !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     2. SLIM MOBILE HEADER
     ────────────────────────────────────────────────────────────────── */
  header {
    padding: 6px 10px !important;
    min-height: 48px !important;
    height: auto !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .brand-section {
    gap: 8px !important;
    flex: 1 1 auto !important;
  }

  .brand-logo-img {
    width: 26px !important;
    height: 26px !important;
  }

  .brand-sub-title {
    display: none !important;
  }

  .ihsg-bar-wrap {
    padding: 2px 7px !important;
    font-size: 10.5px !important;
    gap: 5px !important;
    background: rgba(15, 23, 42, 0.6) !important;
    border-radius: 4px !important;
  }

  .ihsg-label {
    font-size: 10px !important;
  }

  .ihsg-risk-wrap,
  .ihsg-hl {
    display: none !important;
  }

  .header-right-actions {
    gap: 6px !important;
  }

  .slowmo-slider-wrap {
    display: none !important; /* Touch screen tidak memerlukan mouse-hover slowmo */
  }

  .theme-slider-btn {
    width: 44px !important;
    height: 22px !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     3. ULTRA-SLIM 30-SECOND RADAR
     ────────────────────────────────────────────────────────────────── */
  .radar-compact-wrap {
    flex-direction: column !important;
    gap: 5px !important;
    margin-bottom: 6px !important;
    padding: 6px 8px !important;
  }

  .radar-cards-row {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 4px !important;
  }

  .active-card-slim {
    padding: 3px 4px !important;
    min-height: 38px !important;
  }

  .active-card-slim .card-ticker {
    font-size: 10.5px !important;
  }

  .active-card-slim .card-val {
    font-size: 9px !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     4. RUNNING TRADE SPLIT BAR (LOCKED TO 1 COLUMN)
     ────────────────────────────────────────────────────────────────── */
  .rt-split-bar {
    padding: 6px 8px !important;
    margin-bottom: 6px !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .rt-split-left {
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .rt-split-grid-btns {
    display: none !important; /* Layar HP selalu 1 kolom */
  }

  .rt-action-hints {
    display: none !important;
  }

  #btnAddRtCol {
    display: none !important;
  }

  .rt-split-right {
    gap: 6px !important;
  }

  .rt-split-filter-btn {
    padding: 4px 10px !important;
    font-size: 10px !important;
  }

  .rt-col-picker-btn {
    padding: 4px 8px !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     5. RUNNING TRADE TABLE (1 KOLOM & TOUCH OPTIMIZED)
     ────────────────────────────────────────────────────────────────── */
  .rt-split-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
  }

  .rt-pane-resizer {
    display: none !important;
  }

  .rt-col-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
    border-radius: 8px !important;
  }

  .rt-col-header {
    padding: 6px 10px !important;
  }

  .rt-col-header-left {
    gap: 6px !important;
  }

  .rt-col-name-input {
    font-size: 11px !important;
    max-width: 110px !important;
  }

  .rt-col-count-badge {
    font-size: 9px !important;
    padding: 1px 5px !important;
  }

  .rt-col-slowmo-badge {
    display: none !important;
  }

  .rt-col-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    max-height: calc(100vh - 235px) !important;
  }

  .rt-col-table-wrapper table {
    min-width: 100% !important;
  }

  .rt-col-table-wrapper th,
  .rt-col-table-wrapper td {
    padding: 6px 5px !important;
    font-size: 11px !important;
  }

  /* Sembunyikan kolom sekunder di HP agar pas tanpa horizontal scroll berlebih */
  .rt-col-table-wrapper th.col-buyer,
  .rt-col-table-wrapper td.col-buyer,
  .rt-col-table-wrapper th.col-seller,
  .rt-col-table-wrapper td.col-seller,
  .rt-col-table-wrapper th.col-flow,
  .rt-col-table-wrapper td.col-flow {
    display: none !important;
  }

  .ticker-symbol {
    font-size: 12px !important;
    font-weight: 800 !important;
    letter-spacing: 0.5px !important;
  }

  .price-main-text {
    font-size: 12px !important;
    font-weight: 700 !important;
  }

  .ohl-vertical-stack {
    display: none !important;
  }

  .action-pill {
    padding: 2px 5px !important;
    font-size: 9px !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     6. FOOTER & DOCK RAIL REPLACED BY BOTTOM NAV
     ────────────────────────────────────────────────────────────────── */
  .sidebar-dock-rail {
    display: none !important;
  }

  .app-footer {
    display: none !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     7. MOBILE BOTTOM NAVIGATION BAR (FIXED DOCK)
     ────────────────────────────────────────────────────────────────── */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 56px !important;
    background: rgba(9, 13, 24, 0.96) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-top: 1px solid rgba(56, 189, 248, 0.22) !important;
    z-index: 9990 !important;
    align-items: center !important;
    justify-content: space-around !important;
    padding: 0 4px calc(env(safe-area-inset-bottom, 0px)) 4px !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.6) !important;
  }

  .mobile-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 1 0 !important;
    height: 100% !important;
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    font-family: var(--font-mono) !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    gap: 3px !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
    padding: 4px 0 !important;
    position: relative !important;
  }

  .mobile-nav-item:active,
  .mobile-nav-item.active {
    color: #38bdf8 !important;
  }

  .mobile-nav-item.active::after {
    content: "" !important;
    position: absolute !important;
    top: 0 !important;
    left: 25% !important;
    right: 25% !important;
    height: 2px !important;
    background: #38bdf8 !important;
    border-radius: 0 0 2px 2px !important;
    box-shadow: 0 0 8px #38bdf8 !important;
  }

  .mobile-nav-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 22px !important;
    height: 22px !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     8. MOBILE MORE MENU (BOTTOM SHEET)
     ────────────────────────────────────────────────────────────────── */
  .mobile-sheet-backdrop {
    display: none;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.72) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 10010 !important;
    animation: fadeInBackdrop 0.18s ease !important;
  }

  .mobile-sheet-backdrop.active {
    display: block !important;
  }

  .mobile-more-sheet {
    display: none;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: #0d121f !important;
    border-top: 1px solid #334155 !important;
    border-radius: 18px 18px 0 0 !important;
    padding: 12px 14px calc(20px + env(safe-area-inset-bottom, 0px)) 14px !important;
    z-index: 10020 !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.8) !important;
    animation: slideUpSheet 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .mobile-more-sheet.active {
    display: block !important;
  }

  @keyframes slideUpSheet {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  @keyframes fadeInBackdrop {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  .mobile-sheet-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding-bottom: 12px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    margin-bottom: 14px !important;
  }

  .mobile-sheet-title {
    font-size: 13px !important;
    font-weight: 800 !important;
    color: #f8fafc !important;
    letter-spacing: 0.5px !important;
  }

  .mobile-sheet-close {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #94a3b8 !important;
    font-size: 14px !important;
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
  }

  .mobile-menu-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
  }

  .mobile-menu-btn {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    border-radius: 10px !important;
    padding: 12px 6px !important;
    color: #f1f5f9 !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    font-family: var(--font-mono) !important;
    gap: 6px !important;
    text-align: center !important;
    cursor: pointer !important;
    transition: all 0.12s ease !important;
  }

  .mobile-menu-btn:active {
    background: rgba(56, 189, 248, 0.15) !important;
    border-color: rgba(56, 189, 248, 0.4) !important;
    transform: scale(0.97) !important;
  }

  .mobile-menu-btn svg {
    color: #38bdf8 !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     9. QUICK SCALP MODAL SEBAGAI NATIVE BOTTOM SHEET
     ────────────────────────────────────────────────────────────────── */
  .quick-scalp-card {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 18px 18px 0 0 !important;
    max-height: 88vh !important;
    overflow-y: auto !important;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.9) !important;
    animation: slideUpSheet 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    z-index: 10015 !important;
    margin: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
  }

  .scalp-mobile-handle-bar {
    display: block !important;
    width: 40px !important;
    height: 4px !important;
    background: #475569 !important;
    border-radius: 2px !important;
    margin: 6px auto 8px auto !important;
  }

  .scalp-card-header {
    border-radius: 18px 18px 0 0 !important;
    padding: 10px 14px !important;
  }

  .scalp-stat-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px !important;
  }

  .scalp-broksum-split {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     10. ORDERBOOK MODAL RESPONSIVE STACK
     ────────────────────────────────────────────────────────────────── */
  .orderbook-modal-wrapper {
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    overflow-y: auto !important;
    padding: 6px !important;
    gap: 8px !important;
  }

  .orderbook-modal-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 12px !important;
  }

  /* ──────────────────────────────────────────────────────────────────
     11. ALL DRAWERS FULL WIDTH DI LAYAR HP
     ────────────────────────────────────────────────────────────────── */
  .movers-drawer,
  .watchlist-drawer,
  .broksum-drawer,
  .chart-drawer,
  .news-drawer,
  .disclosure-drawer,
  .signals-drawer,
  .recommendation-drawer,
  .layout-drawer,
  .settings-drawer,
  .insider-drawer,
  .broker-activity-drawer {
    width: 100vw !important;
    max-width: 100vw !important;
    left: 0 !important;
    right: 0 !important;
    border-radius: 0 !important;
  }
}
