/* ═══════════════════════════════════════════════════════════
   NETSENSE IOT - RESPONSIVE CSS
   Mobile-first responsive styles
   ════════════════════════════════════════════════════════════ */

/* ═══ MOBILE BREAKPOINTS ═══ */
/* Mobile: < 768px */
/* Tablet: 768px - 1024px */
/* Desktop: > 1024px */

/* ═══════════════════════════════════════════════════════════
   MOBILE STYLES (< 768px)
   ════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {

    /* ── Sidebar mobile ── */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: var(--z-fixed);
        transition: left 0.3s ease;
    }

    .sidebar.mobile-open {
        left: 0;
    }

    /* Mobile menu toggle button */
    .mobile-menu-toggle {
        display: block !important;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: calc(var(--z-fixed) + 1);
        background: var(--bg-elevated);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        padding: 10px 12px;
        cursor: pointer;
        box-shadow: var(--shadow-md);
    }

    .mobile-menu-toggle svg {
        width: 24px;
        height: 24px;
        fill: var(--text-primary);
    }

    /* Mobile overlay */
    .mobile-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: calc(var(--z-fixed) - 1);
    }

    .mobile-overlay.active {
        display: block;
    }

    /* ── Main content adjustments ── */
    .main-content {
        margin-left: 0 !important;
        padding: 70px 16px 16px 16px !important;
    }

    .page-content {
        padding: 16px !important;
    }

    /* ── Header mobile ── */
    .top-bar,
    .header {
        padding: 12px 60px 12px 60px !important;
        height: auto;
    }

    .header-title {
        font-size: 18px !important;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* ── Buttons mobile ── */
    .btn,
    .btn-primary,
    .btn-secondary {
        padding: 10px 16px !important;
        font-size: 14px !important;
        white-space: nowrap;
    }

    .btn-sm {
        padding: 6px 12px !important;
        font-size: 13px !important;
    }

    /* ── Tables mobile ── */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch !important;
        gap: 12px;
    }

    .search-input {
        width: 100% !important;
    }

    /* ── Stats grid mobile ── */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }

    .stat-card {
        min-height: auto !important;
    }

    /* ── Cards mobile ── */
    .card {
        border-radius: var(--radius-md);
    }

    .card-header,
    .card-body {
        padding: 16px !important;
    }

    /* ── Modals mobile ── */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 20px auto;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px !important;
    }

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

    .form-group {
        width: 100% !important;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        font-size: 16px !important;
        /* Prevents zoom on iOS */
    }

    /* ── Dashboard KPIs mobile ── */
    .kpi-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── Charts mobile ── */
    .chart-container {
        height: 250px !important;
    }

    /* ── Asset grid mobile ── */
    .assets-grid {
        grid-template-columns: 1fr !important;
    }

    /* ── Map mobile ── */
    #map {
        height: 300px !important;
    }

    /* ── Hide desktop-only elements ── */
    .desktop-only {
        display: none !important;
    }

    /* ── Show mobile-only elements ── */
    .mobile-only {
        display: block !important;
    }

    /* ── Spacing adjustments ── */
    .container {
        padding: 0 16px;
    }

    h1 {
        font-size: 24px !important;
    }

    h2 {
        font-size: 20px !important;
    }

    h3 {
        font-size: 18px !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   TABLET STYLES (768px - 1024px)
   ════════════════════════════════════════════════════════════ */

@media (min-width: 768px) and (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .page-content {
        padding: 24px !important;
    }
}

/* ═══════════════════════════════════════════════════════════
   UTILITY CLASSES
   ════════════════════════════════════════════════════════════ */

/* Hide on mobile */
@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Hide on desktop */
@media (min-width: 768px) {
    .hide-desktop {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: none !important;
    }
}