/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #1a1a2e;
    color: #e0e0e0;
}

/* === Floating Top Bar === */
.top-bar {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(22, 33, 62, 0.85);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    border: 1px solid #334155;
    padding: 6px 12px;
}

.top-bar .stats {
    font-size: 0.85em;
    color: #e2e8f0;
    white-space: nowrap;
}

.toggle-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #475569;
    border-radius: 6px;
    background: #334155;
    color: #94a3b8;
    font-size: 1.1em;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn:hover,
.toggle-btn:active {
    background: #475569;
    color: #e2e8f0;
}

.toggle-btn.active {
    background: #4ade80;
    color: #0f172a;
    border-color: #4ade80;
}

/* === Map === */
#map {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #5A9FE6 0%, #3A78C0 100%);
}

/* === Detail Panel === */
.detail-panel {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    width: 340px;
    max-height: calc(100vh - 24px);
    background: rgba(22, 33, 62, 0.95);
    border-radius: 12px;
    border: 1px solid #334155;
    padding: 18px 18px 10px 18px;
    z-index: 1000;
    overflow-y: auto;
    backdrop-filter: blur(10px);
}

.detail-panel.visible {
    display: block;
}

.detail-panel .detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.detail-panel .detail-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1em;
    font-weight: 700;
    color: #4ade80;
}

.detail-title-icon {
    flex-shrink: 0;
}

.detail-panel .detail-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.2em;
    cursor: pointer;
    padding: 0 4px;
}

.detail-panel .detail-close:hover {
    color: #e2e8f0;
}

.detail-panel .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
    font-size: 0.85em;
}

.detail-panel .detail-label {
    color: #64748b;
}

.detail-panel .detail-value {
    color: #e2e8f0;
    font-weight: 500;
}

.detail-footer {
    display: flex;
    justify-content: space-between;
    font-size: 0.8em;
    color: #7f8698;
    padding-top: 2px;
}
.detail-footer a {
    color: inherit;
    text-decoration: none;
}
.detail-footer a:hover {
    text-decoration: underline;
}

/* === Map Markers === */
.cache-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    transition: transform 0.2s;
}

.zoom-close .cache-marker { font-size: 32px; }
.zoom-mid .cache-marker { font-size: 18px; }
.zoom-far .cache-marker { font-size: 12px; }

.cache-icon-img {
    width: 1em;
    height: 1em;
    vertical-align: middle;
}

.cache-marker:hover {
    transform: scale(1.3);
}

.cache-marker.labeled {
    flex-direction: column;
    overflow: visible;
}

.marker-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    line-height: 1.3;
    font-weight: 600;
    color: #1e293b;
    background: rgba(255, 255, 255, 0.85);
    padding: 2px 5px;
    border-radius: 3px;
    text-align: center;
    white-space: normal !important;
    width: max-content;
    max-width: 200px !important;
    margin-top: 0;
    filter: none;
}

.cache-marker.selected {
    transform: scale(1.4);
    filter: drop-shadow(0 0 10px #de564a) drop-shadow(0 0 15px #de564a);
}

/* === Detail Photo === */
.detail-photo-wrap {
    position: relative;
    margin-bottom: 12px;
}

.detail-photo {
    width: 100%;
    border-radius: 8px;
    display: block;
    object-fit: cover;
    object-position: center;
    aspect-ratio: 3 / 4;
}

.detail-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 48px;
    border: none;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 1.4em;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: background 0.2s;
}

.detail-nav:hover,
.detail-nav:active {
    background: rgba(0, 0, 0, 0.7);
}

.detail-nav-prev {
    left: 0;
    border-radius: 0 6px 6px 0;
}

.detail-nav-next {
    right: 0;
    border-radius: 6px 0 0 6px;
}

/* === Scroll Fade (applied via JS only when content overflows) === */
.detail-panel.scrollable::after {
    content: '';
    position: sticky;
    bottom: -20px;
    left: 0;
    display: block;
    height: 30px;
    margin: 0 -20px;
    background: linear-gradient(transparent, rgba(22, 33, 62, 0.95));
    pointer-events: none;
    border-radius: 0 0 12px 12px;
}

/* === Responsive === */
@media (max-width: 768px) {
    .detail-panel {
        width: calc(100% - 24px);
        max-height: 50vh;
    }

    .detail-photo {
        width: 80%;
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-height: 500px) {
    .detail-panel {
        max-height: calc(100vh - 24px);
    }

    .detail-photo {
        width: 80%;
        margin-left: auto;
        margin-right: auto;
    }
}
