:root {
    --primary-color: #8a2be2;
    --secondary-color: #00bfff;
    --accent-color: #ff1493;
    --background-dark: #0a0a20;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--background-dark), #000);
    color: white;
    overflow: hidden;
    height: 100vh;
}

#map-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* Map legend box - updated with collapse functionality */
#map-legend {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 600px;
    height: 480px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 10px;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

/* Header section for the map legend */
.map-legend-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--glass-border);
}

.map-legend-header h3 {
    margin: 0;
    color: var(--secondary-color);
    font-size: 1rem;
}

/* Collapse button */
.collapse-button {
    background: none;
    border: none;
    color: var(--secondary-color);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.collapse-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Collapsed state */
#map-legend.collapsed {
    height: 45px; /* Just enough for the header */
    padding-bottom: 5px;
}

#map-legend.collapsed .map-container {
    display: none;
}

/* Rotate collapse button icon when collapsed */
.collapse-button .icon {
    transition: transform 0.3s ease;
}

#map-legend.collapsed .collapse-button .icon {
    transform: rotate(180deg);
}

/* SVG map styles - added transform origin */
#svg-map {
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: all;
    background-color: transparent;
    transform-origin: center;
    transition: transform 0.3s ease;
}

#three-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.info-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 300px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 20px;
    color: white;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.info-panel h2 {
    margin-bottom: 15px;
    color: var(--secondary-color);
    font-size: 1.5rem;
}

.info-panel p {
    margin-bottom: 10px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.map-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    z-index: 10;
    display: flex;
    gap: 10px;
}

button {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background-dark);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 1s ease;
}

.loading-screen h1 {
    font-size: 3rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-color);
}

.loading-progress {
    width: 300px;
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.7);
}

.credit {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    z-index: 10;
}

/* Styles for transparent SVG map */
.svg-interactive {
    pointer-events: all;
    cursor: pointer;
}

.svg-non-interactive {
    pointer-events: none;
}

/* Styling for map areas to be more transparent */
.main-continent {
    fill-opacity: 0.4;
    stroke-opacity: 0.6;
}

.location {
    fill-opacity: 0.5;
    stroke-opacity: 0.7;
    transition: fill-opacity 0.3s ease, stroke-opacity 0.3s ease, stroke-width 0.3s ease;
}

.location:hover {
    fill-opacity: 0.7;
    stroke-opacity: 1;
}

/* Make SVG text more visible against transparent bg */
#svg-map text {
    text-shadow: 0px 0px 3px rgba(0, 0, 0, 0.8);
    font-weight: 500;
    font-size: 10px; /* Smaller text for the legend */
}

/* Tooltip for hovering over locations */
#map-tooltip {
    pointer-events: none;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.5));
}

/* Style for the connections between landmarks */
.landmark-group line {
    stroke-dasharray: 5, 5;
    animation: dash 20s linear infinite;
}

@keyframes dash {
    to {
        stroke-dashoffset: 1000;
    }
}

/* Toggle button for the legend */
#toggle-legend {
    position: absolute;
    bottom: 280px;
    right: 20px;
    z-index: 10;
}

/* Container for the map and zoom controls */
.map-container {
    position: relative;
    flex: 1;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Update responsive styles for expanded state */
@media (max-width: 768px) {
    .info-panel {
        width: calc(100% - 40px);
        top: 10px;
        max-height: 30vh;
        overflow-y: auto;
    }
    
    #map-legend {
        width: 200px;
        height: 160px;
        bottom: 70px;
    }
    
    #map-legend.expanded {
        width: calc(100% - 40px);
        height: 30vh;
        right: 20px;
        bottom: 70px;
    }
    
    .map-controls {
        left: 10px;
        bottom: 10px;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    button {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* Enhanced CSS for 3D location labels */
.location-label {
    position: absolute;
    z-index: 5;
    pointer-events: all;
    transform: translate(-50%, -100%);
    transition: all 0.3s ease;
}

.label-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform 0.3s ease;
}

.label-text {
    background-color: rgba(10, 10, 32, 0.8);
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    backdrop-filter: blur(4px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 2px 8px rgba(138, 43, 226, 0.2),
                0 0 15px rgba(138, 43, 226, 0.2);
    cursor: pointer;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px rgba(138, 43, 226, 0.5);
}

.label-text:hover {
    background-color: rgba(138, 43, 226, 0.8);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.4),
                0 0 30px rgba(138, 43, 226, 0.3);
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
}

.label-connector {
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, 
        rgba(138, 43, 226, 0.8),
        rgba(138, 43, 226, 0));
    margin-top: 2px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 0 5px rgba(138, 43, 226, 0.5));
}

/* Pulsing animation for highlighted labels */
@keyframes label-glow {
    0% {
        box-shadow: 0 0 15px rgba(138, 43, 226, 0.3),
                   0 0 30px rgba(138, 43, 226, 0.2);
    }
    50% {
        box-shadow: 0 0 25px rgba(138, 43, 226, 0.5),
                   0 0 50px rgba(138, 43, 226, 0.3);
    }
    100% {
        box-shadow: 0 0 15px rgba(138, 43, 226, 0.3),
                   0 0 30px rgba(138, 43, 226, 0.2);
    }
}

@keyframes connector-glow {
    0% {
        filter: drop-shadow(0 0 3px rgba(138, 43, 226, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 8px rgba(138, 43, 226, 0.8));
    }
    100% {
        filter: drop-shadow(0 0 3px rgba(138, 43, 226, 0.5));
    }
}

/* Apply animations to highlighted labels */
.label-highlighted .label-text {
    background-color: rgba(138, 43, 226, 0.8);
    animation: label-glow 2s infinite;
}

.label-highlighted .label-connector {
    background: linear-gradient(to bottom, 
        rgba(138, 43, 226, 1),
        rgba(138, 43, 226, 0));
    animation: connector-glow 2s infinite;
}

/* Hover effect for the entire label group */
.location-label:hover .label-content {
    transform: translateY(-5px);
}

.location-label:hover .label-connector {
    height: 25px;
    background: linear-gradient(to bottom, 
        rgba(138, 43, 226, 1),
        rgba(138, 43, 226, 0));
    filter: drop-shadow(0 0 8px rgba(138, 43, 226, 0.8));
}

/* Make sure labels don't interfere with other UI elements */
#map-legend {
    z-index: 20; /* Higher than labels */
}

.info-panel {
    z-index: 20; /* Higher than labels */
}

/* Map legend list styles */
.location-list {
    overflow-y: auto;
    max-height: 410px;
    padding: 5px;
}

.location-category {
    margin-bottom: 15px;
}

.location-category h4 {
    color: var(--secondary-color);
    font-size: 0.9rem;
    margin: 0 0 8px 0;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--glass-border);
}

.location-description {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 10px;
    line-height: 1.3;
}

.location-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.location-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.location-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
    transform: translateX(3px);
}

.location-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.5);
}

.location-name {
    font-size: 0.9rem;
    white-space: normal;
    line-height: 1.2;
}

/* Selected location state */
.location-item.selected {
    background-color: rgba(138, 43, 226, 0.3);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.3);
}

/* Back link */
.back-link {
    margin-bottom: 15px;
}

.back-link a {
    color: var(--secondary-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    display: inline-block;
}

.back-link a:hover {
    color: var(--accent-color);
    transform: translateX(-3px);
}

/* Selected location highlight */
.selected-location {
    padding: 10px;
    border-radius: 8px;
    background-color: rgba(138, 43, 226, 0.1);
    border-left: 3px solid var(--primary-color);
}

/* Landmarks category */
.landmarks-category {
    margin-top: 15px;
    padding-left: 10px;
}

/* Make room for scrollbar */
#map-legend .map-container {
    padding-right: 5px;
}

/* Compact map legend styles */
.compact-legend {
    width: 280px !important;
    height: 320px !important;
}

.compact-legend .map-legend-header h3 {
    font-size: 0.9rem;
}

.compact-legend .location-list {
    max-height: 270px;
    padding: 3px;
}

.compact-legend .location-category h4 {
    font-size: 0.8rem;
    margin: 0 0 4px 0;
    padding-bottom: 2px;
}

.compact-legend .location-item {
    padding: 4px 6px;
    margin-bottom: 3px;
}

.compact-legend .location-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    margin-right: 6px;
}

.compact-legend .location-name {
    font-size: 0.8rem;
    line-height: 1.1;
}

.compact-legend .location-description {
    font-size: 0.75rem;
    margin-bottom: 6px;
    line-height: 1.2;
}

.compact-legend .back-link {
    margin-bottom: 8px;
}

.compact-legend .back-link a {
    font-size: 0.8rem;
}

.compact-legend .location-category {
    margin-bottom: 8px;
}

.compact-legend .selected-location {
    padding: 6px;
}

.compact-legend .landmarks-category {
    margin-top: 8px;
    padding-left: 5px;
}

/* Collapsed state for compact legend */
.compact-legend.collapsed {
    height: 35px !important;
}

.landmark-detail-panel h3 {
    color: var(--secondary-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.landmark-detail-panel p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0;
}

.landmark-detail-content {
    max-height: 200px;
    overflow-y: auto;
    padding-right: 5px;
}
