/* 
 * lightwinner_map.css - 地图模块样式
 * Refactored: 2026-02-08 (Step 42: Theming Integration)
 */

:root {
    /* --- Local Map Tokens (Default: Dark Mode) --- */
    --map-popup-bg: var(--sm-bg-dark, rgba(20, 20, 30, 0.95));
    --map-popup-border: rgba(255, 255, 255, 0.1);
    --map-card-text: #fff;
    --map-type-text: rgba(255, 255, 255, 0.7);
    --map-title-text: #fff;
    --map-meta-text: rgba(255, 255, 255, 0.6);

    --map-marker-video-shadow: rgba(0, 149, 204, 0.3);
    --map-marker-log-shadow: rgba(0, 149, 204, 0.3);
    /* Default shared */

    /* Leaflet Controls */
    --leaflet-ctrl-text: var(--lw-cyan, rgba(0, 255, 230, 0.9));
    --leaflet-ctrl-shadow: 0 0 8px var(--pj-glow-cyan, rgba(0, 255, 230, 0.6));
    --leaflet-ctrl-hover-bg: rgba(0, 255, 230, 0.1);
    --leaflet-ctrl-hover-text: #fff;
}

body.light-mode {
    /* --- Light Mode Overrides --- */
    --map-popup-bg: var(--sm-bg-light, rgba(255, 255, 255, 0.98));
    --map-popup-border: rgba(0, 0, 0, 0.1);
    --map-card-text: #333;
    --map-type-text: rgba(0, 0, 0, 0.6);
    --map-title-text: #222;
    --map-meta-text: rgba(0, 0, 0, 0.5);

    --map-marker-video-shadow: rgba(255, 107, 107, 0.6);
    --map-marker-log-shadow: rgba(78, 205, 196, 0.6);

    /* Leaflet Controls (Light) */
    --leaflet-ctrl-text: rgba(0, 0, 0, 0.5);
    --leaflet-ctrl-shadow: 0 0 2px rgba(255, 255, 255, 0.8);
    --leaflet-ctrl-hover-bg: rgba(0, 0, 0, 0.05);
    --leaflet-ctrl-hover-text: #000;
}

/* 地图标记样式 */
.lw-marker {
    background: transparent !important;
    border: none !important;
}

.marker-pin {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    position: relative;
    box-shadow: 0 0 15px var(--pj-shadow-medium, rgba(0, 149, 204, 0.3));
    animation: pulse 2s ease-in-out infinite;
}

.marker-video .marker-pin {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px var(--map-marker-video-shadow);
}

.marker-log .marker-pin {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px var(--map-marker-log-shadow);
}

/* 标记脉冲动画 */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

/* 悬停效果 */
.lw-marker:hover .marker-pin {
    transform: scale(1.3);
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.8);
    animation: none;
}

/* 弹窗卡片样式 */
.lw-map-popup .leaflet-popup-content-wrapper {
    background: var(--map-popup-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--map-popup-border);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lw-map-popup .leaflet-popup-content {
    margin: 0;
    padding: 0;
    width: auto !important;
}

.lw-map-popup .leaflet-popup-tip {
    background: var(--map-popup-bg);
    border: 1px solid var(--map-popup-border);
}

.map-popup-card {
    padding: 16px;
    color: var(--map-card-text);
    min-width: 220px;
}

.popup-type {
    font-size: 12px;
    color: var(--map-type-text);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.popup-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--map-title-text);
    line-height: 1.4;
}

.popup-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--map-meta-text);
}

.popup-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 
 * [DELETED] Old "Override Pattern" blocks for light-mode 
 * (L107-L140 replaced by variables above) 
 */

/* 响应式 */
@media (max-width: 768px) {
    .map-popup-card {
        padding: 12px;
        min-width: 180px;
    }

    .popup-title {
        font-size: 14px;
    }

    .popup-meta {
        font-size: 12px;
    }
}

/* --- CAROUSEL POPUP STYLES (V229) --- */

/* Title Interaction */
.popup-title.clickable-title {
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: rgba(255, 255, 255, 0.3);
    text-underline-offset: 4px;
    transition: color 0.2s, text-decoration-color 0.2s;
}

.popup-title.clickable-title:hover {
    color: var(--lw-accent, #ffaa00);
    text-decoration-color: var(--lw-accent, #ffaa00);
}

/* Light Mode Title Hover (Kept as logic is specific) */
body.light-mode .popup-title.clickable-title:hover {
    color: #d4a017;
    text-decoration-color: #d4a017;
}

/* Header Row (Type + Nav) */
.popup-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    height: 24px;
}

.popup-type {
    margin-bottom: 0 !important;
}

/* Nav Controls */
.popup-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 12px;
}

body.light-mode .popup-nav {
    background: rgba(0, 0, 0, 0.05);
    /* Could be variable, but simple enough */
}

.nav-counter {
    font-size: 11px;
    font-family: monospace;
    opacity: 0.8;
}

.nav-btn {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 10px;
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
}

.nav-btn:hover {
    opacity: 1;
    transform: scale(1.2);
    color: var(--lw-accent, #ffaa00);
}

/* Hint Text */
.popup-hint {
    font-size: 10px;
    opacity: 0.5;
    margin-top: 10px;
    text-align: right;
    font-style: italic;
}

/* --- LEAFLET ZOOM CONTROLS CUSTOMIZATION (V225) --- */

/* 1. Clear Default Containers */
.leaflet-bar {
    border: none !important;
    box-shadow: none !important;
}

/* 2. Style Buttons (Variable Driven) */
.leaflet-bar a {
    background-color: transparent !important;
    border-bottom: none !important;
    color: var(--leaflet-ctrl-text) !important;
    font-weight: 300 !important;
    font-size: 24px !important;
    line-height: 26px !important;
    transition: all 0.3s ease !important;
    text-shadow: var(--leaflet-ctrl-shadow);
    border-radius: 4px !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Hover Glow (Variable Driven) */
.leaflet-bar a:hover {
    color: var(--leaflet-ctrl-hover-text) !important;
    /* Use variables for simplified shadow logic or keep complex shadow here if needed */
    text-shadow: 0 0 5px #fff, 0 0 20px #00ffe0;
    background-color: var(--leaflet-ctrl-hover-bg) !important;
    transform: scale(1.15);
}

body.light-mode .leaflet-bar a:hover {
    /* Override specific complex shadow for light mode that variables handled poorly */
    text-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

/* 
 * [DELETED] Old Light Mode Overrides for Leaflet (L282-L293)
 * Handled by variables 
 */

/* Disabled state */
.leaflet-bar a.leaflet-disabled {
    color: rgba(128, 128, 128, 0.3) !important;
    text-shadow: none !important;
    cursor: default !important;
    background: transparent !important;
    pointer-events: none;
}

/* --- [OPTIMIZATION FINAL] GPU HARDWARE ACCELERATION --- */
.leaflet-map-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane,
.leaflet-proxy,
.lw-marker {
    will-change: transform;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    perspective: 1000px;
}

#lw-leaflet-map {
    contain: strict;
    isolation: isolate;
}