/* ═══════════════════════════════════════════
   NABIRSMS — SHARED MOBILE RESPONSIVE CSS
   Works on every page that has:
     - <aside class="sidebar">
     - <div class="main">
     - <header class="topbar">
   ═══════════════════════════════════════════ */

/* ── HAMBURGER BUTTON (hidden on desktop) ── */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border, #e4e9f2);
    border-radius: 8px;
    background: var(--bg-panel, #fff);
    color: var(--text-2, #4b5563);
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    line-height: 1;
}

/* ── DARK BACKDROP ── */
.mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 105;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
body.sidebar-open .mobile-sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
}

/* ══════════════════════════════════════════
   TABLET  ≤ 1024px
══════════════════════════════════════════ */
@media (max-width: 1024px) {

    /* ── Sidebar: slide off-screen by default ── */
    .sidebar {
        transform: translateX(-100%) !important;
        transition: transform 0.25s ease !important;
        z-index: 110 !important;
    }
    body.sidebar-open .sidebar {
        transform: translateX(0) !important;
    }

    /* ── Main content: full width ── */
    .main {
        margin-left: 0 !important;
    }

    /* ── Show hamburger ── */
    .mobile-menu-btn {
        display: inline-flex !important;
    }

    /* ── Topbar ── */
    .topbar {
        padding: 0 12px !important;
        gap: 8px !important;
        height: 52px !important;
    }
    .breadcrumb {
        font-size: 10px !important;
        gap: 4px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        min-width: 0 !important;
        flex: 1 !important;
    }
    .topbar-right {
        gap: 6px !important;
        flex-shrink: 0 !important;
    }
    .topbar-btn {
        padding: 5px 10px !important;
        font-size: 10px !important;
    }

    /* ── Content area ── */
    .content {
        padding: 14px !important;
    }
    .page-title {
        font-size: clamp(17px, 4.5vw, 21px) !important;
    }
    .page-subtitle {
        font-size: 10px !important;
    }
    .page-header {
        flex-wrap: wrap !important;
        gap: 10px !important;
    }

    /* ── Stat cards: 2 columns ── */
    .stats-row,
    .stats-4,
    .stats-3,
    .stats-2 {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 10px !important;
    }

    /* ── All multi-col grids → 1 column ── */
    .grid-2,
    .grid-3,
    .two-col,
    .payment-grid,
    .api-inner,
    .feat-grid,
    .why-grid,
    .device-grid,
    .sim-grid,
    .form-grid-2,
    .dashboard-main-grid,
    .stats-chart-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── Plans: 2 columns on tablet ── */
    .plans-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ── Crypto selector ── */
    .crypto-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ── API usage stats ── */
    .api-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    /* ── Panels ── */
    .panel-body {
        padding: 14px !important;
    }
    .panel-header {
        padding: 10px 14px !important;
    }

    /* ── Tables: horizontal scroll ── */
    .data-table,
    .port-table,
    .stats-table,
    .endpoint-table {
        min-width: 480px;
    }

    /* ── Subscription plan bar ── */
    .current-plan-bar {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
}

/* ══════════════════════════════════════════
   MOBILE  ≤ 640px
══════════════════════════════════════════ */
@media (max-width: 640px) {

    /* ── Hide live badge ── */
    .live-badge {
        display: none !important;
    }

    /* ── Stat cards: 1 column ── */
    .stats-row,
    .stats-4,
    .stats-3,
    .stats-2 {
        grid-template-columns: 1fr !important;
    }
    .stat-value {
        font-size: 22px !important;
    }

    /* ── Plans: 1 column ── */
    .plans-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── Port grid: tighter ── */
    .port-grid {
        grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)) !important;
    }

    /* ── API key row: stack ── */
    .key-row {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .key-name {
        width: auto !important;
    }
    .key-value {
        width: 100% !important;
        flex: none !important;
    }

    /* ── Payment row: stack ── */
    .payment-row {
        flex-direction: column !important;
        gap: 4px !important;
    }
    .payment-label {
        width: auto !important;
    }

    /* ── Misc wrapping ── */
    .filter-tabs,
    .tabs,
    .bulk-actions,
    .form-actions,
    .payment-actions {
        flex-wrap: wrap !important;
    }
    .tab {
        padding: 6px 10px !important;
        font-size: 10px !important;
    }

    /* ── Send SMS button full width ── */
    .send-btn-row .btn {
        width: 100% !important;
        justify-content: center !important;
    }

    /* ── Subscription banner ── */
    .sub-banner {
        min-width: unset !important;
        max-width: calc(100vw - 24px) !important;
        left: 12px !important;
        right: 12px !important;
        transform: none !important;
        flex-wrap: wrap !important;
    }

    /* ── Breadcrumb separators ── */
    .breadcrumb-sep {
        display: none !important;
    }
}
