/* Journey Player 公共样式 - 灯笼/马匹/国风路径/地点标签 */
/* 从 index-main.css / map-markers.css / style.css 抽取，供所有诗人行迹页复用 */

/* ====== Leaflet 自定义图标基础 ====== */
.custom-div-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.horse-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

/* ====== 灯笼标记 ====== */
.lantern-marker {
    font-size: 28px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    transform-origin: center bottom;
    position: relative;
}

.lantern-marker.lit {
    font-size: 48px !important;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.9))
            drop-shadow(0 0 40px rgba(255, 165, 0, 0.7))
            drop-shadow(0 0 60px rgba(255, 140, 0, 0.5));
    animation: lanternGlow 2s ease-in-out infinite alternate,
               lanternFloat 3s ease-in-out infinite;
    z-index: 1000 !important;
}

@keyframes lanternGlow {
    0% {
        filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.8))
                drop-shadow(0 0 30px rgba(255, 165, 0, 0.6))
                drop-shadow(0 0 45px rgba(255, 140, 0, 0.4));
    }
    100% {
        filter: drop-shadow(0 0 25px rgba(255, 215, 0, 1))
                drop-shadow(0 0 50px rgba(255, 165, 0, 0.8))
                drop-shadow(0 0 75px rgba(255, 140, 0, 0.6));
    }
}

@keyframes lanternFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.05); }
}

/* 灯笼诗句浮窗 */
.lantern-poem-container {
    position: absolute;
    bottom: calc(100% + 15px);
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg,
        rgba(139, 0, 0, 0.95) 0%,
        rgba(178, 34, 34, 0.9) 50%,
        rgba(139, 0, 0, 0.95) 100%);
    border: 3px solid #DAA520;
    border-radius: 15px;
    padding: 15px 20px;
    min-width: 200px;
    max-width: 320px;
    text-align: center;
    box-shadow:
        0 0 30px rgba(255, 215, 0, 0.6),
        0 0 60px rgba(255, 165, 0, 0.4),
        inset 0 0 20px rgba(255, 215, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    pointer-events: none;
}

.lantern-marker.lit .lantern-poem-container {
    opacity: 1;
    visibility: visible;
    animation: poemFadeIn 0.5s ease-out;
}

@keyframes poemFadeIn {
    0% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(0.9); }
    100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.lantern-poem-text {
    color: #FFD700;
    font-size: 16px;
    font-weight: bold;
    line-height: 1.8;
    text-shadow:
        0 0 10px rgba(255, 215, 0, 0.8),
        0 0 20px rgba(255, 165, 0, 0.6),
        1px 1px 2px rgba(0, 0, 0, 0.5);
    font-family: "SimSun", "STKaiti", "KaiTi", serif;
    letter-spacing: 2px;
}

.lantern-poem-title {
    color: #FFA500;
    font-size: 14px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(218, 165, 32, 0.5);
    padding-bottom: 5px;
}

.lantern-poem-container::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    border-top: 12px solid #DAA520;
}

.lantern-marker.dimming {
    animation: lanternDim 1s ease-out forwards;
}

@keyframes lanternDim {
    0% {
        font-size: 48px;
        filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.9))
                drop-shadow(0 0 40px rgba(255, 165, 0, 0.7));
    }
    100% {
        font-size: 28px;
        filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
    }
}

/* ====== 马匹标记 ====== */
.horse-marker {
    font-size: 40px !important;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    transform-origin: center center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

.horse-moving {
    animation: horseRun 0.6s ease-in-out infinite, horseBob 0.4s ease-in-out infinite;
}

.horse-zooming {
    animation: horseZoomIn 0.6s ease-out;
}

@keyframes horseRun {
    0% { transform: translateX(0) scaleX(1); }
    25% { transform: translateX(3px) scaleX(1.08); }
    50% { transform: translateX(5px) scaleX(1); }
    75% { transform: translateX(3px) scaleX(1.08); }
    100% { transform: translateX(0) scaleX(1); }
}

@keyframes horseBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@keyframes horseZoomIn {
    0% { transform: scale(1); }
    50% { transform: scale(1.5) rotate(10deg); }
    100% { transform: scale(1); }
}

.horse-marker:hover {
    transform: scale(1.3) rotate(5deg);
}

.horse-shadow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 8px;
    background: radial-gradient(ellipse at center, rgba(0,0,0,0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: shadowPulse 0.6s ease-in-out infinite;
}

@keyframes shadowPulse {
    0%, 100% { transform: translateX(-50%) scaleX(1); opacity: 0.4; }
    50% { transform: translateX(-50%) scaleX(0.8); opacity: 0.6; }
}

/* 马匹注释气泡 */
.horse-comment {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    max-width: 32vw;
    min-width: 160px;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 13px;
    line-height: 1.45;
    border-radius: 6px;
    white-space: normal;
    word-break: break-word;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    animation: horseFadeInOut 2.8s ease-out forwards;
    z-index: 1000;
}

.horse-comment::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.82);
}

@keyframes horseFadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(6px); }
    15% { opacity: 1; transform: translateX(-50%) translateY(0); }
    85% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-4px); }
}

/* ====== 地点标签 ====== */
.location-label-icon {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.location-label {
    background-color: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 15px;
    font-size: 12px;
    text-align: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(3px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    max-width: 150px;
    white-space: normal !important;
    word-wrap: break-word !important;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    text-overflow: ellipsis;
}

/* ====== 国风路径 ====== */
.tang-path {
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

.path-glow {
    filter: drop-shadow(0 0 8px rgba(218, 165, 32, 0.6))
            drop-shadow(0 0 16px rgba(218, 165, 32, 0.4));
}

.path-silk {
    stroke: url(#silkGradient);
    stroke-width: 4;
    fill: none;
    filter: drop-shadow(0 0 6px rgba(218, 165, 32, 0.5));
}

.path-pulse {
    animation: pathPulse 3s ease-in-out infinite;
}

@keyframes pathPulse {
    0%, 100% { 
        opacity: 0.8;
        filter: drop-shadow(0 0 6px rgba(218, 165, 32, 0.4));
    }
    50% { 
        opacity: 1;
        filter: drop-shadow(0 0 12px rgba(218, 165, 32, 0.8))
                drop-shadow(0 0 20px rgba(255, 215, 0, 0.4));
    }
}

.path-flow {
    stroke-dasharray: 10, 15;
    animation: pathFlow 2s linear infinite;
}

@keyframes pathFlow {
    from { stroke-dashoffset: 0; }
    to { stroke-dashoffset: -50; }
}

.path-ink {
    stroke: #1a1a1a;
    stroke-width: 3;
    fill: none;
    opacity: 0.7;
}

.path-ink-spread {
    animation: inkSpread 0.8s ease-out forwards;
}

@keyframes inkSpread {
    0% { 
        stroke-width: 0;
        opacity: 0;
        filter: blur(8px);
    }
    50% { 
        opacity: 0.9;
        filter: blur(2px);
    }
    100% { 
        stroke-width: 3;
        opacity: 0.7;
        filter: blur(0);
    }
}

.leaflet-overlay-pane svg path {
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

.leaflet-overlay-pane svg {
    overflow: visible !important;
}

/* ====== 响应式 ====== */
@media (max-width: 768px) {
    .lantern-marker.lit { font-size: 36px !important; }
    .lantern-poem-container {
        min-width: 150px;
        max-width: 250px;
        padding: 10px 15px;
    }
    .lantern-poem-text { font-size: 14px; }
    .horse-comment { max-width: 70vw; }
}
