#map {
    position: relative;
    height: calc(100vh - 80px);
    width: 100%;
    margin-top: 80px;
}

/* Improve map interaction responsiveness */
.mapboxgl-canvas {
    cursor: grab !important;
    transition: cursor 0.1s ease;
}

.mapboxgl-canvas:active {
    cursor: grabbing !important;
}

/* Better cursor feedback for interactive elements */
.mapboxgl-canvas.hunting-unit-hover {
    cursor: pointer !important;
}

/* Improve interaction feedback */
.map-interaction-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.map-interaction-hint.visible {
    opacity: 1;
}

/* Enhanced hover states for hunting units */
.hunting-unit-hover-effect {
    transition: all 0.2s ease !important;
    filter: brightness(1.2) !important;
}

/* Map Loading Indicator */
.map-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

/* Make unit boundaries more visible on hover/touch */
.mapboxgl-popup .mapboxgl-popup-content {
    animation: popupFadeIn 0.2s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Processing Notifications */
.processing-notification,
.completion-notification {
    position: fixed;
    top: 90px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.1);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification-content {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    gap: 0.75rem;
    position: relative;
}

.notification-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #007bff;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notification-icon.success {
    background: #28a745;
}

.processing-spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.notification-text {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.notification-message {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007bff, #0056b3);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.notification-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.notification-actions .btn {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

.notification-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    color: #999;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.notification-close:hover {
    background: #f8f9fa;
    color: #666;
}

/* Mobile responsiveness for notifications */
@media (max-width: 768px) {
    .processing-notification,
    .completion-notification {
        left: 10px;
        right: 10px;
        top: 80px;
        max-width: none;
    }
    
    .notification-actions {
        flex-direction: column;
    }
    
    .notification-actions .btn {
        width: 100%;
    }
}

.mapboxgl-marker {
    cursor: pointer;
}

.mapboxgl-popup {
    z-index: 1000;
    max-width: none !important;
}

.mapboxgl-popup-tip {
    display: none !important;
}

.mapboxgl-popup-content {
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    overflow: visible;
    transition: all 0.3s ease;
    transform-origin: center center;
    pointer-events: auto !important;
}

/* Zoom level scaling */
.zoom-level-far .mapboxgl-popup-content {
    transform: scale(0.15);
}

.zoom-level-medium .mapboxgl-popup-content {
    transform: scale(0.3);
}

.zoom-level-close .mapboxgl-popup-content {
    transform: scale(0.5);
}

.map-legend {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(15px);
    padding: 15px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    min-width: 200px;
}

.map-legend h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
}

.gradient-bar {
    height: 10px;
    width: 100%;
    border-radius: 4px;
    margin: 5px 0;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    font-size: 12px;
    color: #cccccc;
}

/* Custom Zoom Controls */
.custom-zoom-controls {
    position: absolute;
    top: 160px; /* Position well below the navigation header and filters */
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.zoom-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    transition: all 0.2s ease;
    border-bottom: 1px solid #e0e0e0;
}

.zoom-btn:last-child {
    border-bottom: none;
}

.zoom-btn:hover {
    background: #f5f5f5;
    color: #007bff;
}

.zoom-btn:active {
    background: #e0e0e0;
    transform: scale(0.95);
}

.zoom-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9f9f9;
    color: #ccc;
}

/* Position adjustments for mobile */
@media (max-width: 768px) {
    .custom-zoom-controls {
        top: 160px; /* Below the header and filters */
        right: 15px;
    }
    
    .zoom-btn {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
}

/* Improve touch targets on mobile */
@media (hover: none) and (pointer: coarse) {
    .mapboxgl-popup-close-button {
        padding: 12px !important;
        width: 44px !important;
        height: 44px !important;
    }
    
    /* Improve hunting unit touch targets */
    .mapboxgl-canvas {
        touch-action: pan-x pan-y;
    }
    
    /* Add visual feedback for map interactions */
    .map-touch-feedback {
        position: absolute;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: rgba(0, 123, 255, 0.3);
        pointer-events: none;
        transform: scale(0);
        transition: transform 0.2s ease-out;
    }
    
    .map-touch-feedback.active {
        transform: scale(1);
    }

    /* Increase minimum zoom message visibility */
    .zoom-message {
        background: rgba(0, 0, 0, 0.9);
        color: white;
        padding: 15px 25px;
        font-size: 18px;
        border-radius: 25px;
    }
}

/* Adjust legend position for mobile */
@media (max-width: 768px) {
    .map-legend {
        bottom: 60px; /* Move higher to avoid mobile navigation area */
        right: 20px;
        left: 20px;
        padding: 12px;
        min-width: auto; /* Allow smaller width on mobile */
        font-size: 13px;
    }
    
    .map-legend h4 {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .legend-labels {
        font-size: 11px;
    }
}

/* Touch interaction feedback */
.touch-feedback {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: touchRipple 0.4s ease-out;
}

@keyframes touchRipple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* Improved zoom message */
.zoom-message {
    position: fixed;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 25px;
    font-size: 16px;
    text-align: center;
    z-index: 1000;
    animation: fadeInOut 2s ease-in-out;
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    max-width: 80%;
}

/* Device-specific adjustments */
@media (hover: none) and (pointer: coarse) {
    .mobile-popup .mapboxgl-popup-content {
        transform-origin: center center;
        touch-action: none;
    }

    .unit-fill {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0);
    }

    .unit-fill:active {
        opacity: 0.7;
    }
}

/* Tablet-specific adjustments */
@media (min-width: 768px) and (max-width: 1024px) and (hover: none) and (pointer: coarse) {
    .mapboxgl-popup {
        transform-origin: center center;
    }
}

/* Unified Navigation Header */
.unified-nav-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(135deg, var(--thingvalla-primary) 0%, var(--thingvalla-secondary) 100%);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-sizing: border-box;
}

/* Brand Section */
.brand-section {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.brand-logo {
    height: 28px;
    width: auto;
}

.app-title {
    color: var(--thingvalla-white);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.map-filter-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    box-shadow: none;
    flex: 1;
    justify-content: center;
    max-width: 600px;
}

/* Remove filter-group styles since we removed the divs */

.filter-select {
    min-width: 140px;
    padding: 10px 14px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: none;
    color: #2c3e50;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

.filter-select:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.filter-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

/* Navigation Actions */
.nav-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

.nav-btn {
    padding: 8px 16px !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    display: inline-flex !important;
    align-items: center !important;
    white-space: nowrap !important;
    box-shadow: none !important;
    min-width: auto !important;
    width: auto !important;
    height: auto !important;
}

.nav-btn.primary-btn {
    background: var(--thingvalla-primary) !important;
    color: white !important;
}

.nav-btn.primary-btn:hover {
    background: var(--thingvalla-secondary) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,87,255,0.4);
}

.nav-btn.score-btn {
    background: #28a745 !important;
    color: white !important;
}

.nav-btn.score-btn:hover {
    background: #1e7e34 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40,167,69,0.3);
}

.nav-btn.logout-btn {
    background: #dc3545 !important;
    color: white !important;
}

.nav-btn.logout-btn:hover {
    background: #c82333 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220,53,69,0.3);
}

.nav-btn.login-btn {
    background: #6c757d !important;
    color: white !important;
}

.nav-btn.login-btn:hover {
    background: #545b62 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(108,117,125,0.3);
}

/* Desktop-specific adjustments */
@media (min-width: 1200px) {
    .unified-nav-header {
        padding: 0 40px;
    }
    
    .map-filter-controls {
        max-width: 800px;
    }
    
    .filter-select {
        min-width: 160px;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .map-filter-controls {
        top: 10px;
        width: calc(100% - 20px);
        max-width: 400px;
        padding: 8px;
    }

    .filter-select {
        flex: 1;
        min-width: auto;
    }

    .filter-select {
        font-size: 12px;
        padding: 6px;
    }
}

/* Remove these conflicting styles if they exist */
.filters-container,
.filters-toggle,
.filters-content {
    display: none;
}

.view-toggle-container {
    margin: 10px;
    background: #fff;
    border-radius: 4px;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}

/* Date Filter Styling */
.custom-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8f9fa;
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.date-input {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    min-width: 120px;
}

.date-input:focus {
    outline: none;
    border-color: var(--thingvalla-primary);
    box-shadow: 0 0 0 2px rgba(0, 87, 255, 0.25);
}

.apply-date-btn {
    padding: 6px 12px;
    background: var(--thingvalla-primary);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.apply-date-btn:hover {
    background: var(--thingvalla-secondary);
}

.apply-date-btn:active {
    background: #004085;
}

/* Enhanced filter controls responsive design */
@media (max-width: 768px) {
    .map-filter-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        overflow: visible;
    }
    
    .custom-date-range {
        flex-direction: column;
        gap: 6px;
    }
    
    .date-input {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .map-filter-controls {
        padding: 8px;
        gap: 6px;
    }
    
    .filter-select {
        min-width: auto;
    }
    
    .filter-select {
        font-size: 13px;
    }
    
    .date-input {
        font-size: 12px;
        padding: 5px 6px;
    }
    
    .apply-date-btn {
        padding: 5px 10px;
        font-size: 11px;
    }
}

/* Custom Date Range Overlay */
.custom-date-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-date-container {
    background: white;
    border-radius: 12px;
    padding: 24px;
    min-width: 400px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: scale(0.9);
    animation: popIn 0.3s ease forwards;
}

@keyframes popIn {
    to {
        transform: scale(1);
    }
}

.custom-date-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e9ecef;
}

.custom-date-header h4 {
    margin: 0;
    color: #333;
    font-weight: 600;
}

.close-date-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-date-btn:hover {
    background: #f8f9fa;
    color: #333;
}

.date-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-input-group label {
    font-weight: 500;
    color: #555;
    font-size: 14px;
}

.date-input {
    padding: 10px 12px;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.date-input:focus {
    outline: none;
    border-color: var(--thingvalla-primary);
    box-shadow: 0 0 0 3px rgba(0,87,255,0.1);
}

.date-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.cancel-date-btn, .apply-date-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cancel-date-btn {
    background: #f8f9fa;
    color: #6c757d;
    border: 1px solid #e9ecef;
}

.cancel-date-btn:hover {
    background: #e9ecef;
    color: #5a6268;
}

.apply-date-btn {
    background: var(--thingvalla-primary);
    color: white;
}

.apply-date-btn:hover {
    background: var(--thingvalla-secondary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,87,255,0.3);
}

/* Mobile responsive updates for unified header */
@media (max-width: 768px) {
    /* Force override all filter-select styles on mobile */
    .filter-select {
        min-width: 50px !important;
        max-width: 100% !important;
        min-height: 28px !important;
        height: 28px !important;
        padding: 2px 6px !important;
        font-size: 11px !important;
        line-height: 1.2 !important;
        border-radius: 4px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .unified-nav-header {
        height: 140px; /* Increased to accommodate wrapped filters */
        flex-direction: column;
        padding: 4px 8px;
        gap: 2px; /* Minimal gap */
        justify-content: flex-start;
        overflow: visible; /* Allow content to be visible */
    }
    
    .brand-section {
        order: 1;
        width: 100%;
        justify-content: space-between; /* Space between brand and nav actions */
        align-items: center;
        gap: 4px;
        margin-bottom: 2px;
    }
    
    .brand-logo {
        height: 18px; /* Smaller on mobile */
        width: auto;
    }
    
    .app-title {
        font-size: 13px; /* Smaller on mobile */
        font-weight: 600;
        margin-left: 4px;
        flex: 1;
    }
    
    .nav-actions {
        order: 1; /* Same order as brand section to stay on same row */
        display: flex;
        gap: 2px;
        align-items: center;
        flex-shrink: 0;
    }
    
    .nav-actions .nav-btn {
        padding: 4px 6px;
        font-size: 10px;
        min-height: 28px; /* Smaller but still touchable */
        white-space: nowrap;
    }
    
    .map-filter-controls {
        order: 2;
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
        margin-top: 2px;
        justify-content: space-between;
    }
    
    /* Make filters flexible and allow wrapping */
    .filter-select {
        flex: 1 1 auto;
        min-width: 70px;
    }
    
    /* State filter button takes slightly more space */
    #mobileStatePickerBtn {
        flex: 1.2 1 auto;
        min-width: 80px;
    }
    
    /* Date filter gets equal space */
    #dateFilter {
        flex: 1 1 auto;
        min-width: 70px;
    }
    
    /* Date filter visible on mobile */
    
    .custom-date-container {
        min-width: auto;
        margin: 16px;
    }
    
    .date-inputs {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    #map {
        margin-top: 140px; /* Match increased header height */
        height: calc(100vh - 140px);
    }
}

/* Additional mobile optimizations for very small screens */
@media (max-width: 480px) {
    .unified-nav-header {
        padding: 6px 8px; /* Tighter padding for small screens */
    }
    
    .brand-logo {
        height: 20px; /* Even smaller logo */
    }
    
    .app-title {
        font-size: 14px; /* Smaller title */
        margin-left: 6px;
    }
    
    .nav-actions .nav-btn {
        padding: 4px 8px;
        font-size: 11px;
        min-height: 32px; /* Smaller but still touchable */
    }
    
    .filter-select {
        min-width: 80px; /* Smaller minimum width */
        font-size: 12px;
        padding: 6px 8px;
    }
    
    /* Keep same height - no jumping */
    #map {
        margin-top: 140px; /* Consistent with larger mobile */
        height: calc(100vh - 140px);
    }
}

.view-toggle-button {
    border: none;
    background: #fff;
    color: #333;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.view-toggle-button:hover {
    background: #f0f0f0;
}

.view-toggle-button:active {
    background: #e0e0e0;
}