.map-page {
    background: #000;
    color: #fff;
    min-height: 100vh;
    font-family: 'Monolisa', sans-serif;
}

.map-shell {
    height: calc(100svh - var(--navbar-height, 64px));
    width: 100%;
    overflow: hidden;
}

.map-stage {
    position: relative;
    width: 100%;
    height: 100%;
}

.map-viewport {
    position: absolute;
    inset: 0;
    border-top: 1px solid #111;
    background: #050505;
    overflow: auto;
    cursor: grab;
    touch-action: none;
}

.map-viewport.is-dragging {
    cursor: grabbing;
}

.map-viewport::-webkit-scrollbar {
    width: 0;
    height: 0;
}

.map-viewport {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.map-tiles {
    position: relative;
    width: 0;
    height: 0;
}

.map-tile {
    position: absolute;
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.map-source {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Sidebar - Adapted from lore.css */
.side-menu {
    position: fixed;
    top: 64px; /* Account for main navbar */
    left: 0;
    height: calc(100vh - 64px);
    width: 64px; /* Collapsed width */
    z-index: 900; /* Below navbar (1000) */
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease, border-color 0.3s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    background: inherit;
}

.side-menu:hover {
    width: 280px; /* Expanded width */
    box-shadow: 4px 0 25px rgba(0, 0, 0, 0.3);
}

.side-menu-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 280px;
    background: inherit;
}

/* Header */
.side-menu-header {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 0 0 16px; /* Align icon with sidebar center */
    flex-shrink: 0;
    border-bottom: 1px solid transparent;
}

.side-menu-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.side-menu-title {
    margin-left: 16px;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
}

.side-menu:hover .side-menu-title {
    opacity: 1;
    transform: translateX(0);
    transition-delay: 0.1s;
}

.side-menu-title h1 {
    font-family: 'Protest Regular', sans-serif;
    font-size: 1.2rem;
    margin: 0;
    line-height: 1;
}

.side-menu-title p {
    font-size: 0.75rem;
    opacity: 0.7;
    margin: 4px 0 0 0;
    line-height: 1.2;
    white-space: normal;
}

/* Content */
.side-menu-toc {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
    opacity: 0;
    transition: opacity 0.2s ease;
    scrollbar-width: thin;
}

.side-menu:hover .side-menu-toc {
    opacity: 1;
    transition-delay: 0.1s;
}

.side-menu-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #737373;
    margin: 1.5rem 1.5rem 0.5rem 1.5rem;
    font-weight: 600;
}

.side-menu-section-title:first-child {
    margin-top: 0;
}

/* Footer */
.side-menu-footer {
    padding: 1rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.theme-toggle {
    display: flex;
    align-items: center;
    padding: 10px 0 10px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    width: 100%;
    transition: background-color 0.2s ease;
    color: #a3a3a3;
}

.theme-toggle:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.theme-icon {
    width: 32px;
    display: flex;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.theme-label {
    margin-left: 16px;
    opacity: 0;
    white-space: nowrap;
    font-size: 0.9rem;
    transition: opacity 0.2s ease;
}

.side-menu:hover .theme-label {
    opacity: 1;
    transition-delay: 0.1s;
}

/* Mobile Toggle */
.mobile-menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    .side-menu {
        width: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .side-menu.mobile-open {
        width: 280px;
        transform: translateX(0);
    }
    
    .side-menu.mobile-open .side-menu-title,
    .side-menu.mobile-open .side-menu-toc,
    .side-menu.mobile-open .theme-label {
        opacity: 1;
        transform: none;
    }

    .mobile-menu-toggle {
        display: flex;
        position: fixed;
        top: calc(var(--navbar-height, 64px) + 10px);
        left: 15px;
        z-index: 200;
        background: rgba(0,0,0,0.8);
        color: white;
        padding: 8px 12px;
        border-radius: 4px;
        cursor: pointer;
        border: none;
    }
}

.map-shell {
    padding-left: 64px;
    transition: padding-left 0.3s ease;
}

@media (max-width: 768px) {
    .map-shell {
        padding-left: 0;
    }
}

/* Map specific controls */
.map-mode-item {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 0;
    transition: all 0.2s ease;
    overflow: hidden;
    position: relative;
}

.map-mode-header {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    outline: none;
    user-select: none;
}

.map-mode-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.map-mode-item.active-mode .map-mode-header {
    background: rgba(255, 255, 255, 0.08);
}

.mode-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    font-size: 1rem;
    color: #a3a3a3;
    transition: color 0.2s ease;
}

.map-mode-item.active-mode .mode-icon {
    color: #fff;
}

.mode-name {
    font-size: 0.95rem;
    font-weight: 500;
    flex: 1;
    color: #d4d4d4;
    transition: color 0.2s ease;
}

.map-mode-item.active-mode .mode-name {
    color: #fff;
    font-weight: 600;
}

.dropdown-icon {
    font-size: 0.8rem;
    color: #737373;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.map-mode-item.expanded .dropdown-icon {
    transform: rotate(180deg);
    color: #fff;
}

/* Dropdown Content */
.map-mode-settings {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.2s ease-out, margin 0.2s ease;
}

.map-mode-item.expanded .map-mode-settings {
    max-height: 300px; /* Increased to accommodate Select button */
    opacity: 1;
    margin-bottom: 0.5rem;
    transition: max-height 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.2s ease-in, margin 0.2s ease;
}

.control-group {
    padding: 0 1rem 0.5rem 1rem;
}

/* Select Mode Button */
.select-mode-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #e5e5e5;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.select-mode-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.map-mode-item.active-mode .select-mode-btn {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
    cursor: default;
}

.select-mode-btn .btn-icon {
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.map-mode-item.active-mode .select-mode-btn .btn-icon {
    opacity: 1;
    transform: scale(1);
}


.control-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #737373;
    margin-bottom: 0.5rem;
    margin-top: 0.5rem;
    font-weight: 600;
}

.placeholder-text {
    font-size: 0.85rem;
    color: #737373;
    font-style: italic;
    margin: 0;
}

.map-zoom-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.zoom-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #e5e5e5;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    font-size: 0.8rem;
}

.zoom-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    transform: translateY(-1px);
}

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

.zoom-slider-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    height: 28px;
}

#zoom-range {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

#zoom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s ease;
}

#zoom-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.zoom-value-tooltip {
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    color: #000;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.zoom-value-tooltip::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px 4px 0;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
}

.zoom-slider-container:hover .zoom-value-tooltip,
.zoom-slider-container:focus-within .zoom-value-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-5px);
}

/* Nav Button Styles */
.nav-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    width: 100%;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.5);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: #fff;
}
