/* WDBFGMap 前端样式 */

/* 首页布局容器 - 让主内容靠左，地图靠右 */
.wdbfgmap-wrapper {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 200px);
}

/* 主内容区域 - 靠左显示 */
.wdbfgmap-content {
    flex: 0 0 auto;
    width: calc(55% - 20px);
    padding: 20px;
    transition: all 0.3s ease;
}

/* 侧边栏 - 固定在右侧，占满 */
.wdbfgmap-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: calc(100% - 596px);
    min-width: 300px;
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    background: #fff;
    box-shadow: -5px 0 20px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

/* 侧边栏收起时隐藏 */
.wdbfgmap-sidebar.collapsed {
    transform: translateX(100%);
}

/* 侧边栏头部 */
.wdbfgmap-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    color: #333;
}

.wdbfgmap-sidebar-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.wdbfgmap-sidebar-toggle {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.wdbfgmap-sidebar-toggle:hover {
    background: rgba(0, 0, 0, 0.12);
    transform: scale(1.1);
}

/* 地图容器 */
.wdbfgmap-map-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#wdbfgmap-embed {
    width: 100%;
    height: 100%;
}

/* 时间轴区域 */
.wdbfgmap-timeline {
    max-height: 300px;
    overflow-y: auto;
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.wdbfgmap-timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.wdbfgmap-timeline-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.wdbfgmap-timeline-item {
    display: flex;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px dashed #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
}

.wdbfgmap-timeline-item:last-child {
    border-bottom: none;
}

.wdbfgmap-timeline-item:hover {
    background: rgba(102, 126, 234, 0.05);
    padding-left: 10px;
}

.wdbfgmap-timeline-date {
    font-size: 12px;
    color: #999;
    min-width: 70px;
    flex-shrink: 0;
}

.wdbfgmap-timeline-content {
    flex: 1;
}

.wdbfgmap-timeline-name {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    margin-bottom: 2px;
}

.wdbfgmap-timeline-location {
    font-size: 12px;
    color: #666;
}

/* 移动端折叠按钮 */
.wdbfgmap-mobile-toggle {
    display: flex;
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #666;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    z-index: 101;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.wdbfgmap-mobile-toggle:active {
    transform: scale(0.95);
}

.wdbfgmap-mobile-toggle svg {
    width: 24px;
    height: 24px;
}

/* 移动端时主内容全宽 */
.wdbfgmap-mobile-toggle.show {
    display: flex;
}

/* 信息窗口样式 */
.wdbfgmap-info-window {
    padding: 5px;
    min-width: 200px;
}

.wdbfgmap-info-window h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
}

.wdbfgmap-info-window .location {
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

.wdbfgmap-info-window .date {
    font-size: 12px;
    color: #999;
    margin-bottom: 8px;
}

.wdbfgmap-info-window .desc {
    font-size: 13px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 8px;
}

.wdbfgmap-info-window .link {
    display: inline-block;
    padding: 4px 12px;
    background: #667eea;
    color: #fff;
    border-radius: 3px;
    text-decoration: none;
    font-size: 12px;
}

.wdbfgmap-info-window .link:hover {
    background: #764ba2;
}

.wdbfgmap-info-window .cover-img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 8px;
}

/* 加载动画 */
.wdbfgmap-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #999;
}

.wdbfgmap-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0e0e0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: wdbfgmap-spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes wdbfgmap-spin {
    to { transform: rotate(360deg); }
}

/* 空状态 */
.wdbfgmap-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
    padding: 40px;
    text-align: center;
}

.wdbfgmap-empty-icon {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.wdbfgmap-empty-text {
    font-size: 14px;
}

/* 响应式布局 - 平板和手机 */
@media (max-width: 1024px) {
    .wdbfgmap-wrapper {
        flex-direction: column;
    }
    
    .wdbfgmap-content {
        width: 100%;
    }
    
    .wdbfgmap-sidebar {
        position: fixed;
        width: 85%;
        max-width: 400px;
        right: -85%;
        transform: none;
    }
    
    .wdbfgmap-sidebar.show {
        right: 0;
    }
    
    .wdbfgmap-sidebar.collapsed {
        transform: translateX(100%);
    }
    
    .wdbfgmap-mobile-toggle {
        display: flex;
    }
    
    /* 遮罩层 */
    .wdbfgmap-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    
    .wdbfgmap-overlay.show {
        display: block;
    }
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
    .dark .wdbfgmap-sidebar {
        background: #262626;
        color: #e0e0e0;
    }
    
    .dark .wdbfgmap-sidebar-header {
        background: rgba(30, 30, 30, 0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        color: #e0e0e0;
    }
    
    .dark .wdbfgmap-timeline {
        background: #1a1a1a;
        border-color: #333;
    }
    
    .dark .wdbfgmap-timeline-item {
        border-color: #333;
    }
    
    .dark .wdbfgmap-timeline-name {
        color: #e0e0e0;
    }
    
    .dark .wdbfgmap-timeline-location {
        color: #999;
    }
    
    .dark .wdbfgmap-sidebar-toggle {
        background: rgba(255,255,255,0.1);
        color: #ccc;
    }

    .dark .wdbfgmap-sidebar-toggle:hover {
        background: rgba(255,255,255,0.2);
    }
    
    .dark .wdbfgmap-sidebar-toggle:hover {
        background: rgba(255,255,255,0.2);
    }
}

/* 滚动条美化 */
.wdbfgmap-timeline::-webkit-scrollbar {
    width: 6px;
}

.wdbfgmap-timeline::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.wdbfgmap-timeline::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.wdbfgmap-timeline::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* 错误提示 */
.wdbfgmap-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #e74c3c;
    padding: 20px;
}

/* 主内容区域有侧边栏时，给右侧留出空间 */
.wdbfgmap-has-sidebar {
    max-width: none !important;
    margin: 0 !important;
    margin-right: 45% !important;
    transition: margin-right 0.3s ease;
}

/* 侧边栏收起时 */
body.wdbfgmap-sidebar-collapsed .wdbfgmap-has-sidebar {
    margin-right: 0 !important;
}

/* 确保内容区域也靠左 */
.wdbfgmap-has-sidebar .content-container {
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* 桌面端收起时显示展开按钮 */
body.wdbfgmap-sidebar-collapsed ~ main ~ .wdbfgmap-mobile-toggle,
body.wdbfgmap-sidebar-collapsed .wdbfgmap-mobile-toggle {
    display: flex !important;
}

/* 桌面端展开按钮位置 */
@media (min-width: 1025px) {
    .wdbfgmap-mobile-toggle {
        top: 50%;
        bottom: auto;
        transform: translateY(-50%);
        right: 20px;
    }
}

/* 信息窗口带图片的布局 */
.wdbfgmap-info-with-image {
    display: flex !important;
    gap: 12px;
}

.wdbfgmap-info-with-image .wdbfgmap-info-text {
    flex: 1;
    min-width: 0;
}

.wdbfgmap-info-with-image .wdbfgmap-info-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 4px;
    overflow: hidden;
}

.wdbfgmap-info-with-image .wdbfgmap-info-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wdbfgmap-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    color: #999;
    font-size: 11px;
    text-align: center;
}

/* 暗色模式支持 - 信息窗口 */
@media (prefers-color-scheme: dark) {
    .dark .wdbfgmap-info-window h4 {
        color: #e0e0e0;
    }
    
    .dark .wdbfgmap-info-window .location {
        color: #999;
    }
    
    .dark .wdbfgmap-info-window .desc {
        color: #ccc;
    }
    
    .dark .wdbfgmap-no-image {
        background: #333;
    }
}
