/* Timeline Component - Cacao UI Framework */

.timeline {
    position: relative;
    padding: 16px 0;
}

.timeline-item {
    position: relative;
    padding-left: 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

/* Timeline Line */
.timeline-item::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 20px;
    bottom: -24px;
    width: 2px;
    background-color: #e8e8e8;
}

.timeline-item:last-child::before {
    display: none;
}

/* Timeline Dot */
.timeline-item::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 10px;
    height: 10px;
    background-color: #8B4513;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #e8e8e8;
    z-index: 1;
}

/* Timeline Content */
.timeline-content {
    flex: 1;
    margin-left: 16px;
}

.timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
    line-height: 1.4;
}

.timeline-description {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 8px;
}

.timeline-time {
    font-size: 12px;
    color: #999;
    margin-bottom: 0;
}

/* Timeline Item States */
.timeline-item.pending::after {
    background-color: #d9d9d9;
}

.timeline-item.processing::after {
    background-color: #1890ff;
    animation: timelinePulse 2s infinite;
}

.timeline-item.success::after {
    background-color: #52c41a;
}

.timeline-item.error::after {
    background-color: #ff4d4f;
}

.timeline-item.warning::after {
    background-color: #faad14;
}

@keyframes timelinePulse {
    0% {
        box-shadow: 0 0 0 2px #e8e8e8, 0 0 0 2px #1890ff;
    }
    50% {
        box-shadow: 0 0 0 2px #e8e8e8, 0 0 0 6px rgba(24, 144, 255, 0.3);
    }
    100% {
        box-shadow: 0 0 0 2px #e8e8e8, 0 0 0 2px #1890ff;
    }
}

/* Timeline Variants */
.timeline.alternate {
    text-align: left;
}

.timeline.alternate .timeline-item {
    width: 50%;
    padding-left: 0;
    padding-right: 32px;
}

.timeline.alternate .timeline-item:nth-child(even) {
    margin-left: 50%;
    padding-left: 32px;
    padding-right: 0;
}

.timeline.alternate .timeline-item::before {
    left: auto;
    right: 8px;
}

.timeline.alternate .timeline-item:nth-child(even)::before {
    left: 8px;
    right: auto;
}

.timeline.alternate .timeline-item::after {
    left: auto;
    right: 4px;
}

.timeline.alternate .timeline-item:nth-child(even)::after {
    left: 4px;
    right: auto;
}

.timeline.alternate .timeline-content {
    margin-left: 0;
    margin-right: 16px;
}

.timeline.alternate .timeline-item:nth-child(even) .timeline-content {
    margin-left: 16px;
    margin-right: 0;
}

/* Timeline Right Align */
.timeline.right {
    text-align: right;
}

.timeline.right .timeline-item {
    padding-left: 0;
    padding-right: 32px;
}

.timeline.right .timeline-item::before {
    left: auto;
    right: 8px;
}

.timeline.right .timeline-item::after {
    left: auto;
    right: 4px;
}

.timeline.right .timeline-content {
    margin-left: 0;
    margin-right: 16px;
}

/* Timeline Horizontal */
.timeline.horizontal {
    display: flex;
    align-items: flex-start;
    padding: 0;
    overflow-x: auto;
}

.timeline.horizontal .timeline-item {
    flex: 0 0 auto;
    padding-left: 0;
    padding-top: 32px;
    margin-bottom: 0;
    margin-right: 40px;
    min-width: 120px;
}

.timeline.horizontal .timeline-item:last-child {
    margin-right: 0;
}

.timeline.horizontal .timeline-item::before {
    left: 50%;
    top: 8px;
    bottom: auto;
    width: 40px;
    height: 2px;
    transform: translateX(-50%);
}

.timeline.horizontal .timeline-item:last-child::before {
    display: none;
}

.timeline.horizontal .timeline-item::after {
    left: 50%;
    top: 4px;
    transform: translateX(-50%);
}

.timeline.horizontal .timeline-content {
    margin-left: 0;
    margin-top: 16px;
    text-align: center;
}

/* Timeline Sizes */
.timeline.small .timeline-item {
    padding-left: 24px;
    margin-bottom: 16px;
}

.timeline.small .timeline-item::before {
    left: 6px;
    bottom: -16px;
    width: 1px;
}

.timeline.small .timeline-item::after {
    left: 3px;
    width: 6px;
    height: 6px;
}

.timeline.small .timeline-content {
    margin-left: 12px;
}

.timeline.small .timeline-title {
    font-size: 12px;
}

.timeline.small .timeline-description {
    font-size: 11px;
}

.timeline.small .timeline-time {
    font-size: 10px;
}

.timeline.large .timeline-item {
    padding-left: 48px;
    margin-bottom: 32px;
}

.timeline.large .timeline-item::before {
    left: 12px;
    bottom: -32px;
    width: 3px;
}

.timeline.large .timeline-item::after {
    left: 6px;
    width: 14px;
    height: 14px;
}

.timeline.large .timeline-content {
    margin-left: 24px;
}

.timeline.large .timeline-title {
    font-size: 16px;
    margin-bottom: 8px;
}

.timeline.large .timeline-description {
    font-size: 14px;
    margin-bottom: 12px;
}

.timeline.large .timeline-time {
    font-size: 13px;
}

/* Timeline Custom Icons */
.timeline-item.custom-icon::after {
    content: none;
    background-color: transparent;
    border: none;
    box-shadow: none;
}

.timeline-icon {
    position: absolute;
    left: 0;
    top: 0;
    width: 18px;
    height: 18px;
    background-color: #8B4513;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 1;
}

/* Timeline Actions */
.timeline-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.timeline-actions button,
.timeline-actions .btn {
    font-size: 12px;
    padding: 4px 8px;
}

/* Timeline Labels */
.timeline-label {
    position: absolute;
    left: -100px;
    top: 0;
    width: 80px;
    text-align: right;
    font-size: 12px;
    color: #666;
    font-weight: 500;
}

.timeline.with-labels .timeline-item {
    padding-left: 48px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .timeline.alternate .timeline-item {
        width: 100%;
        padding-left: 32px;
        padding-right: 0;
    }
    
    .timeline.alternate .timeline-item:nth-child(even) {
        margin-left: 0;
        padding-left: 32px;
        padding-right: 0;
    }
    
    .timeline.alternate .timeline-item::before {
        left: 8px;
        right: auto;
    }
    
    .timeline.alternate .timeline-item:nth-child(even)::before {
        left: 8px;
        right: auto;
    }
    
    .timeline.alternate .timeline-item::after {
        left: 4px;
        right: auto;
    }
    
    .timeline.alternate .timeline-item:nth-child(even)::after {
        left: 4px;
        right: auto;
    }
    
    .timeline.alternate .timeline-content {
        margin-left: 16px;
        margin-right: 0;
    }
    
    .timeline.alternate .timeline-item:nth-child(even) .timeline-content {
        margin-left: 16px;
        margin-right: 0;
    }
    
    .timeline.horizontal {
        flex-direction: column;
    }
    
    .timeline.horizontal .timeline-item {
        padding-left: 32px;
        padding-top: 0;
        margin-right: 0;
        margin-bottom: 24px;
        width: 100%;
    }
    
    .timeline.horizontal .timeline-item::before {
        left: 8px;
        top: 20px;
        bottom: -24px;
        width: 2px;
        height: auto;
        transform: none;
    }
    
    .timeline.horizontal .timeline-item::after {
        left: 4px;
        top: 4px;
        transform: none;
    }
    
    .timeline.horizontal .timeline-content {
        margin-left: 16px;
        margin-top: 0;
        text-align: left;
    }
    
    .timeline-label {
        position: static;
        width: auto;
        text-align: left;
        margin-bottom: 4px;
    }
    
    .timeline.with-labels .timeline-item {
        padding-left: 32px;
    }
}

/* Accessibility */
.timeline-item:focus {
    outline: 2px solid #8B4513;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .timeline-item::before {
        background-color: #000;
    }
    
    .timeline-item::after {
        border-color: #000;
        box-shadow: 0 0 0 2px #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .timeline-item.processing::after {
        animation: none;
    }
    
    @keyframes timelinePulse {
        0%, 100% {
            box-shadow: 0 0 0 2px #e8e8e8, 0 0 0 2px #1890ff;
        }
    }
}

/* Print Styles */
@media print {
    .timeline {
        break-inside: avoid;
    }
    
    .timeline-item {
        break-inside: avoid;
        margin-bottom: 16px;
    }
    
    .timeline-item::before {
        background-color: #000;
    }
    
    .timeline-item::after {
        border-color: #000;
        box-shadow: 0 0 0 1px #000;
    }
    
    .timeline-actions {
        display: none;
    }
}