/* Base styles */
* {
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#map {
    height: 100vh;
    width: 100%;
}

/* Modern Glassmorphism Base Style */
.glassmorphism {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glassmorphism:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Region Control Panel - Modern Glassmorphism */
.region-control {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    padding: 20px;
    z-index: 1000;
    min-width: 220px;
    max-height: 80vh;
    overflow-y: auto;
    display: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-10px);
    opacity: 0;
}

.region-control.show {
    display: block;
    transform: translateY(0);
    opacity: 1;
}

.region-control:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.region-title {
    font-weight: 600;
    margin-bottom: 16px;
    font-size: 16px;
    color: #1f2937;
    text-align: center;
    letter-spacing: 0.5px;
}

.region-checkbox {
    display: block;
    margin: 12px 0;
    font-size: 14px;
    color: #374151;
    font-weight: 500;
    transition: color 0.2s ease;
}

.region-checkbox:hover {
    color: #1f2937;
}

.region-checkbox input {
    margin-right: 10px;
    transform: scale(1.1);
    accent-color: #3b82f6;
}

.region-actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
}

.region-btn {
    background: rgba(59, 130, 246, 0.8);
    backdrop-filter: blur(10px);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.region-btn:hover {
    background: rgba(59, 130, 246, 1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.3);
}

.region-btn:active {
    transform: translateY(0);
}

.region-stats {
    margin-top: 12px;
    font-size: 12px;
    color: #6b7280;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 12px;
    text-align: center;
    font-weight: 500;
}

/* Visit Stats */
.visit-stats {
    margin-top: 10px;
    font-size: 12px;
    color: #3b82f6;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 10px;
    font-weight: 600;
    text-align: center;
}

/* Danish HD Indicator */
.hd-indicator {
    margin-top: 10px;
    font-size: 11px;
    color: #22c55e;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 10px;
    font-weight: 600;
    text-align: center;
}

.hd-indicator a {
    color: #22c55e;
    text-decoration: none;
}

.hd-indicator a:hover {
    text-decoration: underline;
}

/* Modern Region Toggle Button */
.region-toggle {
    position: absolute;
    bottom: 30px;
    left: 30px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #374151;
}

.region-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.region-toggle.active {
    background: rgba(59, 130, 246, 0.8);
    color: white;
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.3);
}

.region-toggle.active:hover {
    background: rgba(59, 130, 246, 0.9);
}

/* Modern GPS Return Button */
.gps-return {
    position: absolute;
    bottom: 30px;
    right: 30px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    width: 60px;
    height: 60px;
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #374151;
}

.gps-return:hover:not(.disabled) {
    background: rgba(34, 197, 94, 0.2);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 40px rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.gps-return.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.08);
}

.gps-return.disabled:hover {
    transform: none;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

/* Status bar - Enhanced Glassmorphism */
.status {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: #1f2937;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 1000;
    text-align: center;
    white-space: nowrap;
    max-width: 320px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}

.status:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

/* User marker - Enhanced styling */
.user-marker {
    position: relative;
    width: 28px;
    height: 28px;
}

.user-marker-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.user-marker-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 2px solid rgba(239, 68, 68, 0.4);
    border-radius: 50%;
    animation: modernPulse 2.5s ease-out infinite;
}

@keyframes modernPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.4);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.8);
        opacity: 0;
    }
}

/* Enhanced Smart cluster styling */
.smart-cluster {
    will-change: transform;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

.smart-cluster:hover {
    transform: scale(1.15);
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.3));
}

/* Enhanced bunker marker */
.bunker-marker {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 3px 8px rgba(59, 130, 246, 0.4);
    transition: all 0.2s ease;
}

.visited-marker {
    background: linear-gradient(135deg, #22c55e, #16a34a) !important;
    box-shadow: 0 3px 8px rgba(34, 197, 94, 0.4) !important;
}

/* Enhanced visit checkbox */
.visit-checkbox {
    margin: 12px 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.visit-checkbox:hover {
    background: rgba(255, 255, 255, 0.15);
}

.visit-checkbox label {
    display: flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: #374151;
}

.visit-checkbox input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.3);
    accent-color: #22c55e;
}

.visit-checkbox.visited {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
}

.visit-checkbox.visited label {
    color: #16a34a;
}

/* Enhanced Leaflet Controls with Glassmorphism */
.leaflet-control-container {
    pointer-events: none;
}

.leaflet-control {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    overflow: hidden !important;
}

.leaflet-control:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
    transform: translateY(-2px) !important;
}

/* Zoom Control Styling */
.leaflet-control-zoom {
    border: none !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1) !important;
}

.leaflet-control-zoom a {
    background: transparent !important;
    border: none !important;
    color: #374151 !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    width: 40px !important;
    height: 40px !important;
    line-height: 40px !important;
    text-align: center !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    border-radius: 0 !important;
    position: relative !important;
}

.leaflet-control-zoom a:hover {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #3b82f6 !important;
    transform: scale(1.1) !important;
}

.leaflet-control-zoom a:first-child {
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
}

.leaflet-control-zoom a:last-child {
    border-bottom-left-radius: 16px !important;
    border-bottom-right-radius: 16px !important;
}

.leaflet-control-zoom a:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Layer Control Styling */
.leaflet-control-layers {
    border: none !important;
    border-radius: 16px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(15px) !important;
    -webkit-backdrop-filter: blur(15px) !important;
    padding: 0 !important;
    min-width: auto !important;
    width: auto !important;
}

.leaflet-control-layers-toggle {
    background: transparent !important;
    border: none !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 16px !important;
    background-image: none !important;
    position: relative !important;
    transition: all 0.3s ease !important;
    display: block !important;
    margin: 0 !important;
}

.leaflet-control-layers-toggle:hover {
    background: rgba(59, 130, 246, 0.15) !important;
    transform: scale(1.05) !important;
}

.leaflet-control-layers-toggle::before {
    content: '⚏' !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    font-size: 18px !important;
    color: #374151 !important;
    font-weight: 600 !important;
}

.leaflet-control-layers-expanded {
    padding: 20px !important;
    border-radius: 16px !important;
    min-width: 220px !important;
    width: auto !important;
}

.leaflet-control-layers-list {
    margin: 0 !important;
    padding: 0 !important;
}

.leaflet-control-layers label {
    display: block !important;
    margin: 8px 0 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #374151 !important;
    cursor: pointer !important;
    padding: 8px 0 !important;
    transition: color 0.2s ease !important;
    line-height: 1.4 !important;
}

.leaflet-control-layers label:hover {
    color: #1f2937 !important;
}

.leaflet-control-layers input {
    margin-right: 8px !important;
    transform: scale(1.1) !important;
    accent-color: #3b82f6 !important;
}

.leaflet-control-layers-separator {
    height: 1px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    margin: 12px 0 !important;
    border: none !important;
}

/* Attribution Control */
.leaflet-control-attribution {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-radius: 12px !important;
    font-size: 10px !important;
    color: #6b7280 !important;
    padding: 4px 8px !important;
    margin: 8px !important;
}

.leaflet-control-attribution a {
    color: #3b82f6 !important;
    text-decoration: none !important;
}

.leaflet-control-attribution a:hover {
    text-decoration: underline !important;
}

/* Performance optimizations */
.leaflet-marker-icon,
.leaflet-marker-shadow {
    will-change: transform;
}

.leaflet-container {
    background: #f8fafc;
}

/* Smooth scrollbar for region control */
.region-control::-webkit-scrollbar {
    width: 6px;
}

.region-control::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.region-control::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.region-control::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .region-control {
        position: fixed;
        top: 15px;
        left: 15px;
        right: 15px;
        bottom: 120px;
        max-width: none;
        max-height: none;
        overflow-y: auto;
        border-radius: 24px;
        padding: 24px;
    }

    .region-toggle {
        bottom: 20px;
        left: 20px;
        width: 56px;
        height: 56px;
        border-radius: 16px;
    }

    .gps-return {
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 16px;
    }

    .status {
        bottom: 100px;
        left: 50%;
        transform: translateX(-50%);
        max-width: calc(100vw - 40px);
        font-size: 11px;
        padding: 10px 16px;
        border-radius: 16px;
    }

    /* Enhanced mobile glassmorphism fallback */
    @supports not (backdrop-filter: blur(15px)) {
        .region-control,
        .region-toggle,
        .gps-return,
        .status {
            background: rgba(255, 255, 255, 0.95);
            border: 1px solid rgba(0, 0, 0, 0.1);
        }
    }
}
