/* PlusNet Data - Mobile Responsive Styles */

@media (max-width: 768px) {
    body {
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
        -webkit-overflow-scrolling: touch;
    }

    .app-layout.active {
        display: block;
        margin: 0;
        padding: 0;
        overflow-x: hidden;
        height: auto;
        min-height: 100vh;
    }

    .app-layout:not(.active) {
        display: none !important;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: 250px;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 1001;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
        min-height: 100vh;
        height: auto;
    }

    .hamburger {
        display: inline-flex !important;
        position: static !important;
        transform: none !important;
        flex-shrink: 0;
    }

    body.sidebar-open::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        pointer-events: auto;
    }

    .sidebar-logo {
        padding: 10px 15px 15px;
    }

    .sidebar-logo img {
        max-height: 60px;
    }

    .sidebar-logo h2 {
        font-size: 16px;
        margin-top: 8px;
    }

    .content-header {
        position: sticky !important;
        top: 0 !important;
        padding: 10px 15px;
        margin-bottom: 0;
        margin-left: 0;
        margin-right: 0;
        margin-top: 0;
        border-radius: 0;
        display: flex !important;
        align-items: center;
        gap: 15px;
        justify-content: flex-start;
        z-index: 100000 !important;
        background: linear-gradient(135deg, #2d5a3d 0%, #4a8f5e 100%) !important;
    }

    .content-header h1 {
        font-size: 18px !important;
        margin: 0 !important;
        color: white !important;
        flex: 1;
    }

    .content-header .header-actions {
        margin-bottom: 0 !important;
    }

    .content-header .mobile-header-logo {
        display: block !important;
        height: 35px !important;
        width: auto !important;
        flex-shrink: 0;
    }

    .content-header .logo-text {
        display: none !important;
    }

    .account-info {
        display: none !important;
    }

    .content-body {
        padding: 15px;
        margin: 0;
        border-radius: 0;
    }

    .upload-section {
        padding: 15px;
        margin: 0;
        border-radius: 0;
    }

    .form-group {
        margin-bottom: 15px;
    }

    .search-bar {
        margin-bottom: 15px;
    }

    .search-bar input {
        max-width: 100%;
        font-size: 16px;
    }

    table {
        font-size: 12px;
    }

    th, td {
        padding: 6px 8px;
        white-space: nowrap;
    }

    .table-wrapper {
        overflow-x: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0;
        padding: 0;
        max-height: calc(100vh - 180px);
    }

    .pagination {
        font-size: 14px;
    }

    .pagination button {
        padding: 6px 12px;
        font-size: 14px;
    }

    /* Modal adjustments */
    .modal.member-detail-modal-large {
        width: 95% !important;
        max-width: 95% !important;
        padding: 20px 12px 15px 12px !important;
        margin: 5px !important;
    }

    .member-detail-tabs {
        flex-wrap: wrap;
        gap: 3px;
    }

    .member-detail-tab {
        font-size: 12px;
        padding: 8px 10px;
        flex: 1 1 calc(50% - 3px);
        min-width: 120px;
    }

    .member-detail-tab:first-child {
        flex: 1 1 100%;
    }

    .member-detail-tabs-container {
        padding: 10px;
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1 1 auto;
        min-height: 0;
    }

    .member-detail-field {
        flex-direction: column;
        align-items: flex-start;
    }

    .member-detail-label {
        width: 100%;
        margin-bottom: 5px;
        font-weight: bold;
    }

    .member-detail-value {
        width: 100%;
        padding-left: 0;
    }

    /* Reports section */
    .header-actions {
        margin-bottom: 0;
    }

    #reportsSection {
        padding: 0 !important;
        display: block !important;
    }

    #reportsSection > div {
        display: block !important;
        width: 100% !important;
        height: auto !important;
    }

    #reportsSection > div > div {
        display: block !important;
        width: 100% !important;
        height: auto !important;
    }

    #reportsSidebarMenu {
        display: block !important;
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        background: #f8f9fa !important;
        border-right: none !important;
        border-bottom: 2px solid #e0e0e0 !important;
        padding: 15px !important;
        overflow-y: visible !important;
        z-index: 1 !important;
    }

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

    #reportsContentArea {
        display: block !important;
        width: 100% !important;
        padding: 70px 15px 30px 15px !important;
        background: white !important;
        min-height: calc(100vh - 100px) !important;
        box-sizing: border-box !important;
    }

    .report-content {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    #report_municipalitySearch {
        display: block !important;
        width: 100% !important;
    }

    .upload-section {
        position: relative !important;
        z-index: 1 !important;
        background: white !important;
    }

    #reportsSection[style*="display: none"],
    #uploadSection[style*="display: none"],
    #userManagementSection[style*="display: none"],
    #manageUsersSection[style*="display: none"],
    #membersSection[style*="display: none"] {
        display: none !important;
        visibility: hidden !important;
        position: absolute !important;
        left: -9999px !important;
        pointer-events: none !important;
    }

    #reportsSection:not([style*="display: none"]) {
        display: block !important;
        visibility: visible !important;
        position: relative !important;
        left: 0 !important;
        z-index: 500 !important;
        background: white !important;
        width: 100% !important;
        min-height: 100vh !important;
        pointer-events: auto !important;
    }

    #membersSection:not([style*="display: none"]) {
        display: block !important;
        visibility: visible !important;
        position: relative !important;
        left: 0 !important;
        z-index: 600 !important;
        background: #f5f5f5 !important;
        min-height: 100vh !important;
        pointer-events: auto !important;
    }

    .sidebar {
        display: block !important;
        z-index: 10000 !important;
    }

    .mobile-reports-overlay {
        display: none !important;
    }

    .report-menu-item {
        padding: 10px 12px !important;
        font-size: 13px !important;
    }

    .report-menu-item span:first-child {
        font-size: 18px !important;
    }

    /* Mobile search layouts */
    #report_municipalitySearch > div:nth-child(3),
    #report_provinceSearch > div:nth-child(4) {
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    #report_municipalitySearch > div:nth-child(3) > input,
    #report_provinceSearch > div:nth-child(4) > input {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #report_municipalitySearch > div:nth-child(3) > button,
    #report_provinceSearch > div:nth-child(4) > button {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Results summary mobile layout */
    #municipalitySearchResults > div:first-child > div,
    #provinceSearchResults > div:first-child > div,
    #unreachableResults > div:first-child > div {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: flex-start !important;
    }

    #municipalitySearchResults > div:first-child > div > button,
    #provinceSearchResults > div:first-child > div > button,
    #unreachableResults > div:first-child > div > button {
        width: 100% !important;
    }

    /* Filter controls mobile */
    #municipalityDataTable > div:first-child,
    #provinceDataTable > div:first-child,
    #unreachableDataTable > div:first-child {
        flex-direction: column !important;
        gap: 10px !important;
    }

    #municipalityDataTable > div:first-child > input,
    #provinceDataTable > div:first-child > input,
    #unreachableDataTable > div:first-child > input {
        width: 100% !important;
        max-width: 100% !important;
    }

    #municipalityDataTable > div:first-child > div,
    #provinceDataTable > div:first-child > div,
    #unreachableDataTable > div:first-child > div {
        width: 100% !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    #municipalityDataTable > div:first-child > div > button,
    #provinceDataTable > div:first-child > div > button,
    #unreachableDataTable > div:first-child > div > button {
        flex-shrink: 0;
    }

    /* Mobile table containers */
    #municipalityDataTable > div:nth-child(2),
    #provinceDataTable > div:nth-child(2),
    #unreachableDataTable > div:nth-child(2) {
        max-height: 500px !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }

    #municipalityDataTable table,
    #provinceDataTable table,
    #unreachableDataTable table {
        min-width: 800px;
        font-size: 12px !important;
    }

    #municipalityDataTable th,
    #provinceDataTable th,
    #unreachableDataTable th,
    #municipalityDataTable td,
    #provinceDataTable td,
    #unreachableDataTable td {
        padding: 8px 6px !important;
    }

    /* Pagination mobile */
    #municipalityDataTable > div:nth-child(3),
    #provinceDataTable > div:nth-child(3),
    #unreachableDataTable > div:nth-child(3) {
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
}
