/* Responsive Timeline CSS - Adapted from https://github.com/itbruno/responsive-timeline */
/* Timeline color configuration */
:root {
    --timeline-color: #0d6efd; /* Bootstrap primary blue */
}

#timeline {
    line-height: 1.5em;
    font-size: 14px;
    width: 90%;
    margin: 30px auto;
    position: relative;
    -webkit-transition: all .4s ease;
    -moz-transition: all .4s ease;
    -o-transition: all .4s ease;
    transition: all .4s ease;
}

#timeline,
#timeline *,
#timeline *:before,
#timeline *:after {
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
}

/* Central timeline line */
#timeline:before {
    content: "";
    width: 3px;
    height: 100%;
    background: var(--timeline-color);
    left: 50%;
    top: 0;
    position: absolute;
}

#timeline:after {
    content: "";
    clear: both;
    display: table;
    width: 100%;
}

/* ===== Timeline Item Wrapper (with map) ===== */
.timeline-item-wrapper {
    margin-bottom: 50px;
    position: relative;
    min-height: 280px; /* Ensure enough space for map panel (200px map + title + padding) */
}

.timeline-item-wrapper:after {
    content: "";
    display: block;
    clear: both;
}

/* Timeline icon - centered on the line */
.timeline-item-wrapper .timeline-item .timeline-icon,
.timeline-item .timeline-icon {
    background: var(--timeline-color);
    width: 50px;
    height: 50px;
    position: absolute;
    top: 0;
    left: 50%;
    overflow: hidden;
    margin-left: -25px;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    border-radius: 50%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    z-index: 10;
}

/* Timeline item within wrapper */
.timeline-item-wrapper .timeline-item {
    position: relative;
}

/* ===== Timeline Content Box ===== */
.timeline-item .timeline-content {
    width: 45%;
    background: #fff;
    padding: 20px;
    position: relative;
    -webkit-box-shadow: 0 3px 0 rgba(0,0,0,0.1);
    -moz-box-shadow: 0 3px 0 rgba(0,0,0,0.1);
    box-shadow: 0 3px 0 rgba(0,0,0,0.1);
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    -webkit-transition: all .3s ease;
    -moz-transition: all .3s ease;
    -o-transition: all .3s ease;
    transition: all .3s ease;
}

.timeline-item .timeline-content h2 {
    padding: 12px 15px;
    background: var(--timeline-color);
    color: #fff;
    margin: -20px -20px 15px -20px;
    font-weight: 500;
    font-size: 1.25rem;
    line-height: 1.2;
    -webkit-border-radius: 3px 3px 0 0;
    -moz-border-radius: 3px 3px 0 0;
    border-radius: 3px 3px 0 0;
}

/* Arrow pointing right (default - left-side content) */
.timeline-item .timeline-content:before {
    content: '';
    position: absolute;
    top: 20px;
    right: -5px;
    width: 14px;
    height: 14px;
    background-color: var(--timeline-color);
    display: block;
    border-radius: 3px;
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    -o-transform: rotate(45deg);
    transform: rotate(45deg);
}

/* Right-side content positioning */
.timeline-item .timeline-content.right {
    float: right;
}

/* Arrow pointing left (right-side content) */
.timeline-item .timeline-content.right:before {
    left: -5px;
    right: inherit;
}

/* ===== Map Panel ===== */
.timeline-map-panel {
    width: 45%;
    min-height: 200px;
    background: #fff;
    border-radius: 5px;
    box-shadow: 0 3px 0 rgba(0,0,0,0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
}

/* Map on right side (content is on left) */
.timeline-item-wrapper.map-right .timeline-map-panel {
    right: 0;
}

/* Map on left side (content is on right) */
.timeline-item-wrapper.map-left .timeline-map-panel {
    left: 0;
}

.timeline-item-wrapper.map-left .timeline-item .timeline-content {
    float: right;
}

.timeline-item-wrapper.map-left .timeline-item .timeline-content:before {
    left: -5px;
    right: inherit;
}

.timeline-map-panel .map-container {
    flex: 1;
    min-height: 180px;
}

.timeline-map-panel .map-title {
    padding: 8px 12px;
    background: #e9ecef;
    color: #495057;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
}

/* ===== Toggle buttons for mobile ===== */
.timeline-view-toggle {
    display: none;
    margin-bottom: 10px;
}

.timeline-view-toggle .btn-group {
    width: 100%;
}

.timeline-view-toggle .btn {
    flex: 1;
}

/* ===== Collapsible content styling ===== */
.timeline-content .collapse-toggle {
    cursor: pointer;
    margin-top: 10px;
    padding: 5px 10px;
    border: 1px solid var(--timeline-color);
    border-radius: 3px;
    display: inline-block;
    color: var(--timeline-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

.timeline-content .collapse-toggle:hover {
    background: var(--timeline-color);
    color: white;
}

.timeline-content .miniature-list {
    margin-top: 15px;
}

.timeline-content .miniature-item {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

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

.timeline-content .miniature-item a {
    text-decoration: none;
    color: #333;
    transition: color 0.2s ease;
}

.timeline-content .miniature-item a:hover {
    color: var(--timeline-color);
}

.timeline-content .country-flag {
    margin-right: 5px;
}

/* ===== Responsive design for tablets ===== */
@media screen and (max-width: 992px) {
    .timeline-item-wrapper {
        display: block;
    }
    
    .timeline-map-panel {
        position: relative;
        width: 90%;
        min-height: 250px;
        margin-top: 20px;
        float: right;
    }
    
    .timeline-item-wrapper.map-left .timeline-map-panel {
        float: right;
        left: auto;
    }
    
    .timeline-view-toggle {
        display: block;
    }
    
    .timeline-item-wrapper .timeline-map-panel.d-none-mobile {
        display: none !important;
    }
    
    .timeline-item-wrapper .timeline-details-container.d-none-mobile {
        display: none !important;
    }
}

/* ===== Responsive design for mobile ===== */
@media screen and (max-width: 768px) {
    #timeline {
        margin: 30px;
        padding: 0;
        padding-left: 25px; /* Space for timeline icon */
    }
    
    #timeline:before {
        left: 25px;
    }
    
    .timeline-item .timeline-content,
    .timeline-item-wrapper .timeline-item .timeline-content {
        width: calc(100% - 60px); /* Full width minus icon space and gap */
        float: right;
        margin-left: 60px; /* Space for icon (50px) + arrow gap (10px) */
    }
    
    .timeline-item .timeline-content:before,
    .timeline-item .timeline-content.right:before,
    .timeline-item-wrapper .timeline-item .timeline-content:before {
        left: -10px; /* Adjusted for better arrow visibility */
        right: inherit;
    }
    
    .timeline-item .timeline-icon,
    .timeline-item-wrapper .timeline-item .timeline-icon {
        left: 0;
        margin-left: 0;
    }
    
    .timeline-map-panel {
        width: calc(100% - 60px);
        margin-left: 60px;
    }
}

/* ===== Loading indicator ===== */
.timeline-loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.timeline-loading i {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== End of timeline message ===== */
.timeline-end {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}
