* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #0f0f0f;
    color: #e5e5e5;
    overflow-x: auto;
    overflow-y: hidden;
    height: 100vh;
}

/* Undated events - hide date-related elements */
.event.undated .event-marker,
.event.undated .event-marker::after,
.event.undated .event-date {
    opacity: 0;
}

.container {
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.title-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    z-index: 100;
}

.title-header h1 {
    font-size: 4rem;
    font-weight: 300;
    text-align: center;
    transition: opacity 0.3s ease;
}

.timeline-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    padding-top: 180px;
    padding-bottom: 150px;
}

.timeline {
    position: relative;
    width: max-content;
    min-width: 100vw;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 100px;
}

.timeline-line {
    position: fixed;
    top: calc(180px + 200px);
    left: 0;
    right: 16px;
    height: 8px;
    background: linear-gradient(90deg, #333 0%, #666 50%, #666 100%);
    transform: translateY(-4px);
    z-index: 0;
}

.timeline-arrow {
    position: fixed;
    right: 0;
    top: calc(180px + 200px);
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 16px solid #666;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    z-index: -1;
    filter: drop-shadow(0 0 4px rgba(102, 102, 102, 0.3));
}

.time-marker {
    position: absolute;
    top: 50%;
    transform: translateX(-1px) translateY(-4px);
    width: 2px;
    height: 15px;
    background-color: #666;
    z-index: 5;
}

.time-marker::after {
    content: attr(data-date);
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    color: #999;
    white-space: nowrap;
    padding: 4px 8px;
}

.events-container {
    position: relative;
    width: 100%;
    height: 100%;
}

.event {
    position: absolute;
    top: 50%;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.event:hover {
    transform: scale(1.05);
}

.event.above {
    flex-direction: column;
    transform: translateY(-50%);
}

.event.above:hover {
    transform: translateY(-50%) scale(1.05);
}

.event.below {
    flex-direction: column-reverse;
    transform: translateY(-50%);
}

.event.below:hover {
    transform: translateY(-50%) scale(1.05);
}

.event-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #0f0f0f;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.event-marker::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1px;
    z-index: -1;
    background-color: inherit;
}

.event.above .event-marker::after {
    height: 50px;
    transform: translateX(-50%) translateY(-100%);
}

.event.below .event-marker::after {
    height: 50px;
    transform: translateX(-50%);
}

/* Information Technologies - Blue */
.event.above.information .event-marker::after {
    background: linear-gradient(to top, #3b82f6 0%, #3b82f6 20%, #0f0f0f 35%, #0f0f0f 45%, #3b82f6 60%, #3b82f6 80%, #0f0f0f 100%);
}
.event.below.information .event-marker::after {
    background: linear-gradient(to bottom, #3b82f6 0%, #3b82f6 20%, #0f0f0f 35%, #0f0f0f 45%, #3b82f6 60%, #3b82f6 80%, #0f0f0f 100%);
}

/* Religion - Purple */
.event.above.religion .event-marker::after {
    background: linear-gradient(to top, #8b5cf6 0%, #8b5cf6 20%, #0f0f0f 35%, #0f0f0f 45%, #8b5cf6 60%, #8b5cf6 80%, #0f0f0f 100%);
}
.event.below.religion .event-marker::after {
    background: linear-gradient(to bottom, #8b5cf6 0%, #8b5cf6 20%, #0f0f0f 35%, #0f0f0f 45%, #8b5cf6 60%, #8b5cf6 80%, #0f0f0f 100%);
}

/* Politics - Red */
.event.above.politics .event-marker::after {
    background: linear-gradient(to top, #ef4444 0%, #ef4444 20%, #0f0f0f 35%, #0f0f0f 45%, #ef4444 60%, #ef4444 80%, #0f0f0f 100%);
}
.event.below.politics .event-marker::after {
    background: linear-gradient(to bottom, #ef4444 0%, #ef4444 20%, #0f0f0f 35%, #0f0f0f 45%, #ef4444 60%, #ef4444 80%, #0f0f0f 100%);
}

/* Economics - Green */
.event.above.economics .event-marker::after {
    background: linear-gradient(to top, #22c55e 0%, #22c55e 20%, #0f0f0f 35%, #0f0f0f 45%, #22c55e 60%, #22c55e 80%, #0f0f0f 100%);
}
.event.below.economics .event-marker::after {
    background: linear-gradient(to bottom, #22c55e 0%, #22c55e 20%, #0f0f0f 35%, #0f0f0f 45%, #22c55e 60%, #22c55e 80%, #0f0f0f 100%);
}

/* Science - Orange */
.event.above.science .event-marker::after {
    background: linear-gradient(to top, #f59e0b 0%, #f59e0b 20%, #0f0f0f 35%, #0f0f0f 45%, #f59e0b 60%, #f59e0b 80%, #0f0f0f 100%);
}
.event.below.science .event-marker::after {
    background: linear-gradient(to bottom, #f59e0b 0%, #f59e0b 20%, #0f0f0f 35%, #0f0f0f 45%, #f59e0b 60%, #f59e0b 80%, #0f0f0f 100%);
}

/* Medicine - Pink */
.event.above.medicine .event-marker::after {
    background: linear-gradient(to top, #ec4899 0%, #ec4899 20%, #0f0f0f 35%, #0f0f0f 45%, #ec4899 60%, #ec4899 80%, #0f0f0f 100%);
}
.event.below.medicine .event-marker::after {
    background: linear-gradient(to bottom, #ec4899 0%, #ec4899 20%, #0f0f0f 35%, #0f0f0f 45%, #ec4899 60%, #ec4899 80%, #0f0f0f 100%);
}

/* Industry - Gray */
.event.above.industry .event-marker::after {
    background: linear-gradient(to top, #6b7280 0%, #6b7280 20%, #0f0f0f 35%, #0f0f0f 45%, #6b7280 60%, #6b7280 80%, #0f0f0f 100%);
}
.event.below.industry .event-marker::after {
    background: linear-gradient(to bottom, #6b7280 0%, #6b7280 20%, #0f0f0f 35%, #0f0f0f 45%, #6b7280 60%, #6b7280 80%, #0f0f0f 100%);
}

.event-content {
    max-width: 400px;
    min-width: 267px;
    min-height: 150px;
    padding: 30px;
    text-align: left;
    position: absolute;
    left: -50%;
}

.event.above .event-content {
    bottom: 50px;
}

.event.below .event-content {
    top: 50px;
}

.event-date {
    font-size: 1rem;
    color: #999;
    text-align: center;
    padding: 4px 8px;
    white-space: nowrap;
    z-index: 10;
    position: relative;
}

.event.above .event-date {
    margin-bottom: 40px;
}

.event.below .event-date {
    margin-top: 40px;
}

.event-title {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.event-description {
    font-size: 1rem;
    color: #ccc;
    line-height: 1.3;
}

.legend {
    position: fixed;
    bottom: 16px;
    left: 0;
    right: 0;
    background-color: transparent;
    padding: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    z-index: 100;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 2px;
}

.legend-text {
    font-size: 1.1rem;
    color: #ccc;
}

/* Hide default scrollbar */
.timeline-container::-webkit-scrollbar {
    display: none;
}

.timeline-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Custom scrollbar styles */
.custom-scrollbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    z-index: 300;
    pointer-events: all;
}

.scrollbar-track {
    width: 100%;
    height: 100%;
    background: #1a1a1a;
    position: relative;
    border-radius: 4px;
    cursor: pointer;
}

.scrollbar-thumb {
    position: absolute;
    top: 0;
    height: 100%;
    background: #444;
    border-radius: 4px;
    cursor: grab;
    transition: background-color 0.2s ease;
    min-width: 20px;
}

.scrollbar-thumb:hover {
    background: #666;
}

.scrollbar-thumb:active {
    cursor: grabbing;
    background: #777;
}

.scrollbar-event-indicator {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background-color: #808080;
    pointer-events: none;
}

@media (max-width: 768px) {
    .timeline {
        padding: 0 50px;
    }

    .event-content {
        max-width: 150px;
    }

    .legend {
        gap: 15px;
    }

    .legend-text {
        font-size: 0.8rem;
    }
}