body {
    font-family: sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f4f4;
    margin: 0;
    padding: 20px;
}

h1 {
    text-align: center;
    color: #444;
}

#timeline-container {
    width: 100%;
    overflow-x: auto;
}

#timeline-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 2px;
    margin: 20px 0;
}

#timeline-table th, #timeline-table td {
    padding: 8px;
    text-align: center;
    vertical-align: middle;
}

.year-column {
    background-color: #e9ecef;
    font-weight: bold;
    position: relative;
    width: 60px;
}

.year-column::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background-color: #adb5bd;
    transform: translateX(-50%);
    z-index: 1;
}
.year-column span {
    position: relative;
    z-index: 2;
    background-color: #e9ecef;
    padding: 2px 5px;
}


.span-cell {
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9em;
    padding: 10px 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    white-space: nowrap;
    width: 1em;
}

.event-item {
    display: inline-block;
    cursor: pointer;
    margin: 2px;
    padding: 5px 8px;
    border-radius: 12px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    font-size: 0.85em;
    transition: background-color 0.2s;
}

.event-item:hover {
    background-color: #e9ecef;
}

.event-icon {
    margin-right: 4px;
}

/* Popup Styles */
#popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#popup-overlay.hidden {
    display: none;
}

#popup {
    background-color: #fff;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    position: relative;
}

#popup-image {
    max-width: 100%;
    height: auto;
    display: block; /* Ensure it takes its own line */
    margin: 15px auto; /* Center the image and add vertical margin */
}

#popup-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

#popup h2 {
    margin-top: 0;
    color: #333;
}

#popup p {
    white-space: pre-wrap; /* Respect newlines in description */
}

#popup a {
    display: inline-block;
    margin-top: 15px;
    color: #007bff;
    text-decoration: none;
}

#popup a:hover {
    text-decoration: underline;
}

#timeline-table .events-cell {
    text-align: left;
    vertical-align: top;
}
