/* ========================================
   CirculTrak — Responsive & Mobile Styles
   Loaded by all app pages
   ======================================== */

/* Hamburger button (injected by responsive.js) */
.hamburger {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.hamburger:hover { transform: scale(1.05); }
.hamburger svg { width: 20px; height: 20px; stroke: #94a3b8; stroke-width: 2; fill: none; }
.hamburger.active svg { stroke: #34d399; }

/* Mobile overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 98;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ========== TABLET (< 1100px) ========== */
@media (max-width: 1100px) {
    .bento, .bento-bottom { grid-template-columns: 1fr !important; }
    .kpi-grid, .kpi-row { grid-template-columns: 1fr 1fr !important; }
    .content-grid { grid-template-columns: 1fr !important; }
    .stats-row { grid-template-columns: 1fr 1fr !important; }
    .team-grid { grid-template-columns: 1fr !important; }
}

/* ========== MOBILE (< 768px) ========== */
@media (max-width: 768px) {
    /* Show hamburger */
    .hamburger { display: flex; }

    /* Sidebar becomes overlay drawer */
    aside {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        bottom: 0 !important;
        width: 260px !important;
        z-index: 99 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        overflow-y: auto !important;
    }
    aside.open {
        transform: translateX(0) !important;
    }

    /* Main content full width */
    main {
        padding: 16px !important;
        padding-top: 64px !important;
        width: 100% !important;
    }
    body {
        flex-direction: column !important;
    }

    /* KPI grids */
    .kpi-grid, .kpi-row { grid-template-columns: 1fr !important; gap: 12px !important; }
    .stats-row { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
    .content-grid { grid-template-columns: 1fr !important; }
    .team-grid { grid-template-columns: 1fr !important; }
    .bento, .bento-bottom { grid-template-columns: 1fr !important; }

    /* Charts */
    .bar-chart { height: 150px !important; }
    .donut-container { flex-direction: column !important; }

    /* Tables */
    table { font-size: 12px !important; }
    th, td { padding: 8px 10px !important; }

    /* Headers */
    header { flex-direction: column !important; align-items: flex-start !important; gap: 12px !important; }
    h1 { font-size: 18px !important; }

    /* Mission banner */
    .mission-banner { padding: 24px !important; }
    .mission-banner h2 { font-size: 18px !important; }

    /* Timeline */
    .timeline-items { flex-direction: column !important; gap: 16px !important; }
    .timeline-items::before { display: none !important; }
    .timeline-item { text-align: left !important; display: flex !important; gap: 12px !important; align-items: flex-start !important; }
    .timeline-dot { margin: 0 !important; flex-shrink: 0 !important; }

    /* Partners */
    .partners-row { gap: 8px !important; }
    .partner-badge { font-size: 11px !important; padding: 6px 12px !important; }

    /* Forms */
    .form-row { flex-direction: column !important; }

    /* Buttons */
    .btn { font-size: 12px !important; padding: 8px 16px !important; }

    /* Simulator */
    #simForm div[style*="display: flex"] { flex-direction: column !important; }

    /* Stacked bar */
    .stacked-bar-wrap { padding: 16px !important; }

    /* Optim cards */
    .optim-card { flex-direction: column !important; }
    .optim-card > div:last-child { text-align: left !important; }
}

/* ========== SMALL MOBILE (< 480px) ========== */
@media (max-width: 480px) {
    .stats-row { grid-template-columns: 1fr !important; }
    .kpi-number { font-size: 22px !important; }
    main { padding: 12px !important; padding-top: 60px !important; }
    .card { padding: 16px !important; }
}
