@media screen and (max-width: 512px) {
    .sidenav {
        transform: translateX(-250px);
        transition: transform 0.3s ease;
        z-index: 1000;
        background-color: rgba(250, 250, 250, 0.98);
    }

    .sidenav.active {
        transform: translateX(0);
    }

    .main {
        margin-left: 0 !important;
        transition: none;
    }

    .main.shifted {
        margin-left: 0;
    }

    .mobile-header {
        display: flex;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 60px;
        background-color: white;
        z-index: 1000;
        align-items: center;
        padding: 0 20px;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        transition: background-color 0.3s ease;
    }

    .mobile-header.darkened {
        background-color: rgba(0, 0, 0, 0.1);
    }

    .mobile-header .menu-toggle {
        position: static;
        box-shadow: none;
        margin-right: auto;
    }

    .mobile-header .header-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        height: 30px;
        width: auto;
        transition: filter 0.3s ease;
    }

    .mobile-header.darkened .header-logo {
        filter: brightness(0.5);
    }

    .menu-toggle {
        display: block;
        background: none;
        border: none;
        cursor: pointer;
        padding: 8px;
        border-radius: 4px;
    }

    .menu-toggle:hover {
        background-color: #f0f0f0;
    }

    .menu-toggle .material-symbols-outlined {
        font-size: 24px;
    }

    /* Adjust iframe ONLY for mobile */
    .main iframe {
        width: 100%;
        height: calc(100vh - 60px);
        margin-top: 60px !important;
    }

    /* Add overlay when sidenav is active */
    .overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .overlay.active {
        display: block;
    }

    /* Improve table display on mobile */
    .scans-table, .hosters-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Adjust card container for mobile */
    .card-container {
        flex-direction: column;
        gap: 10px;
    }

    .card {
        width: 100% !important	;
    }

    .card p {
        font-size: 38px !important;
    }

    /* Improve filters container for mobile */
    .filters-container {
        flex-direction: column;
        gap: 10px;
    }

    .filter-group {
        width: 100%;
    }

    /* Adjust dialog for mobile */
    .dialog-content {
        width: 95%;
        max-height: 90vh;
        margin: 10px;
    }

    /* Improve table cells for mobile */
    .url-cell, .provider-cell, .location-cell {
        max-width: 200px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .provider-cell > span, .url-cell > .url-text, .location-cell > span {
        text-wrap: auto;
    }

    .hosters-table .provider-cell {
        padding: 12px !important;
    }

    /* Hide less important columns on mobile */
    .scans-table th:nth-child(4),
    .scans-table td:nth-child(4) {
        display: none;
    }

    /* Adjust padding for mobile */
    .scans-page,
    .hosters-page,
    .scan-container,
    .dashboard-container {
        padding: 10px;
    }

    /* Make custom select more touch-friendly */
    .selected-option,
    .select-option {
        padding: 12px;
        min-height: 44px; /* Better touch target */
    }

    /* Improve tag display on mobile */
    .tag {
        margin: 2px;
        padding: 2px 6px;
    }

    /* Adjust chart container for mobile */
    .chart-container {
        margin: 10px 0;
        padding: 10px;
    }

    table {
        margin-bottom: 50px !important;
    }
}