* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html, body {
            height: 100%;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            touch-action: manipulation; /* Prevent zoom on touch */
            transition: background-color 0.3s ease, color 0.3s ease;
        }

        /* Dark mode variables */
        :root {
            --bg-primary: #ffffff;
            --bg-secondary: #f8f9fa;
            --text-primary: #2d3748;
            --text-secondary: #666;
            --border-color: rgba(0,0,0,0.15);
            --overlay-bg: rgba(255,255,255,0.95);
        }

        [data-theme="dark"] {
            --bg-primary: #1a202c;
            --bg-secondary: #2d3748;
            --text-primary: #e2e8f0;
            --text-secondary: #a0aec0;
            --border-color: rgba(255,255,255,0.15);
            --overlay-bg: rgba(26,32,44,0.95);
        }

        body {
            background-color: var(--bg-primary);
            color: var(--text-primary);
        }

        /* Prevent zooming on all elements except map */
        * {
            touch-action: manipulation;
        }

        /* Allow zooming only on the map */
        #map {
            touch-action: auto;
        }

        /* Prevent zoom on input fields */
        input, textarea, select {
            touch-action: manipulation;
            font-size: 16px; /* Prevent zoom on iOS */
        }

        #map {
            height: 100vh;
            width: 100vw;
            transition: margin-right 0.3s ease;
        }

        #map.overlay-open {
            margin-right: 400px;
        }

        @media (max-width: 768px) {
            #map.overlay-open {
                margin-right: 0;
            }
        }

        .loading {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            text-align: center;
            color: #333;
            background: rgba(255, 255, 255, 0.9);
            padding: 20px;
            border-radius: 10px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
            z-index: 1000;
        }

        .loading i {
            font-size: 2rem;
            color: #667eea;
            margin-bottom: 10px;
        }

        /* Remove default popup styling */
        .leaflet-popup-content-wrapper {
            padding: 0;
        }

        .leaflet-popup-content {
            margin: 0;
        }

        /* Overlay content styling */
        .overlay-field {
            margin-bottom: 10px;
            padding: 10px 14px;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 12px;
            border: 1px solid rgba(102, 126, 234, 0.15);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }

        .overlay-field::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 4px;
            height: 100%;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 0 2px 2px 0;
        }

        .overlay-field:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
            border-color: rgba(102, 126, 234, 0.3);
        }

        .overlay-field strong {
            font-weight: 700;
            color: #667eea;
            font-size: 0.75rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 4px;
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .overlay-field span {
            color: #2d3748;
            font-size: 0.9rem;
            line-height: 1.5;
            font-weight: 600;
            display: block;
            margin-top: 4px;
        }

        .reference-link {
            color: #667eea;
            font-size: 0.9rem;
            line-height: 1.5;
            font-weight: 600;
            text-decoration: none;
            display: block;
            margin-top: 4px;
            word-break: break-all;
            transition: color 0.2s ease;
        }

        .reference-link:hover {
            color: #5a67d8;
            text-decoration: underline;
        }

        /* Media maximization modal */
        .media-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.9);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 10000;
            cursor: pointer;
        }

        .media-modal.active {
            display: flex;
        }

        .media-modal-content {
            max-width: 90%;
            max-height: 90%;
            position: relative;
            cursor: default;
        }

        .media-modal img {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
            border-radius: 8px;
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
        }

        .media-modal-close {
            position: absolute;
            top: -40px;
            right: 0;
            background: rgba(255, 255, 255, 0.9);
            border: none;
            border-radius: 50%;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 18px;
            color: #333;
            transition: all 0.2s ease;
        }

        .media-modal-close:hover {
            background: rgba(255, 255, 255, 1);
            transform: scale(1.1);
        }

        .media-modal-info {
            position: absolute;
            bottom: -40px;
            left: 0;
            right: 0;
            text-align: center;
            color: white;
            font-size: 14px;
            background: rgba(0, 0, 0, 0.7);
            padding: 8px 16px;
            border-radius: 4px;
        }

        /* Make media images clickable */
        .overlay-media img {
            cursor: pointer;
            transition: transform 0.2s ease;
        }

        /* Hide map zoom buttons */
        .leaflet-control-zoom {
            display: none !important;
        }

        .overlay-media img:hover {
            transform: scale(1.02);
        }

        /* Chat username styling */
        .chat-username {
            font-weight: 600;
            cursor: pointer;
            transition: color 0.2s ease;
        }

        .chat-username:hover {
            color: #667eea;
        }

        .chat-username.own-username {
            color: #28a745;
            font-weight: 700;
        }

        .chat-username.own-username:hover {
            color: #218838;
        }

        .overlay-media {
            margin: 12px 0;
            text-align: center;
            padding: 10px 12px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 12px;
            border: 1px solid rgba(102, 126, 234, 0.1);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .overlay-media img {
            max-width: 100%;
            max-height: 200px;
            border-radius: 12px;
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
            margin-bottom: 8px;
            object-fit: cover;
            transition: transform 0.3s ease;
        }

        .overlay-media img:hover {
            transform: scale(1.02);
        }

        .overlay-links {
            margin-top: 12px;
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .overlay-link {
            background: #f8f9fa;
            color: #333;
            text-decoration: none;
            padding: 8px 12px;
            border-radius: 6px;
            font-size: 0.85rem;
            font-weight: 500;
            border: 1px solid #dee2e6;
            transition: all 0.2s ease;
            display: inline-flex;
            align-items: center;
            gap: 6px;
        }

        .overlay-link:hover {
            background: #667eea;
            color: white;
            border-color: #667eea;
            transform: translateY(-1px);
        }

        .overlay-link i {
            font-size: 0.8rem;
        }



        .satellite-toggle {
            z-index: 1000;
            background: rgba(255, 255, 255, 0.9);
            border: 2px solid rgba(0, 0, 0, 0.15);
            border-radius: 10px;
            padding: 10px 14px;
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 4px;
            min-height: 44px;
            color: #2d3748;
            backdrop-filter: blur(5px);
            text-align: center;
        }

        .satellite-toggle i {
            font-size: 1.1rem;
            margin-bottom: 2px;
        }

        .satellite-toggle span {
            font-size: 0.85rem;
            line-height: 1.2;
            font-weight: 700;
        }

        /* Import button specific styling */
        #importToggleBtn {
            background: rgba(255, 193, 7, 0.9);
            border-color: rgba(255, 193, 7, 0.6);
            color: #2d3748;
            font-weight: 600;
        }

        #importToggleBtn:hover {
            background: rgba(255, 193, 7, 0.95);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(255, 193, 7, 0.3);
            border-color: rgba(255, 193, 7, 0.8);
        }

        #importToggleBtn.active {
            background: linear-gradient(135deg, #ffc107, #ffb300);
            color: #2d3748;
            border-color: #ffc107;
            box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
        }

        .satellite-toggle:hover {
            background: rgba(102, 126, 234, 0.1);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
            border-color: rgba(102, 126, 234, 0.3);
        }

        .satellite-toggle.active {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            border-color: #667eea;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        }

        /* New pin counter label styling */
        .pin-counter-label {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            color: #2d3748;
            font-weight: 600;
            border: 2px solid rgba(102, 126, 234, 0.3);
            border-radius: 25px;
            padding: 8px 16px;
            font-size: 0.9rem;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            display: flex;
            align-items: center;
            gap: 8px;
            transition: all 0.3s ease;
        }

        .pin-counter-label:hover {
            background: rgba(255, 255, 255, 1);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
        }

        .pin-counter-icon {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
        }

        .pin-counter-text {
            font-weight: 700;
            color: #2d3748;
        }

        /* Keep old pin-counter styling for compatibility */
        .pin-counter {
            background: rgba(40, 167, 69, 0.9);
            color: white;
            font-weight: 600;
            border-color: #28a745;
        }

        .pin-counter:hover {
            background: rgba(40, 167, 69, 0.95);
            transform: translateY(-1px);
        }



        .details-overlay.open {
            right: 0;
        }

        .overlay-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 12px 16px;
            position: sticky;
            top: 0;
            z-index: 10;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        }

        .header-main {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 16px;
        }

        .header-info {
            display: flex;
            align-items: center;
            gap: 20px;
            flex: 1;
            font-size: 0.85rem;
        }

        .header-coordinates,
        .header-activity {
            display: flex;
            align-items: center;
            gap: 6px;
            opacity: 0.9;
        }

        .header-coordinates i,
        .header-activity i {
            font-size: 0.8rem;
            min-width: 12px;
        }

        .header-voting {
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .header-buttons {
            display: flex;
            gap: 8px;
            align-items: center;
            flex-shrink: 0;
        }

        .directions-btn {
            background: rgba(255, 255, 255, 0.2);
            color: white;
            border: 2px solid rgba(255, 255, 255, 0.3);
            border-radius: 8px;
            padding: 12px 16px;
            font-size: 0.9rem;
            font-weight: 600;
            cursor: pointer;
            display: block; /* Hidden by default */
            align-items: center;
            gap: 8px;
            transition: all 0.2s ease;
            text-decoration: none;
        }

        .directions-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            border-color: rgba(255, 255, 255, 0.5);
            transform: translateY(-1px);
        }

        .directions-btn i {
            font-size: 1rem;
        }

        .close-btn {
            background: none;
            border: none;
            color: white;
            font-size: 1.2rem;
            cursor: pointer;
            padding: 5px;
            border-radius: 50%;
            transition: background 0.2s ease;
        }

        .close-btn:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .overlay-content {
            padding: 12px 16px;
            flex: 1;
            overflow-y: auto;
            min-height: 0;
            max-height: calc(100vh - 100px);
            background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
        }

        /* Map view section spanning full width */
        #mapViewSection {
            margin: 0 -16px 15px -16px !important;
            padding: 0 !important;
        }

        #mapViewContainer {
            position: relative;
            margin: 0;
            padding: 0;
        }

        /* Prediction cluster styling */
        .marker-cluster-prediction {
            background: linear-gradient(135deg, #28a745, #20c997);
            border: 2px solid #ffffff;
            border-radius: 50%;
            color: white;
            font-weight: bold;
            text-align: center;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
        }

        .marker-cluster-prediction span {
            font-size: 14px;
            font-weight: bold;
        }

        .details-overlay {
            position: fixed;
            top: 0;
            right: -420px;
            width: 420px;
            height: 100vh;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
            z-index: 1000;
            overflow: hidden;
            display: flex;
            flex-direction: column;
        }

        @media (max-width: 768px) {
            .details-overlay {
                width: 100vw;
                right: -100vw;
            }

            .overlay-content {
                padding-bottom: 100px; /* Ensure last row is visible on mobile */
            }

            /* Hide map zoom buttons when details are open on mobile */
            .details-overlay.open ~ #map .leaflet-control-zoom {
                display: none !important;
            }

            /* Mobile bottom menu styling */
            .top-controls {
                position: fixed !important;
                bottom: 0 !important;
                left: 0 !important;
                right: 0 !important;
                top: auto !important;
                width: 100% !important;
                z-index: 1000 !important;
                background: rgba(255, 255, 255, 0.98) !important;
                backdrop-filter: blur(20px) !important;
                padding: 12px 8px 8px 8px !important;
                border-radius: 20px 20px 0 0 !important;
                box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
                justify-content: space-around !important;
                border-top: 1px solid rgba(0, 0, 0, 0.1) !important;
            }

            .top-controls .satellite-toggle {
                flex: 1;
                display: flex;
                flex-direction: column;
                align-items: center;
                padding: 8px 4px;
                margin: 0 4px;
                border-radius: 12px;
                transition: all 0.2s ease;
                background: transparent;
                border: none;
                color: #666;
                font-size: 0.75rem;
                min-height: 60px;
            }

            .top-controls         .satellite-toggle:hover {
            background: rgba(102, 126, 234, 0.1);
            color: #667eea;
            transform: translateY(-2px);
        }

        /* Records and Prediction button states */
        .records-toggle.active {
            background: linear-gradient(135deg, #28a745, #20c997);
            color: white;
            border-color: #28a745;
            box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
        }

        .records-toggle:not(.active) {
            background: rgba(255, 255, 255, 0.9);
            color: #dc3545;
            border-color: rgba(220, 53, 69, 0.3);
        }

        .records-toggle:not(.active):hover {
            background: rgba(220, 53, 69, 0.1);
            border-color: rgba(220, 53, 69, 0.5);
        }

        .prediction-toggle.active {
            background: linear-gradient(135deg, #28a745, #20c997);
            color: white;
            border-color: #28a745;
            box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
        }

        .prediction-toggle:not(.active) {
            background: rgba(255, 255, 255, 0.9);
            color: #dc3545;
            border-color: rgba(220, 53, 69, 0.3);
        }

        .prediction-toggle:not(.active):hover {
            background: rgba(220, 53, 69, 0.1);
            border-color: rgba(220, 53, 69, 0.5);
        }

            .top-controls .satellite-toggle i {
                font-size: 1.2rem;
                margin-bottom: 4px;
            }

            /* Mobile layout for new controls */
            .corner-controls {
                top: 10px;
                right: 10px;
                gap: 6px;
            }
            
            .corner-btn {
                width: 42px;
                height: 42px;
                font-size: 1.1rem;
            }
            
            .main-controls {
                position: fixed !important;
                bottom: 0 !important;
                left: 0 !important;
                right: 0 !important;
                transform: none !important;
                width: 100% !important;
                background: var(--overlay-bg) !important;
                border-radius: 20px 20px 0 0 !important;
                gap: 4px !important;
            }
            
            .control-btn {
                flex: 1;
                min-width: unset;
                padding: 8px 4px;
                font-size: 0.75rem;
            }
            
            .control-btn i {
                font-size: 1.1rem;
                margin-bottom: 3px;
            }

            /* Hide icons in main control buttons on mobile */
            .main-controls .control-btn i {
                display: none;
            }
            
            .control-btn span {
                font-size: 0.7rem;
            }

        }

        /* Corner Controls - Top Right */
        .corner-controls {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 1000;
            display: flex;
            gap: 8px;
        }

        .corner-btn {
            width: 48px;
            height: 48px;
            background: var(--overlay-bg);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            color: var(--text-primary);
            font-size: 1.2rem;
            cursor: pointer;
            box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
            transition: all 0.3s ease;
            opacity: 0.6;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .corner-btn:hover {
            opacity: 1;
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
        }

        /* Main Control Panel - Desktop */
        .main-controls {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 1000;
            display: flex;
            gap: 12px;
            background: var(--overlay-bg);
            backdrop-filter: blur(20px);
            border-radius: 16px;
            padding: 12px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
            border: 1px solid var(--border-color);
        }

        .control-btn {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 12px 16px;
            border-radius: 12px;
            border: 1px solid var(--border-color);
            background: var(--bg-primary);
            color: var(--text-primary);
            font-size: 0.85rem;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            min-width: 80px;
        }

        .control-btn i {
            font-size: 1.2rem;
            margin-bottom: 4px;
        }

        /* Hide icons in main control buttons */
        .main-controls .control-btn i {
            display: none;
        }

        .control-btn span {
            font-size: 0.8rem;
            line-height: 1.2;
            font-weight: 700;
        }

        /* Button Variants */
        .control-btn.primary {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            border-color: #667eea;
        }

        .control-btn.secondary {
            background: var(--bg-secondary);
        }

        .control-btn.tertiary {
            background: transparent;
            border-style: dashed;
        }

        .control-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
        }

        .control-btn.active {
            background: linear-gradient(135deg, #28a745, #20c997);
            color: white;
            border-color: #28a745;
        }

        .control-btn.primary:hover {
            box-shadow: 0 6px 25px rgba(102, 126, 234, 0.3);
        }

        /* Quick Import Popup */
        .quick-import {
            position: fixed;
            top: 80px;
            left: 20px;
            z-index: 1002;
            background: var(--overlay-bg);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 12px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
            width: 300px;
            max-width: calc(100vw - 40px);
        }

        .quick-import input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border-color);
            border-radius: 8px;
            background: var(--bg-primary);
            color: var(--text-primary);
            font-size: 0.9rem;
            margin-bottom: 8px;
        }

        .quick-import input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

        .quick-import-actions {
            display: flex;
            gap: 8px;
        }

        .quick-import-actions button {
            flex: 1;
            padding: 8px;
            border: 1px solid var(--border-color);
            border-radius: 6px;
            background: var(--bg-primary);
            color: var(--text-primary);
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .quick-import-actions button:hover {
            background: var(--bg-secondary);
            transform: translateY(-1px);
        }

        #quickImportBtn {
            background: linear-gradient(135deg, #28a745, #20c997) !important;
            color: white !important;
            border-color: #28a745 !important;
        }

        /* Legacy - keeping for compatibility */
        .top-controls {
            display: none;
            border: 1px solid rgba(0, 0, 0, 0.1);
        }

        /* Larger screens - optimize button bar width */
        @media (min-width: 1400px) {
            .top-controls {
                width: 28%;
                min-width: 450px;
            }
        }

        /* Smaller desktop screens */
        @media (max-width: 1200px) {
            .top-controls {
                width: 40%;
                min-width: 380px;
            }
        }

        /* Import Panel */
        .import-panel {
            position: absolute;
            top: 10px;
            left: 10px;
            background: rgba(255, 193, 7, 0.95);
            backdrop-filter: blur(10px);
            border-radius: 10px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            z-index: 1000;
            min-width: 300px;
        }

        .import-header {
            padding: 15px 20px 10px 20px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }

        .import-header h4 {
            margin: 0;
            color: #333;
            font-size: 1rem;
            font-weight: 600;
        }

        .import-content {
            padding: 15px 20px 20px 20px;
        }

        .import-input {
            width: 100%;
            padding: 10px 12px;
            border: 2px solid rgba(0, 0, 0, 0.1);
            border-radius: 8px;
            font-size: 14px;
            margin-bottom: 12px;
            box-sizing: border-box;
        }

        .import-input:focus {
            outline: none;
            border-color: #ffc107;
        }

        .import-btn {
            background: #28a745;
            color: white;
            border: none;
            padding: 10px 16px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            width: 100%;
            transition: background 0.2s ease;
        }

        .import-btn:hover {
            background: #218838;
        }

        .import-info {
            text-align: center;
            margin-top: 8px;
            color: #666;
        }

        .import-help {
            background: rgba(255, 255, 255, 0.9);
            border: 1px solid #ffc107;
            border-radius: 6px;
            padding: 10px;
            margin-top: 10px;
            font-size: 12px;
            line-height: 1.4;
            color: #333;
        }

        .import-help h5 {
            margin: 0 0 8px 0;
            color: #856404;
            font-size: 13px;
        }

        .import-help ol {
            margin: 0;
            padding-left: 20px;
        }

        .import-help li {
            margin-bottom: 4px;
        }

        .import-help a {
            color: #007bff;
            text-decoration: underline;
        }

        /* Voting and comments styling */
        .voting-section {
            margin: 12px 0;
            padding: 12px 16px;
            background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
            border-radius: 16px;
            border: 1px solid rgba(102, 126, 234, 0.15);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            position: relative;
            overflow: hidden;
        }

        .voting-section::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
        }

        .voting-section h4 {
            margin: 0 0 10px 0;
            font-size: 0.85rem;
            font-weight: 700;
            color: #667eea;
            text-transform: uppercase;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .vote-buttons {
            display: flex;
            gap: 8px;
        }

        .vote-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            padding: 10px 18px;
            border: 2px solid transparent;
            border-radius: 12px;
            font-size: 0.9rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
            min-width: 60px;
            justify-content: center;
            backdrop-filter: blur(10px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .vote-btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s;
        }

        .vote-btn:hover::before {
            left: 100%;
        }

        .vote-btn.upvote {
            background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
            color: white;
            border-color: #16a34a;
            box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
        }

        .vote-btn.upvote:hover {
            background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
        }

        .vote-btn.upvote.voted {
            background: linear-gradient(135deg, #15803d 0%, #14532d 100%);
            color: white;
            border-color: #14532d;
            box-shadow: 0 6px 20px rgba(34, 197, 94, 0.5);
        }

        .vote-btn.downvote {
            background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
            color: white;
            border-color: #dc2626;
            box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
        }

        .vote-btn.downvote:hover {
            background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
        }

        .vote-btn.downvote.voted {
            background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
            color: white;
            border-color: #991b1b;
            box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
        }

        .vote-count {
            font-weight: bold;
            min-width: 20px;
            text-align: center;
        }

        .comments-section {
            margin-top: 12px;
            max-height: 180px;
            overflow-y: auto;
            padding: 12px 14px;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 12px;
            border: 1px solid rgba(102, 126, 234, 0.15);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        }

        .comments-section h5 {
            margin: 0 0 10px 0;
            color: #667eea;
            font-size: 0.85rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 1px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .comment {
            background: rgba(102, 126, 234, 0.08);
            padding: 8px 12px;
            border-radius: 10px;
            margin-bottom: 8px;
            border: 1px solid rgba(102, 126, 234, 0.1);
            transition: all 0.2s ease;
            position: relative;
        }

        .comment:hover {
            background: rgba(102, 126, 234, 0.12);
            transform: translateX(2px);
        }

        .comment-author {
            font-weight: 700;
            color: #667eea;
            font-size: 0.8rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
        }

        .comment-date {
            font-size: 0.75rem;
            color: #a0aec0;
            margin-left: 12px;
            font-weight: 500;
        }

        .comment-form {
            display: flex;
            gap: 8px;
            margin-top: 10px;
        }

        .comment-input {
            flex: 1;
            padding: 6px 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 13px;
            resize: vertical;
            min-height: 30px;
        }

        .comment-submit {
            background: #667eea;
            color: white;
            border: none;
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            transition: background 0.2s ease;
        }

        .comment-submit:hover {
            background: #5a67d8;
        }

        /* Compact layout for overlay fields */
        .overlay-field.compact {
            display: inline-block;
            margin-right: 12px;
            margin-bottom: 12px;
            vertical-align: top;
            width: calc(50% - 6px);
            padding: 12px 16px;
            background: rgba(255, 255, 255, 0.9);
            border-radius: 12px;
            border: 1px solid rgba(102, 126, 234, 0.1);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
            transition: all 0.2s ease;
        }

        .overlay-field.compact:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        }

        .overlay-field.compact strong {
            font-size: 0.7rem;
            margin-bottom: 6px;
            letter-spacing: 0.8px;
            color: #667eea;
        }

        .overlay-field.compact span {
            font-size: 0.85rem;
            line-height: 1.4;
            color: #2d3748;
            font-weight: 600;
        }

        /* Improved comment form styling */
        .comment-form {
            display: flex;
            gap: 8px;
            margin-top: 10px;
            padding: 10px 12px;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 12px;
            border: 1px solid rgba(102, 126, 234, 0.15);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
        }

        .comment-form:focus-within {
            border-color: rgba(102, 126, 234, 0.3);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
        }

        .comment-input {
            flex: 1;
            padding: 8px 12px;
            border: 2px solid rgba(102, 126, 234, 0.1);
            border-radius: 10px;
            font-size: 0.85rem;
            outline: none;
            transition: all 0.3s ease;
            background: rgba(248, 250, 252, 0.8);
            font-weight: 500;
        }

        .comment-input:focus {
            border-color: rgba(102, 126, 234, 0.4);
            box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
            background: white;
        }

        .comment-input::placeholder {
            color: #a0aec0;
            font-weight: 400;
        }

        .comment-submit {
            padding: 8px 16px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            border-radius: 10px;
            font-size: 0.85rem;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .comment-submit:hover {
            transform: translateY(-2px);
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
        }

        .comment-submit:active {
            transform: translateY(0);
        }

        .import-section {
            margin-top: 15px;
            padding: 10px;
            background: rgba(255, 193, 7, 0.1);
            border: 1px solid #ffc107;
            border-radius: 6px;
        }

        .import-input {
            width: 100%;
            padding: 6px 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 13px;
            margin-bottom: 8px;
        }

        .import-btn {
            background: #ffc107;
            color: #333;
            border: none;
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            font-weight: 500;
        }

        .import-btn:hover {
            background: #e0a800;
        }

        /* Compact layout for overlay fields */
        .overlay-field.compact {
            display: inline-block;
            margin-right: 15px;
            margin-bottom: 15px;
            vertical-align: top;
            width: calc(50% - 8px);
        }

        .overlay-field.compact strong {
            font-size: 0.8rem;
            margin-bottom: 3px;
        }

        .overlay-field.compact span {
            font-size: 0.85rem;
        }

        /* Chat functionality styles */
        .chat-toggle {
            background: rgba(255, 255, 255, 0.9);
            border: 2px solid rgba(0, 0, 0, 0.15);
            border-radius: 10px;
            font-weight: 600;
            transition: transform 0.2s ease;
            display: flex;
            align-items: center;
            gap: 6px;
            color: #2d3748;
            position: relative;
        }

        .location-zoom-btn {
            position: absolute;
            right: -30px;
            top: 50%;
            transform: translateY(-50%);
            background: #28a745;
            color: white;
            border: none;
            border-radius: 50%;
            width: 24px;
            height: 24px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
            transition: all 0.2s ease;
        }

        .leaflet-control-attribution {
            display: none;
        }

        .location-zoom-btn:hover {
            background: #218838;
            transform: translateY(-50%) scale(1.1);
        }

        .chat-toggle:hover {
            transform: scale(1.05);
        }

        .chat-toggle.active {
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            border-color: #667eea;
            box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
        }

        /* Position chat button on the right side of the button bar (desktop only) */
        @media (min-width: 769px) {
            .chat-toggle {  
                position: relative !important;
                right: auto;
                top: auto;
                transform: none;
                z-index: 1001;
            }
            
            .chat-toggle:hover {
                transform: scale(1.05);
            }

            /* Remove margin since chat button is now inside */
            .main-controls {
                margin-right: 0;
            }
        }

        .chat-toggle .notification-badge {
            background: #e53e3e;
            color: white;
            border-radius: 50%;
            width: 18px;
            height: 18px;
            font-size: 0.7rem;
            font-weight: bold;
            display: flex;
            align-items: center;
            justify-content: center;
            position: absolute;
            top: -5px;
            right: -5px;
        }

        .chat-panel {
            position: fixed;
            top: 0;
            right: -450px;
            width: 450px;
            height: 100vh;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
            z-index: 1001;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            transition: right 0.3s ease;
        }

        /* Mobile responsive adjustments */
        @media (max-width: 768px) {
            .chat-panel {
                width: 100vw;
                right: -100vw;
            }

            .top-controls {
                flex-wrap: wrap;
                gap: 8px;
            }

            .satellite-toggle {
                font-size: 0.8rem;
                padding: 6px 10px;
            }

            .chat-toggle {
                font-size: 0.8rem;
                padding: 6px 12px;
            }

            .location-zoom-btn {
                width: 20px;
                height: 20px;
                font-size: 0.6rem;
            }

            /* Show zoom controls by default on mobile */
            .leaflet-control-zoom {
                display: block !important;
            }

            /* Adjust overlay width for mobile */
            .details-overlay {
                width: 100vw;
                right: -100vw;
            }

            /* Ensure chat input is visible on mobile */
            .chat-input-area {
                padding: 12px;
                position: fixed !important;
                bottom: 110px !important;
                left: env(safe-area-inset-left, 0px) !important;
                right: env(safe-area-inset-right, 0px) !important;
                height: calc(10vh + env(safe-area-inset-bottom, 0px)) !important; /* Take 10% of screen height + safe area */
                background: white !important;
                border-top: 2px solid rgba(0, 0, 0, 0.1) !important;
                z-index: 1001 !important;
                box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1) !important;
                display: flex !important;
                align-items: center !important;
                gap: 8px !important;
                visibility: visible !important;
                opacity: 1 !important;
                padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
            }

            .chat-messages {
                padding-bottom: calc(10vh + env(safe-area-inset-bottom, 0px)) !important; /* Space for input area + safe area */
                max-height: calc(100vh - 45vh - env(safe-area-inset-bottom, 0px)) !important; /* Limit height to prevent overflow */
            }

            .chat-input {
                flex: 1 !important;
                font-size: 16px !important; /* Prevent zoom on iOS */
                padding: 12px 16px !important;
                border: 1px solid #ddd !important;
                border-radius: 8px !important;
                background: white !important;
            }

            .chat-send-btn {
                padding: 12px 16px !important;
                background: #667eea !important;
                color: white !important;
                border: none !important;
                border-radius: 8px !important;
                cursor: pointer !important;
                font-size: 16px !important;
                width: 44px;
                height: 44px;
            }

            /* iOS specific fixes */
            @supports (padding: max(0px)) {
                .chat-input-area {
                    padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
                }
            }

            /* Fallback for older iOS versions */
            .chat-input-area {
                padding-bottom: 12px !important;
                padding-bottom: calc(12px + constant(safe-area-inset-bottom)) !important; /* iOS 11.0-11.2 */
                padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important; /* iOS 11.2+ */
            }
        }

        .chat-panel.open {
            right: 0;
        }

        .chat-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 15px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            position: sticky;
            top: 0;
            z-index: 10;
        }

        .chat-header h3 {
            margin: 0;
            font-size: 1.1rem;
            font-weight: 600;
        }

        .chat-header .status {
            font-size: 0.8rem;
            opacity: 0.9;
        }

        .chat-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .chat-tabs {
            display: flex;
            background: rgba(102, 126, 234, 0.1);
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }

        .chat-tab {
            flex: 1;
            padding: 12px 16px;
            text-align: center;
            cursor: pointer;
            font-size: 0.9rem;
            font-weight: 500;
            color: #4a5568;
            transition: all 0.2s ease;
            position: relative;
        }

        .chat-tab.active {
            background: #667eea;
            color: white;
        }

        .chat-tab:hover:not(.active) {
            background: rgba(102, 126, 234, 0.2);
        }

        .chat-tab .badge {
            background: #e53e3e;
            color: white;
            border-radius: 50%;
            width: 16px;
            height: 16px;
            font-size: 0.7rem;
            font-weight: bold;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-left: 4px;
        }

        .chat-section {
            display: none;
            flex: 1;
            flex-direction: column;
            overflow: hidden;
        }

        .chat-section.active {
            display: flex;
        }

        .nearby-users {
            flex: 1;
            overflow-y: auto;
            padding: 0;
        }

        .user-item {
            display: flex;
            align-items: center;
            padding: 12px 16px;
            border-bottom: 1px solid rgba(0, 0, 0, 0.05);
            cursor: pointer;
            transition: background 0.2s ease;
        }

        .user-item:hover {
            background: rgba(102, 126, 234, 0.05);
        }

        .user-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: linear-gradient(135deg, #667eea, #764ba2);
            color: white;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            margin-right: 12px;
        }

        .user-info {
            flex: 1;
        }

        .user-name {
            font-weight: 500;
            color: #2d3748;
            margin-bottom: 2px;
        }

        .user-distance {
            font-size: 0.8rem;
            color: #718096;
        }

        .user-status {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: #48bb78;
            margin-left: 8px;
        }

        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 16px;
            background: rgba(255, 255, 255, 0.5);
        }

        .message {
            margin-bottom: 12px;
            display: flex;
        }

        .message.own {
            justify-content: flex-end;
        }

        .message-content {
            max-width: 70%;
            padding: 8px 12px;
            border-radius: 12px;
            background: #f7fafc;
            border: 1px solid rgba(0, 0, 0, 0.1);
            font-size: 0.9rem;
            line-height: 1.4;
        }

        .message.own .message-content {
            background: #667eea;
            color: white;
            border-color: #667eea;
        }

        .message-author {
            font-size: 0.75rem;
            font-weight: 600;
            color: #4a5568;
            margin-bottom: 4px;
        }

        .message.own .message-author {
            color: #e2e8f0;
            text-align: right;
        }

        .message-time {
            font-size: 0.7rem;
            color: #a0aec0;
            margin-top: 2px;
        }

        .chat-input-area {
            padding: 16px;
            background: white;
            border-top: 1px solid rgba(0, 0, 0, 0.1);
            display: flex;
            gap: 8px;
            align-items: center;
        }

        .chat-input {
            flex: 1;
            padding: 8px 12px;
            border: 2px solid rgba(0, 0, 0, 0.1);
            border-radius: 20px;
            font-size: 0.9rem;
            outline: none;
            transition: border-color 0.2s ease;
        }

        .chat-input:focus {
            border-color: #667eea;
        }

        .chat-send-btn {
            background: #667eea;
            color: white;
            border: none;
            border-radius: 50%;
            width: 36px;
            height: 36px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: background 0.2s ease;
        }

        .chat-send-btn:hover {
            background: #5a67d8;
        }

        .chat-send-btn:disabled {
            background: #a0aec0;
            cursor: not-allowed;
        }

        .location-permission {
            padding: 16px;
            text-align: center;
            background: rgba(102, 126, 234, 0.1);
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
        }

        .location-permission button {
            background: #667eea;
            color: white;
            border: none;
            padding: 8px 16px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 0.9rem;
            margin-top: 8px;
        }

        .location-permission button:hover {
            background: #5a67d8;
        }

        .no-users, .no-messages {
            padding: 40px 16px;
            text-align: center;
            color: #718096;
        }

        .no-users i, .no-messages i {
            font-size: 2rem;
            margin-bottom: 12px;
            opacity: 0.5;
        }

        .typing-indicator {
            padding: 8px 16px;
            font-size: 0.8rem;
            color: #718096;
            font-style: italic;
        }

        /* Current Location Marker */
        .current-location-marker {
            background: none !important;
            border: none !important;
            animation: pulse 2s infinite;
        }

        @keyframes pulse {
            0% {
                transform: scale(1);
                opacity: 1;
            }
            50% {
                transform: scale(1.2);
                opacity: 0.7;
            }
            100% {
                transform: scale(1);
                opacity: 1;
            }
        }