/**
 * xiaoten-footprintmap - Footprint Map Styles
 * Version: 1.2.0
 * License: MIT
 * Description: Styles for Hugo footprint map shortcode with AMap integration
 */

/* Map Container */
.footprint-map {
    width: 100%;
    min-height: 420px;
    border-radius: 12px;
    overflow: hidden;
    margin: 1.5rem 0;
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
}

.dark .footprint-map {
    border-color: rgba(255, 255, 255, 0.1);
}

/* Loading & Error States */
.footprint-map__loading,
.footprint-map__error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.92);
    color: #666;
    z-index: 2;
}

.dark .footprint-map__loading,
.dark .footprint-map__error {
    background: rgba(0, 0, 0, 0.6);
    color: #aaa;
}

.footprint-map__canvas {
    width: 100%;
    height: 100%;
}

.footprint-map:not(.footprint-map--loading) .footprint-map__loading {
    display: none;
}

/* Markers */
.footprint-marker {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid #fff;
    background: linear-gradient(135deg, #ffb347, #ff6f61);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.dark .footprint-marker {
    border-color: rgba(0, 0, 0, 0.35);
}

.footprint-marker--sunset {
    background: linear-gradient(135deg, #ffb347, #ff6f61);
}

.footprint-marker--ocean {
    background: linear-gradient(135deg, #06beb6, #48b1bf);
}

.footprint-marker--violet {
    background: linear-gradient(135deg, #a18cd1, #fbc2eb);
}

.footprint-marker--forest {
    background: linear-gradient(135deg, #5ee7df, #39a37c);
}

.footprint-marker--amber {
    background: linear-gradient(135deg, #f6d365, #fda085);
}

.footprint-marker--citrus {
    background: linear-gradient(135deg, #fdfb8f, #a1ffce);
}

@media (max-width: 640px) {
    .footprint-marker {
        width: 18px;
        height: 18px;
    }
}

/* Category Filters */
.footprint-map__filters {
    position: absolute;
    top: 6px;
    left: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
    z-index: 3;
    max-width: calc(100% - 24px);
}

.dark .footprint-map__filters {
    background: rgba(33, 35, 40, 0.85);
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.footprint-map__filter-btn {
    border: none;
    background: transparent;
    color: #333;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: 18px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}

.footprint-map__filter-btn.is-active {
    background: #111826;
    color: #fff;
}

.dark .footprint-map__filter-btn {
    color: #e0e0e0;
}

.dark .footprint-map__filter-btn.is-active {
    background: #f7f7f7;
    color: #111;
}

@media (max-width: 640px) {
    .footprint-map__filters {
        max-height: 120px;
        overflow-y: auto;
        gap: 6px;
        border-radius: 12px;
        padding: 6px;
    }
}

/* Info Popup */
.footprint-popup {
    width: 260px;
    max-width: calc(100vw - 16px);
    font-size: .95rem;
    line-height: 1.5;
    background: rgba(255,255,255,.9);
    color: #111826;
    border: none;
    border-radius: 0;
    padding: 12px 14px;
    box-shadow: none;
    caret-color: transparent;
}

@media (max-width: 640px) {
    .footprint-popup {
        width: 200px;
    }
}

.dark .footprint-popup {
    background: rgba(33,35,40,.85);
    color: rgba(255, 255, 255, 0.92);
    border: none;
}

.footprint-popup h4 {
    margin: 0 0 .35rem;
    font-size: 1rem;
}

.footprint-popup p {
    margin: 0 0 .35rem;
    font-size: .9rem;
}

.footprint-popup__meta {
    font-size: .78rem;
    color: #666;
    margin-bottom: .25rem;
}

.dark .footprint-popup__meta {
    color: #aaa;
}

.footprint-popup__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: .35rem;
}

.footprint-popup__tag {
    font-size: .75rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(6, 190, 182, 0.12);
    color: #06beb6;
}

.dark .footprint-popup__tag {
    background: rgba(6, 190, 182, 0.2);
    color: #5ee7df;
}

.footprint-popup__links {
    margin-top: .35rem;
}

.footprint-popup__link {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 4px;
    background: #111826;
    color: #fff;
    font-size: .85rem;
    text-decoration: none;
    transition: background 0.2s ease;
}

.footprint-popup__link:hover {
    background: #06beb6;
}

.dark .footprint-popup__link {
    background: #f7f7f7;
    color: #111;
}

.dark .footprint-popup__link:hover {
    background: #5ee7df;
    color: #111;
}

/* Photos */
.footprint-popup__photos {
    position: relative;
    margin-top: .5rem;
    overflow: hidden;
}

.footprint-popup__track {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
}

.footprint-popup__track::-webkit-scrollbar {
    display: none;
}

.footprint-popup__slide {
    margin: 0;
    flex-shrink: 0;
    flex-basis: 120px;
}

.footprint-popup__slide img {
    display: block;
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    transition: none;
}

/* 移除图片悬停放大与阴影效果（编辑器要求） */
.footprint-popup__slide img:hover {
    transform: none;
    box-shadow: none;
}

.footprint-popup__photos-btn {
    position: absolute;
    top: 0;
    bottom: 0;
    margin: auto 0;
    transform: none;
    border: none;
    background: rgba(17, 24, 38, 0.7);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.footprint-popup__photos-btn--prev {
    left: 4px;
}

.footprint-popup__photos-btn--next {
    right: 4px;
}

.dark .footprint-popup__photos-btn {
    background: rgba(255, 255, 255, 0.8);
    color: #111;
}

/* Photo Viewer */
.footprint-photo-viewer {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
}

.footprint-photo-viewer.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.footprint-photo-viewer__dialog {
    position: relative;
    width: auto;
    max-width: 90vw;
    max-height: 90vh;
    background: transparent;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.footprint-photo-viewer__dialog img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 0;
    box-shadow: none;
}

.footprint-photo-viewer__close {
    position: absolute;
    top: .5rem;
    right: .5rem;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
    box-sizing: border-box;
}

.footprint-photo-viewer-open {
    overflow: hidden;
}

.footprint-photo-viewer__mask {
    position: absolute;
    inset: 0;
}

/* Mobile Responsive */
@media (max-width: 520px) {
    .amap-info-content,
    .amap-info-outer,
    .amap-info-inner {
        max-width: calc(100vw - 16px) !important;
        width: auto !important;
    }

    .footprint-popup {
        width: clamp(220px, 70vw, 260px);
        max-width: calc(100vw - 16px);
        font-size: .87rem;
        line-height: 1.4;
        padding: 10px 12px;
    }

    .footprint-popup h4 {
        font-size: .94rem;
        margin-bottom: .25rem;
    }

    .footprint-popup p {
        font-size: .82rem;
        margin-bottom: .25rem;
    }

    .footprint-popup__meta {
        font-size: .7rem;
    }

    .footprint-popup__tag {
        font-size: .7rem;
        padding: 2px 5px;
    }

    .footprint-popup__link {
        font-size: .75rem;
        padding: 4px 10px;
    }

    .footprint-popup__photos {
        margin-top: .35rem;
    }

    .footprint-popup__slide {
        flex-basis: 100px;
    }

    .footprint-popup__slide img {
        width: 100px;
        height: 80px;
    }

    .footprint-popup__photos-btn {
        width: 24px;
        height: 24px;
        font-size: .85rem;
    }
}

/* Hide AMap Branding */
.amap-logo,
.amap-copyright {
    display: none !important;
}

/* AMap Controls Dark Mode */
.amap-scale-text,
.amap-scalecontrol {
    background: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* InfoWindow 暗色模式修复 */
.dark .amap-info-content {
    background-color: rgba(33, 35, 40, 0.85) !important;
}

.dark .amap-info-outer,
.dark .amap-info-contentContainer {
    background-color: transparent !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark .amap-info-sharp {
    background-color: rgba(33, 35, 40, 0.85) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

.dark .amap-control.amap-toolbar,
.dark .amap-ui-control-zoom {
    background-color: rgba(40, 40, 40, 0.9) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.dark .amap-ctrl-zoomin,
.dark .amap-ctrl-zoomout,
.dark .amap-ui-control-zoom a,
.dark .amap-zoom-plus,
.dark .amap-zoom-minus,
.dark .amap-toolbar .amap-toolbar-text {
    background-color: rgba(50, 50, 50, 0.95) !important;
    color: #fff !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

.dark .amap-ctrl-zoomin:hover,
.dark .amap-ctrl-zoomout:hover,
.dark .amap-ui-control-zoom a:hover,
.dark .amap-zoom-plus:hover,
.dark .amap-zoom-minus:hover,
.dark .amap-toolbar .amap-toolbar-text:hover {
    background-color: rgba(70, 70, 70, 0.95) !important;
}

.dark .amap-ctrl-zoomin,
.dark .amap-ui-control-zoom .amap-ui-control-zoom-in,
.dark .amap-zoom-plus {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

.dark .amap-scale-text,
.dark .amap-scalecontrol {
    color: rgba(255, 255, 255, 0.85) !important;
}

.dark .amap-scale-line {
    border-color: rgba(255, 255, 255, 0.6) !important;
}
