/* 世界历史时间线样式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
}

.timeline-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    min-height: 100vh;
}

/* 控制面板 */
.timeline-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 20px;
    background: #ecf0f1;
    border-radius: 8px;
    margin-bottom: 20px;
    align-items: center;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    font-weight: 600;
    color: #2c3e50;
    font-size: 14px;
}

.control-group select {
    padding: 8px 12px;
    border: 2px solid #bdc3c7;
    border-radius: 4px;
    background: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.3s;
}

.control-group select:hover {
    border-color: #3498db;
}

.control-group select:focus {
    outline: none;
    border-color: #2980b9;
}

.btn-control {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-control:hover {
    background: #2980b9;
}

.btn-control:active {
    transform: scale(0.98);
}

/* 时间线画布 */
.timeline-canvas-wrapper {
    width: 100%;
    height: 85vh;
    min-height: 500px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    overflow: hidden;
    background: #faf8f5;
    position: relative;
    margin-bottom: 20px;
}

#timelineCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: grab;
}

#timelineCanvas:active {
    cursor: grabbing;
}

/* 详情面板 */
.detail-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.detail-panel.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.detail-header h3 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.btn-close {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.detail-content {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.detail-info {
    margin-bottom: 20px;
}

.info-row {
    display: flex;
    margin-bottom: 10px;
    font-size: 14px;
}

.info-label {
    font-weight: 700;
    color: #7f8c8d;
    min-width: 60px;
}

.detail-description {
    margin-bottom: 20px;
}

.detail-description h4,
.detail-highlights h4 {
    font-size: 18px;
    color: #2c3e50;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ecf0f1;
}

.detail-description p {
    line-height: 1.6;
    color: #34495e;
}

.detail-highlights ul {
    list-style: none;
    padding: 0;
}

.detail-highlights li {
    padding: 10px;
    margin-bottom: 8px;
    background: #f8f9fa;
    border-left: 4px solid #3498db;
    border-radius: 4px;
    line-height: 1.5;
}

/* 图例 */
.timeline-legend {
    padding: 20px;
    background: #ecf0f1;
    border-radius: 8px;
    margin-bottom: 20px;
}

.timeline-legend h4 {
    font-size: 16px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-item span:last-child {
    font-size: 14px;
    color: #2c3e50;
}

/* 使用说明 */
.timeline-help {
    padding: 20px;
    background: #e8f4f8;
    border-left: 4px solid #3498db;
    border-radius: 4px;
}

.timeline-help p {
    font-weight: 700;
    margin-bottom: 10px;
    color: #2c3e50;
}

.timeline-help ul {
    list-style: none;
    padding-left: 0;
}

.timeline-help li {
    padding: 5px 0;
    color: #34495e;
}

.timeline-help li:before {
    content: "▸ ";
    color: #3498db;
    font-weight: bold;
    margin-right: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .timeline-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group label {
        margin-bottom: 5px;
    }

    .timeline-canvas-wrapper {
        height: 500px;
    }

    .detail-panel {
        width: 95%;
        max-height: 90vh;
    }

    .detail-header h3 {
        font-size: 20px;
    }

    .legend-items {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .timeline-container {
        padding: 10px;
    }

    .timeline-controls {
        padding: 15px;
        gap: 15px;
    }

    .timeline-canvas-wrapper {
        height: 400px;
    }

    .legend-items {
        grid-template-columns: 1fr;
    }
}

/* 滚动条样式 */
.detail-content::-webkit-scrollbar {
    width: 8px;
}

.detail-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.detail-content::-webkit-scrollbar-thumb {
    background: #bdc3c7;
    border-radius: 4px;
}

.detail-content::-webkit-scrollbar-thumb:hover {
    background: #95a5a6;
}

/* 加载动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* 工具提示 */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    white-space: nowrap;
}
