/* === FreakScene Leaflet Map === */

.map-page-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Header */
.map-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.map-header h1 {
    color: #90ee90;
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: -1px;
    margin: 0 0 0.3rem;
}

.map-header .map-subtitle {
    color: #4fff4f;
    opacity: 0.7;
    font-size: 0.85rem;
}

.map-nav-links {
    margin-top: 0.6rem;
    font-size: 0.85rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.map-nav-links a {
    color: #90ff90;
    text-decoration: underline;
}

.map-admin-link {
    color: #ffd700 !important;
    font-weight: 700;
    letter-spacing: 1px;
}

/* Search */
.map-search-wrap {
    text-align: center;
    margin-bottom: 1rem;
}

.map-search-input {
    padding: 0.5rem 0.8rem;
    width: 260px;
    max-width: 90%;
    background: #000;
    border: 2px solid #90ee90;
    color: #90ee90;
    font-family: inherit;
    font-size: 0.9rem;
}

.map-search-input::placeholder {
    color: #3a7a3a;
}

.map-search-input:focus {
    outline: none;
    border-color: #4fff4f;
    box-shadow: 0 0 8px rgba(144, 238, 144, 0.3);
}

/* Leaflet map container */
#map {
    width: 100%;
    height: 70vh;
    border: 2px solid #1a4a1a;
    background: #0d0d0d;
    margin-bottom: 1.5rem;
}

/* Square markers — remove default Leaflet icon styling */
.scene-square {
    background: transparent !important;
    border: none !important;
}

.scene-square div {
    cursor: pointer;
    transition: transform 0.15s;
}

.scene-square:hover div {
    transform: scale(1.4);
}

/* Green terminal filter on tiles */
#map .leaflet-tile-pane {
    filter: brightness(1.8) sepia(1) hue-rotate(80deg) saturate(3) brightness(0.6);
}

/* Dark theme overrides for Leaflet controls */
.leaflet-control-zoom a {
    background: #111 !important;
    color: #90ee90 !important;
    border-color: #1a4a1a !important;
}

.leaflet-control-zoom a:hover {
    background: #1a4a1a !important;
    color: #4fff4f !important;
}

/* Subtle attribution */
.leaflet-control-attribution {
    background: rgba(0, 0, 0, 0.6) !important;
    color: #3a7a3a !important;
    font-size: 0.6rem !important;
}

.leaflet-control-attribution a {
    color: #3a7a3a !important;
}

/* Scene popup (click/tap) */
.scene-popup-wrap .leaflet-popup-content-wrapper {
    background: #000 !important;
    border: 1px solid #90ee90 !important;
    border-radius: 0 !important;
    box-shadow: 0 0 12px rgba(144, 238, 144, 0.25) !important;
}

.scene-popup-wrap .leaflet-popup-tip {
    background: #000 !important;
    border: 1px solid #90ee90 !important;
    border-top: none !important;
    border-left: none !important;
}

.scene-popup-wrap .leaflet-popup-content {
    margin: 8px 10px !important;
    color: #90ee90 !important;
    font-family: 'Consolas', 'Menlo', 'Monaco', 'Courier New', monospace !important;
    font-size: 0.8rem !important;
}

.scene-popup strong {
    font-size: 0.9rem;
}

.scene-popup-count {
    opacity: 0.6;
    font-size: 0.75rem;
}

.scene-popup-link {
    display: block;
    margin-top: 6px;
    padding: 5px 0;
    color: #4fff4f !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.85rem;
}

.scene-popup-link:hover {
    text-decoration: underline;
}

/* Request a Scene CTA */
.map-request-scene {
    text-align: center;
    padding: 0.8rem 0;
    margin-bottom: 1rem;
}

.map-request-scene a {
    color: #90ee90;
    font-size: 0.9rem;
    text-decoration: none;
    border: 1px solid #1a4a1a;
    padding: 0.5rem 1.2rem;
    transition: background 0.15s, border-color 0.15s;
}

.map-request-scene a:hover {
    background: rgba(144, 238, 144, 0.1);
    border-color: #90ee90;
}

/* Legend */
.map-legend {
    border: 1px solid #1a4a1a;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.map-legend h3 {
    color: #90ee90;
    font-size: 0.9rem;
    margin: 0 0 0.75rem;
    font-weight: 700;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.4rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: #c8f5c8;
    text-decoration: none;
    transition: background 0.15s, opacity 0.2s;
}

.legend-item:hover {
    background: rgba(144, 238, 144, 0.08);
}

.legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-count {
    opacity: 0.5;
    font-size: 0.7rem;
    margin-left: auto;
}

/* Unplotted scenes section */
.map-unplotted {
    border: 1px solid #1a4a1a;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.map-unplotted h3 {
    color: #3a7a3a;
    font-size: 0.8rem;
    margin: 0 0 0.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.unplotted-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.unplotted-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    color: #3a7a3a;
    text-decoration: none;
    border: 1px solid #1a4a1a;
    transition: color 0.15s, border-color 0.15s;
}

.unplotted-item:hover {
    color: #90ee90;
    border-color: #3a7a3a;
}

/* Stats line */
.map-stats {
    text-align: center;
    font-size: 0.8rem;
    color: #3a7a3a;
    margin-bottom: 1rem;
}

.map-stats span {
    color: #90ee90;
}

/* Mobile */
@media (max-width: 768px) {
    .map-page-container {
        padding: 1rem 0.5rem;
        padding-bottom: 80px; /* room for mobile nav */
    }

    .map-header {
        margin-bottom: 1rem;
    }

    .map-header h1 {
        font-size: 1.6rem;
    }

    .map-header .map-subtitle {
        font-size: 0.75rem;
    }

    .map-nav-links {
        font-size: 0.8rem;
        gap: 0.7rem;
    }

    .map-stats {
        font-size: 0.75rem;
        margin-bottom: 0.6rem;
    }

    .map-search-input {
        width: 100%;
        max-width: 100%;
        font-size: 1rem; /* prevents iOS zoom */
        padding: 0.6rem 0.8rem;
    }

    .map-search-wrap {
        margin-bottom: 0.6rem;
    }

    #map {
        height: 55vh;
        border-width: 1px;
        margin-bottom: 0.8rem;
    }

    .map-request-scene {
        padding: 0.5rem 0;
        margin-bottom: 0.8rem;
    }

    .map-request-scene a {
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem;
        display: block;
    }

    .map-legend {
        padding: 0.7rem;
        margin-bottom: 1rem;
    }

    .map-legend h3 {
        font-size: 0.8rem;
        margin-bottom: 0.5rem;
    }

    .legend-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.2rem;
    }

    .legend-item {
        padding: 0.4rem;
        font-size: 0.75rem;
        min-height: 36px; /* touch target */
    }

    .map-unplotted {
        padding: 0.7rem;
        margin-bottom: 1rem;
    }

    .unplotted-grid {
        gap: 0.4rem;
    }

    .unplotted-item {
        padding: 0.3rem 0.5rem;
        min-height: 32px;
        align-items: center;
    }

    /* Bigger squares on mobile for easier tapping */
    .scene-square div {
        min-width: 14px !important;
        min-height: 14px !important;
    }
}

@media (max-width: 400px) {
    .map-header h1 {
        font-size: 1.3rem;
    }

    #map {
        height: 45vh;
    }

    .legend-grid {
        grid-template-columns: 1fr 1fr;
    }
}
