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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #1a0033 0%, #0d0021 100%);
    padding: 20px;
    text-align: center;
    border-bottom: 3px solid #4a0080;
    box-shadow: 0 4px 20px rgba(138, 43, 226, 0.3);
}

.header h1 {
    font-size: 2.5em;
    color: #b19cd9;
    text-shadow: 0 0 20px rgba(138, 43, 226, 0.8), 0 0 40px rgba(138, 43, 226, 0.4);
    margin-bottom: 10px;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.1em;
    color: #9b87c7;
    font-style: italic;
}

.info-panel {
    background: rgba(20, 20, 30, 0.95);
    padding: 15px 20px;
    border-bottom: 2px solid #4a0080;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.stats {
    font-size: 1.2em;
    color: #b19cd9;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.6);
}

#location-count {
    color: #da70d6;
    font-size: 1.3em;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-section label {
    color: #b19cd9;
    font-weight: 500;
    font-size: 0.95em;
}

input[type="text"],
select {
    padding: 8px 12px;
    border: 2px solid #4a0080;
    border-radius: 5px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-size: 0.95em;
    transition: all 0.3s ease;
}

input[type="text"]:focus,
select:focus {
    outline: none;
    border-color: #8a2be2;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.5);
    background: #252540;
}

input[type="text"] {
    min-width: 250px;
}

select {
    min-width: 180px;
    cursor: pointer;
}

select option {
    background: #1a1a2e;
    color: #e0e0e0;
}

/* Sound button */
.sound-btn {
    padding: 8px 16px;
    background: rgba(20, 20, 30, 0.95);
    border: 2px solid #4a0080;
    border-radius: 5px;
    color: #b19cd9;
    font-size: 0.95em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sound-btn:hover {
    background: rgba(138, 43, 226, 0.2);
    border-color: #8a2be2;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.5);
}

#map {
    height: calc(100vh - 190px);
    width: 100%;
    position: relative;
    border-top: 1px solid #4a0080;
}

.legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(10, 10, 20, 0.95);
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #4a0080;
    z-index: 1000;
    max-height: 500px;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.4);
}

.legend h3 {
    color: #b19cd9;
    margin-bottom: 12px;
    font-size: 1.1em;
    border-bottom: 2px solid #4a0080;
    padding-bottom: 8px;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.6);
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    font-size: 0.9em;
    color: #d0d0d0;
}

.legend-item .marker {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid #fff;
    flex-shrink: 0;
}

/* Category colors */
.marker.haunted-house { background-color: #8B0000; box-shadow: 0 0 8px #8B0000; }
.marker.haunted-hotel { background-color: #DC143C; box-shadow: 0 0 8px #DC143C; }
.marker.haunted-hospital { background-color: #800080; box-shadow: 0 0 8px #800080; }
.marker.haunted-castle { background-color: #4B0082; box-shadow: 0 0 8px #4B0082; }
.marker.haunted-cemetery { background-color: #2F4F4F; box-shadow: 0 0 8px #2F4F4F; }
.marker.haunted-prison { background-color: #1C1C1C; box-shadow: 0 0 8px #666; }
.marker.haunted-ship { background-color: #000080; box-shadow: 0 0 8px #000080; }
.marker.haunted-theater { background-color: #8B008B; box-shadow: 0 0 8px #8B008B; }
.marker.haunted-church { background-color: #483D8B; box-shadow: 0 0 8px #483D8B; }
.marker.haunted-school { background-color: #654321; box-shadow: 0 0 8px #654321; }
.marker.haunted-forest { background-color: #228B22; box-shadow: 0 0 8px #228B22; }
.marker.poltergeist { background-color: #FF4500; box-shadow: 0 0 8px #FF4500; }
.marker.ufo-phenomenon { background-color: #00CED1; box-shadow: 0 0 8px #00CED1; }
.marker.cryptid { background-color: #9ACD32; box-shadow: 0 0 8px #9ACD32; }
.marker.cursed-object { background-color: #FF00FF; box-shadow: 0 0 8px #FF00FF; }
.marker.ghost-tours { background-color: #FFD700; box-shadow: 0 0 8px #FFD700; }

/* Popup styling */
.leaflet-popup-content-wrapper {
    background: rgba(10, 10, 20, 0.98);
    color: #e0e0e0;
    border: 2px solid #4a0080;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.6);
}

.leaflet-popup-tip {
    background: rgba(10, 10, 20, 0.98);
    border: 2px solid #4a0080;
}

.popup-content h3 {
    color: #da70d6;
    margin-bottom: 8px;
    font-size: 1.3em;
    text-shadow: 0 0 10px rgba(218, 112, 214, 0.6);
    border-bottom: 2px solid #4a0080;
    padding-bottom: 6px;
}

.location-tag {
    color: #9b87c7;
    font-size: 0.9em;
    font-style: italic;
    margin-bottom: 10px;
}

.activity-level {
    background: rgba(138, 43, 226, 0.2);
    padding: 5px 10px;
    border-radius: 5px;
    margin-bottom: 10px;
    border-left: 3px solid #8a2be2;
}

.activity-level strong {
    color: #ff6b6b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.popup-content p {
    margin: 8px 0;
    line-height: 1.6;
    font-size: 0.95em;
}

.popup-content strong {
    color: #b19cd9;
}

.popup-content a {
    color: #da70d6;
    text-decoration: none;
}

.popup-content a:hover {
    color: #ff6bff;
    text-decoration: underline;
}

/* Popup buttons */
.read-more-btn,
.share-btn {
    padding: 8px 16px;
    margin: 5px 5px 5px 0;
    background: rgba(138, 43, 226, 0.3);
    border: 2px solid #8a2be2;
    border-radius: 5px;
    color: #e0e0e0;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.read-more-btn:hover,
.share-btn:hover {
    background: rgba(138, 43, 226, 0.5);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.7);
    transform: translateY(-2px);
}

/* Stories panel */
.stories-panel {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    background: rgba(10, 10, 20, 0.98);
    border: 3px solid #4a0080;
    border-radius: 12px;
    padding: 30px;
    z-index: 10000;
    overflow-y: auto;
    box-shadow: 0 0 50px rgba(138, 43, 226, 0.8);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.stories-panel h2 {
    color: #da70d6;
    font-size: 2em;
    margin-bottom: 10px;
    text-shadow: 0 0 15px rgba(218, 112, 214, 0.8);
}

.stories-panel h3 {
    color: #b19cd9;
    font-size: 1.3em;
    margin-top: 20px;
    margin-bottom: 10px;
    border-bottom: 2px solid #4a0080;
    padding-bottom: 5px;
}

.stories-panel p {
    line-height: 1.8;
    margin-bottom: 15px;
    color: #d0d0d0;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: rgba(138, 43, 226, 0.3);
    border: 2px solid #8a2be2;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5em;
    color: #e0e0e0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(138, 43, 226, 0.6);
    transform: rotate(90deg);
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.8);
}

/* Scrollbar styling for legend and stories */
.legend::-webkit-scrollbar,
.stories-panel::-webkit-scrollbar {
    width: 8px;
}

.legend::-webkit-scrollbar-track,
.stories-panel::-webkit-scrollbar-track {
    background: rgba(20, 20, 30, 0.5);
    border-radius: 4px;
}

.legend::-webkit-scrollbar-thumb,
.stories-panel::-webkit-scrollbar-thumb {
    background: #4a0080;
    border-radius: 4px;
}

.legend::-webkit-scrollbar-thumb:hover,
.stories-panel::-webkit-scrollbar-thumb:hover {
    background: #6a00a0;
}

/* Custom marker animation */
.custom-marker div {
    animation: pulse 2s infinite;
}

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

/* Responsive design */
@media (max-width: 1400px) {
    .info-panel {
        gap: 10px;
    }

    select {
        min-width: 150px;
    }
}

@media (max-width: 1024px) {
    .info-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    input[type="text"],
    select {
        width: 100%;
    }

    .legend {
        max-height: 300px;
        font-size: 0.85em;
    }

    .header h1 {
        font-size: 1.8em;
    }

    .stories-panel {
        width: 95%;
        padding: 20px;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 1.5em;
    }

    .subtitle {
        font-size: 0.9em;
    }

    .legend {
        bottom: 10px;
        right: 10px;
        left: 10px;
        max-height: 200px;
    }

    #map {
        height: calc(100vh - 280px);
    }

    .stories-panel {
        max-height: 90vh;
        padding: 15px;
    }

    .stories-panel h2 {
        font-size: 1.5em;
    }
}

/* Leaflet overrides for dark theme */
.leaflet-control-zoom a {
    background-color: rgba(10, 10, 20, 0.9);
    color: #b19cd9;
    border: 1px solid #4a0080;
}

.leaflet-control-zoom a:hover {
    background-color: rgba(30, 30, 50, 0.9);
    color: #da70d6;
}

.leaflet-bar {
    border: 2px solid #4a0080;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.4);
}

/* Loading animation */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

body {
    animation: fadeIn 0.5s ease-in;
}

/* Hover effects for interactive elements */
button {
    transition: all 0.3s ease;
}

button:active {
    transform: scale(0.95);
}

/* Special ghost glow effect */
.header h1:hover {
    text-shadow: 0 0 30px rgba(138, 43, 226, 1), 0 0 60px rgba(138, 43, 226, 0.6);
}

/* Image placeholders in stories */
.stories-panel img {
    border: 2px solid #4a0080;
    box-shadow: 0 0 20px rgba(138, 43, 226, 0.4);
}
