/**
 * Summit Platform — smartphone / tablet responsive shell
 * Works with sidebar + main-content layout used across authenticated app pages.
 */

html.platform-mobile-active {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body.platform-mobile-active {
    flex-direction: column !important;
    height: auto !important;
    min-height: 100vh !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
}

/* Top bar injected by platform-mobile.js */
.platform-mobile-bar {
    display: none;
}

@media (max-width: 900px), (hover: none) and (max-width: 1024px) and (pointer: coarse) {
    .platform-mobile-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 52px;
        padding: 0 0.75rem;
        background: #111827;
        color: #fff;
        z-index: 1100;
        border-bottom: 1px solid #374151;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }

    .platform-mobile-bar-title {
        font-size: 0.95rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        margin: 0 0.5rem;
    }

    .platform-mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        min-height: 44px;
        padding: 0;
        border: none;
        border-radius: 8px;
        background: #374151;
        color: #fff;
        font-size: 1.35rem;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }

    .platform-mobile-menu-btn:active {
        background: #4b5563;
    }

    body.platform-mobile-active {
        padding-top: 52px;
    }

    body.platform-mobile-active .sidebar {
        position: fixed !important;
        top: 52px !important;
        left: 0 !important;
        bottom: 0 !important;
        width: min(280px, 88vw) !important;
        max-width: 88vw !important;
        height: calc(100% - 52px) !important;
        height: calc(100dvh - 52px) !important;
        z-index: 1050 !important;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
    }

    body.platform-mobile-active .sidebar.platform-nav-open {
        transform: translateX(0);
    }

    .platform-mobile-backdrop {
        display: none;
        position: fixed;
        inset: 52px 0 0 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1040;
    }

    .platform-mobile-backdrop.visible {
        display: block;
    }

    body.platform-mobile-active .main-content,
    body.platform-mobile-active .main-content-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 1 auto !important;
        overflow-x: hidden !important;
        overflow-y: visible !important;
        padding: 1rem !important;
        height: auto !important;
    }

    body.platform-mobile-active .content-section {
        max-width: 100% !important;
        padding: 1rem !important;
    }

    body.platform-mobile-active .page-header h1 {
        font-size: 1.45rem !important;
        line-height: 1.25;
    }

    body.platform-mobile-active .qboost-interactive-grid,
    body.platform-mobile-active .compare-kpi-grid,
    body.platform-mobile-active .qboost-status-grid {
        grid-template-columns: 1fr !important;
    }

    body.platform-mobile-active .qboost-actions {
        flex-direction: column;
        align-items: stretch;
    }

    body.platform-mobile-active .qboost-btn {
        width: 100%;
        min-height: 44px;
    }

    body.platform-mobile-active table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    body.platform-mobile-active input,
    body.platform-mobile-active select,
    body.platform-mobile-active textarea {
        font-size: 16px !important;
        max-width: 100%;
    }

    body.platform-mobile-active button,
    body.platform-mobile-active a.nav-item {
        min-height: 44px;
    }

    body.platform-mobile-active #qboost-compare-chart,
    body.platform-mobile-active .plotly-graph-div {
        min-height: 280px !important;
    }

    body.platform-mobile-active iframe {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    body.platform-mobile-active .main-content,
    body.platform-mobile-active .main-content-wrapper,
    body.platform-mobile-active .content-section {
        padding: 0.75rem !important;
    }

    body.platform-mobile-active h1 {
        font-size: 1.35rem !important;
    }
}

.sidebar-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9ca3af;
    margin: 4px 0 6px 4px;
}

.batch-upload-nav-section {
    margin: 4px 0 8px;
}

.sidebar .nav-item.disabled,
.sidebar .batch-nav-item.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar .nav-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 2px 6px;
    border-radius: 999px;
    margin-left: 6px;
    background: #4b5563;
    color: #d1d5db;
}
