/* Amazing Timeline Styles - Perfect UI/UX */
.timeline {
    position: relative;
    padding-right: 60px;
    padding-left: 20px;
    margin: 40px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 30px;
    top: 20px;
    bottom: 20px;
    width: 4px;
    background: linear-gradient(180deg, 
        var(--primary-light) 0%,
        var(--primary-color) 50%,
        var(--primary-dark) 100%
    );
    border-radius: 2px;
    box-shadow: 0 0 20px rgba(15, 118, 110, 0.3);
    z-index: 1;
}

.timeline-item {
    position: relative;
    margin-bottom: 60px;
    padding-right: 80px;
    opacity: 0;
    transform: translateX(50px);
    animation: slideInTimeline 0.8s ease-out forwards;
}

.timeline-item:nth-child(even) {
    transform: translateX(-50px);
}

.timeline-item:nth-child(1) { animation-delay: 0.2s; }
.timeline-item:nth-child(2) { animation-delay: 0.4s; }
.timeline-item:nth-child(3) { animation-delay: 0.6s; }
.timeline-item:nth-child(4) { animation-delay: 0.8s; }
.timeline-item:nth-child(5) { animation-delay: 1.0s; }

@keyframes slideInTimeline {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.timeline-marker {
    position: absolute;
    right: 12px;
    top: 20px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-gradient);
    border: 4px solid white;
    box-shadow: 
        0 0 0 4px var(--primary-color),
        0 8px 25px rgba(15, 118, 110, 0.4);
    z-index: 2;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.timeline-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.3s ease;
}

.timeline-item:hover .timeline-marker {
    transform: scale(1.2);
    box-shadow: 
        0 0 0 6px rgba(15, 118, 110, 0.2),
        0 12px 35px rgba(15, 118, 110, 0.5);
}

.timeline-item:hover .timeline-marker::before {
    width: 12px;
    height: 12px;
}

.timeline-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: 
        0 8px 32px rgba(15, 118, 110, 0.08),
        0 2px 16px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(15, 118, 110, 0.1);
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.timeline-content::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-gradient);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.4s ease;
}

.timeline-content::after {
    content: '';
    position: absolute;
    top: 30px;
    right: -12px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 12px;
    border-color: transparent transparent transparent white;
    z-index: 3;
}

.timeline-item:hover .timeline-content {
    transform: translateY(-8px);
    box-shadow: 
        0 16px 48px rgba(15, 118, 110, 0.15),
        0 8px 32px rgba(0, 0, 0, 0.08);
}

.timeline-item:hover .timeline-content::before {
    transform: scaleY(1);
}

.timeline-content h5 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.3rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 10px;
}

.timeline-content h5::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 40px;
    height: 3px;
    background: var(--primary-gradient);
    border-radius: 2px;
    transition: width 0.4s ease;
}

.timeline-item:hover .timeline-content h5::after {
    width: 80px;
}

.timeline-content .timeline-date {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary-soft);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 15px;
    border: 1px solid rgba(15, 118, 110, 0.2);
}

.timeline-content .timeline-date i {
    font-size: 0.85rem;
}

.timeline-content p {
    color: var(--text-light);
    line-height: 1.7;
    margin-bottom: 20px;
}

.timeline-content .timeline-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.timeline-content .timeline-tag {
    background: linear-gradient(135deg, #556a3abf, #556a3a);
    color: white;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.timeline-content .timeline-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.3);
}

/* Milestone Timeline Marker */
.timeline-item.milestone .timeline-marker {
    width: 36px;
    height: 36px;
    right: 6px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    box-shadow: 
        0 0 0 4px white,
        0 0 0 8px #FFD700,
        0 12px 35px rgba(255, 215, 0, 0.4);
}

.timeline-item.milestone .timeline-marker::before {
    content: '⭐';
    width: auto;
    height: auto;
    background: none;
    font-size: 16px;
    color: white;
    transform: translate(-50%, -50%);
}

/* Achievement Timeline Item */
.timeline-item.achievement .timeline-content {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-left: 5px solid var(--success-color);
}

.timeline-item.achievement .timeline-marker {
    background: var(--success-color);
    box-shadow: 
        0 0 0 4px white,
        0 0 0 8px var(--success-color),
        0 12px 35px rgba(5, 150, 105, 0.4);
}

/* Dark Mode Enhancements */
[data-bs-theme="dark"] .timeline-content {
    background: #1E293B;
    color: #F1F5F9;
    border-color: rgba(15, 118, 110, 0.2);
}

[data-bs-theme="dark"] .timeline-content::after {
    border-color: transparent transparent transparent #1E293B;
}

[data-bs-theme="dark"] .timeline-content p {
    color: #CBD5E0;
}

[data-bs-theme="dark"] .timeline-content .timeline-date {
    background: rgba(15, 118, 110, 0.2);
    color: var(--primary-light);
    border-color: rgba(15, 118, 110, 0.3);
}

[data-bs-theme="dark"] .timeline-item.achievement .timeline-content {
    background: linear-gradient(135deg, #1E293B 0%, #334155 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .timeline {
        padding-right: 40px;
        padding-left: 10px;
    }
    
    .timeline::before {
        right: 20px;
        width: 3px;
    }
    
    .timeline-item {
        padding-right: 50px;
        margin-bottom: 40px;
    }
    
    .timeline-marker {
        right: 6px;
        width: 24px;
        height: 24px;
    }
    
    .timeline-content {
        padding: 20px;
    }
    
    .timeline-content::after {
        right: -10px;
        border-width: 8px 0 8px 10px;
    }
    
    .timeline-content h5 {
        font-size: 1.1rem;
    }
}

[data-bs-theme="dark"] .timeline-marker {
    border-color: var(--bs-dark);
}

/* Back to Top Button */
.btn-floating {
    position: fixed;
    bottom: 30px;
    left: 30px; /* Changed to left for RTL */
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

[data-bs-theme="dark"] .loading-overlay {
    background: rgba(33,37,41,0.9);
}

/* Custom badge colors for better visibility */
.badge.bg-primary { background-color: #4FB0C6 !important; }
.badge.bg-success { background:linear-gradient(135deg, #556a3abf, #556a3a) !important }
.badge.bg-info { background-color: #556a3a !important; }
.badge.bg-warning { background-color: #ffc107 !important; color: #000; }
.badge.bg-danger { background-color: #dc3545 !important; }

/* Card hover effects */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

/* Search modal improvements */
#searchModal .modal-dialog {
    margin-top: 10vh;
}

#searchInput {
    font-size: 1.2rem;
    padding: 12px 20px;
}

/* Responsive timeline */
@media (max-width: 768px) {
    .timeline {
        padding-right: 20px;
    }
    
    .timeline-item {
        padding-right: 30px;
    }
    
    .timeline-marker {
        right: -6px;
        width: 12px;
        height: 12px;
    }
}
