/* Mobile responsiveness */
@media (max-width: 768px) {
    .docs-search-container {
        display: block;
        width: 100%;
        margin: 10px 0;
        padding: 0 0px;
        z-index:10002/* Remove z-index */
    }
    
    .docs-search-wrapper {
        width: 100%;
    }
    .docs-search-input {
        width: 100%;
        font-size: 16px;
        padding: 0.75rem 2.5rem 0.75rem 1rem;
    }
    .docs-search-results {
        position: fixed !important;
        top: var(--header-height, 60px);
        left: 0 !important;
        right: 0 !important;
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        border-radius: 0 0 12px 12px;
        z-index: 10002; /* Same as desktop */
        margin: 0;
        box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    }
    
    .docs-search-results-list {
        max-height: 50vh;
        overflow-y: auto;
    }
}

/* Desktop styles - show normal layout */
@media (min-width: 769px) {
    .mobile-dropdown {
        display: none;
    }
    
    .mobile-sidebar {
        display: none;
    }
    
    .header-actions {
        display: flex;
    }
    
    .user-info,
    .location-count {
        display: flex;
    }
    
    .map-controls {
        display: flex;
    }
    
    /* Show shifts button on desktop */
    .header-actions a[href="/shifts.html"] {
        display: inline-flex !important;
    }
    
    .btn span.btn-icon {
        margin-right: 5px;
    }
}

/* Hide desktop elements on mobile */
@media (max-width: 768px) {
    /* Update root variables for mobile */
    :root {
        --content-padding: var(--mobile-padding);
        --header-height: 50px; /* Smaller header on mobile */
    }
    
    .header {
        padding: 0 var(--mobile-padding);
        height: var(--header-height);
        min-height: 50px;
        flex-wrap: nowrap;
    }
    
    .header h1 {
        font-size: 18px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }
    
    .header-actions {
        display: none;
    }
    
    /* Hide any floating shifts button on mobile - but NOT the one in dropdown */
    .header-actions a[href="/shifts.html"] {
        display: none !important;
    }
    
    .mobile-dropdown {
        display: block;
        flex-shrink: 0;
    }
    
    .mobile-sidebar {
        display: flex;
        position: fixed;
        right: 10px;
        top: 50%;
        transform: translateY(-50%);
        width: auto;
        max-width: 60px;
        flex-direction: column;
        box-sizing: border-box;
    }
    
    .map-controls {
        display: none;
    }
    
    /* Hide user info and location count on desktop header for mobile */
    .user-info,
    .location-count {
        display: none;
    }
    
    /* Adjust modal for mobile */
    .modal-content {
        width: 95%;
        max-width: calc(100vw - 20px);
        margin: 10px;
        box-sizing: border-box;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Adjust edit footer for mobile */
    .edit-footer-content {
        padding: 15px;
    }
    
    .edit-footer-header h2 {
        font-size: 18px;
    }
}

/* Mobile responsiveness for QR button */
@media (max-width: 768px) {
    .search-result-item .make-qr-btn {
        position: static;
        display: block;
        width: 100%;
        margin-top: 10px;
    }
    
    .docs-search-results-list .search-result {
        padding-right: 12px;
    }
    
    .qr-modal-content {
        width: 95%;
        max-width: 350px;
        z-index: 11001; /* Maintain high z-index on mobile */
    }
    
    .qr-modal {
        z-index: 11000; /* Maintain high z-index on mobile */
    }
}

/* Mobile-friendly popup buttons */
@media (max-width: 768px) {
    .popup-content .popup-actions .btn {
        padding: 10px 12px;
        font-size: 14px;
        min-height: 44px; /* Ensure touch-friendly size */
    }
    
    .move-confirm-popup .popup-actions .btn {
        min-width: 100px;
        min-height: 44px;
    }
}
