/* DemocracyCraft Maps Styles */

/* Reset body margin/padding for full screen map */
body.dcs-maps-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* Adjust search container for maps page */
.dcs-maps-page .dcs-search-container {
    height: auto;
    min-height: auto;
}

.dcs-maps-page .dcs-search-header {
    padding: 10px 20px;
    position: relative;
    top: auto;
}

.dcs-maps-page .dcs-search-categories {
    padding: 8px 20px;
    top: auto;
}

.dcs-map-container {
    width: 100%;
    height: 100vh;
    position: relative;
    background: #f0f0f0;
    font-family: arial, sans-serif;
}

.dcs-map {
    width: 100%;
    height: 100%;
    background: #8fd7ec;
    position: relative;
    overflow: hidden; /* Hide overflow during rotation */
}

/* Leaflet Map Overrides */
.leaflet-container {
    background: #8fd7ec !important;
    font-family: arial, sans-serif !important;
    overflow: hidden !important; /* Ensure no scrollbars during rotation */
}

/* Map pane rotation styles */
.leaflet-map-pane {
    transition: transform 0.5s ease-out;
}

.leaflet-popup-content-wrapper {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0 !important;
}

/* Business hover tooltip styles - NUCLEAR OVERRIDE of Leaflet defaults */
.business-hover-tooltip .leaflet-popup-content-wrapper,
.leaflet-popup-content-wrapper.business-hover-tooltip {
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2) !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* KILL ALL LEAFLET CONTENT PADDING/MARGIN */
.business-hover-tooltip .leaflet-popup-content,
.leaflet-popup-content.business-hover-tooltip,
.business-hover-tooltip .leaflet-popup-content-wrapper .leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    width: 220px !important;
    max-width: 220px !important;
    min-width: 220px !important;
}

/* Override Leaflet's default .leaflet-popup-content style completely */
.leaflet-popup.business-hover-tooltip .leaflet-popup-content-wrapper .leaflet-popup-content {
    margin: 0 !important;
    padding: 0 !important;
}

.business-hover-tooltip .leaflet-popup-tip {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-top: none;
    border-right: none;
}

/* Business Info Panel Styles */
.dcs-business-info-panel {
    font-family: arial, sans-serif;
}

.dcs-business-info-panel h2,
.dcs-business-info-panel h3 {
    font-family: arial, sans-serif;
}

.dcs-business-info-panel .business-info-content {
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

.dcs-business-info-panel .business-info-content::-webkit-scrollbar {
    width: 8px;
}

.dcs-business-info-panel .business-info-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.dcs-business-info-panel .business-info-content::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.dcs-business-info-panel .business-info-content::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Business Marker Styles */
.dcs-business-marker {
    transition: all 0.3s ease;
}

.dcs-business-marker:hover {
    transform: scale(1.1);
}

/* Business List Item Styles */
.business-list-item {
    transition: background-color 0.2s ease;
}

.business-list-item:hover {
    background-color: #f5f5f5 !important;
}

/* Business Control Panel Styles */
.dcs-map-business-control {
    font-family: arial, sans-serif;
}

.dcs-map-business-control select,
.dcs-map-business-control input,
.dcs-map-business-control textarea,
.dcs-map-business-control button {
    font-family: arial, sans-serif;
}

/* Form Styling */
#create-business-form input,
#create-business-form select,
#create-business-form textarea {
    box-sizing: border-box;
}

#create-business-form button:hover {
    opacity: 0.9;
}

/* Business Status Messages */
#create-business-status {
    border-radius: 4px;
    font-size: 12px;
    line-height: 1.4;
}

/* Plot Selection Mode */
.dcs-map.plot-selection-mode {
    cursor: crosshair !important;
}

/* Business Info Panel Animation */
.dcs-business-info-panel {
    transition: all 0.3s ease;
}

/* Rating Stars */
.business-rating {
    color: #ffa500;
}

/* Business Type Icons */
.business-type-icon {
    font-size: 18px;
    margin-right: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dcs-business-info-panel {
        width: 100%;
        left: 0 !important;
        top: auto !important;
        bottom: 0 !important;
        transform: none !important;
        max-height: 50vh;
        border-radius: 12px 12px 0 0;
    }
    
    .dcs-map-business-control div[id$="-panel"] {
        min-width: 250px;
        max-width: calc(100vw - 40px);
    }
}

.leaflet-popup-content {
    margin: 12px 16px;
    line-height: 1.4;
}

/* Player tracking animation */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 16px rgba(76, 175, 80, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    }
}

/* Custom Leaflet Controls */
.dcs-map-search-control,
.dcs-map-layer-control,
.dcs-map-home-control,
.dcs-map-routing-control {
    background: transparent;
    border-radius: 8px;
    padding: 8px 12px;
    box-shadow: none;
    backdrop-filter: none;
    margin: 5px;
    border: none;
}

.dcs-map-search-control {
    display: flex;
    gap: 8px;
    align-items: center;
}

.dcs-map-search-control input {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    width: 180px;
}

.dcs-map-search-control button {
    padding: 6px 10px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.dcs-map-search-control button:hover {
    background: #3367d6;
}

.dcs-map-layer-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.dcs-map-layer-control label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    cursor: pointer;
    margin: 0;
}

.dcs-map-layer-control input[type="checkbox"] {
    margin: 0;
}

.dcs-map-home-control button {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 16px;
}

.dcs-map-home-control button:hover {
    background: rgba(240, 240, 240, 0.95);
}

/* Routing Control Styles */
.dcs-map-routing-control {
    min-width: 140px;
}

/* Road Creation Control Styles */
.dcs-map-road-creation-control {
    min-width: 140px;
    margin-bottom: 5px;
}

.dcs-map-road-creation-control button {
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    width: 100%;
    justify-content: center;
}

.dcs-map-road-creation-control button:hover {
    background: #3367d6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

.dcs-map-road-creation-control button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.road-point-marker {
    background: transparent !important;
    border: none !important;
}

#leaflet-routing-toggle {
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    width: 100%;
    justify-content: center;
}

#leaflet-routing-toggle:hover {
    background: #3367d6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.4);
}

#leaflet-routing-toggle:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.3);
}

#leaflet-routing-toggle:focus {
    outline: none;
    box-shadow: 0 2px 8px rgba(66, 133, 244, 0.3), 0 0 0 3px rgba(66, 133, 244, 0.2);
}

/* Custom Markers */
.dcs-leaflet-marker {
    background: transparent !important;
    border: none !important;
}

.dcs-marker-dot {
    width: 12px;
    height: 12px;
    background: #ea4335;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.dcs-leaflet-marker:hover .dcs-marker-dot {
    transform: scale(1.2);
    background: #fbbc04;
}

/* Marker Popup Styles */
.dcs-marker-popup h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #202124;
}

.dcs-marker-popup p {
    margin: 4px 0;
    font-size: 13px;
    color: #5f6368;
}

.dcs-map-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.dcs-map-search {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.dcs-map-search input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 200px;
}

.dcs-map-search button {
    padding: 8px 16px;
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.dcs-map-search button:hover {
    background: #3367d6;
}

.dcs-map-layers {
    display: flex;
    gap: 16px;
}

.dcs-map-layers label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    cursor: pointer;
}

.dcs-map-layers input[type="checkbox"] {
    margin: 0;
}

/* Zoom Controls */
.dcs-zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dcs-zoom-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ddd;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.dcs-zoom-btn:hover {
    background: rgba(240, 240, 240, 0.95);
}

.dcs-zoom-btn:active {
    transform: scale(0.95);
}

/* Map Elements */
.dcs-map-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #ea4335;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    transform: translate(-50%, -50%);
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    z-index: 100;
}

.dcs-map-marker:hover {
    transform: translate(-50%, -50%) scale(1.2);
    z-index: 101;
}

.dcs-map-marker.selected {
    background: #fbbc04;
    transform: translate(-50%, -50%) scale(1.3);
    z-index: 102;
}

.dcs-map-way {
    stroke: #4285f4;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.dcs-map-area {
    fill: white;
    stroke: #cccccc;
    stroke-width: 1;
}

/* Marker Info Panel */
.dcs-map-info {
    position: absolute;
    bottom: 10px;
    left: 10px;
    z-index: 1000;
    max-width: 300px;
}

.dcs-marker-info {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
}

.dcs-marker-info h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #202124;
}

.dcs-marker-info p {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #5f6368;
}

.dcs-marker-info .dcs-marker-detail {
    margin-bottom: 4px;
    font-size: 13px;
}

.dcs-marker-info .dcs-marker-detail strong {
    color: #202124;
}

/* Map Canvas */
.dcs-map-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
}

/* Loading State */
.dcs-map-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2000;
}

.dcs-map-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4285f4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

/* Error State */
.dcs-map-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    text-align: center;
    color: #ea4335;
    z-index: 2000;
}

/* Player Markers */
.dcs-player-marker {
    background: transparent !important;
    border: none !important;
    transition: all 0.5s ease-out;
}

.dcs-player-fade-in {
    animation: playerFadeIn 0.3s ease-in;
}

.dcs-player-fade-out {
    animation: playerFadeOut 0.3s ease-out forwards;
}

.dcs-player-moving .dcs-player-head img {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.4);
}

@keyframes playerFadeIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes playerFadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.5);
    }
}

.dcs-player-head {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.dcs-player-head img {
    width: 24px;
    height: 24px;
    border: 2px solid #fff;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    background: #f0f0f0;
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
}

.dcs-player-name {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 2px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dcs-map-controls {
        top: 5px;
        left: 5px;
        right: 5px;
        padding: 8px;
    }
    
    .dcs-map-search {
        flex-direction: column;
        gap: 8px;
    }
    
    .dcs-map-search input {
        width: 100%;
    }
    
    .dcs-zoom-controls {
        top: 5px;
        right: 5px;
    }
    
    .dcs-zoom-btn {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .dcs-map-info {
        bottom: 5px;
        left: 5px;
        right: 5px;
        max-width: none;
    }
    
    .dcs-marker-info {
        padding: 12px;
    }
}

/* Street Name Labels */
.street-label {
    z-index: 1000;
}

.street-name {
    transition: all 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.street-label .street-name:hover {
    background: rgba(255,255,255,0.9) !important;
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* City Labels (existing) */
.city-label {
    z-index: 900;
}

.city-name {
    transition: opacity 0.3s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* BlueMap Area Popup Styling */
.bluemap-area-popup .leaflet-popup-content-wrapper {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(33, 150, 243, 0.2);
    border: 2px solid rgba(33, 150, 243, 0.3);
}

.bluemap-area-popup .leaflet-popup-content {
    margin: 16px 20px;
    line-height: 1.4;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.bluemap-area-popup .leaflet-popup-tip {
    background: #ffffff;
    border: 2px solid rgba(33, 150, 243, 0.3);
    border-top: none;
    border-right: none;
}

/* Standard popup contrast */
.standard-popup .leaflet-popup-content-wrapper {
    background: #f8f9fa;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* BlueMap area hover effects */
.leaflet-interactive[data-bluemap="true"] {
    cursor: pointer;
    transition: all 0.2s ease;
}

.leaflet-interactive[data-bluemap="true"]:hover {
    opacity: 0.8;
    filter: brightness(1.1);
}