/* Order Timeline Styles */
.order-timeline-container {
    position: relative;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.timeline-header {
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.timeline-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Emphasize the top header title (not the per-item titles) */
.order-timeline-container > .timeline-header .timeline-title {
    color: #667eea;
}

.timeline-controls .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Metrics Summary */
.metrics-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 1.5rem;
    color: white;
}

.metric-card {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.metric-icon {
    font-size: 1.5rem;
    opacity: 0.9;
}

.metric-content {
    flex: 1;
}

.metric-value {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.75rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Filters Panel */
.filters-panel .card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: none;
}

.filters-panel .card-body {
    padding: 1rem;
}

.filters-panel .form-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

/* Timeline Events */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #e5e7eb, #d1d5db);
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0.5rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timeline-icon {
    font-size: 0.75rem;
    color: white;
}

/* Timeline Item Types */
.timeline-major .timeline-marker {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.timeline-success .timeline-marker {
    background: linear-gradient(135deg, #7CB342, #388E3C);
}

.timeline-warning .timeline-marker {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.timeline-error .timeline-marker {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.timeline-info .timeline-marker {
    background: linear-gradient(135deg, #a5b4fc, #818cf8);
}

.timeline-minor .timeline-marker {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* Timeline Content */
.timeline-content {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.timeline-content:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.timeline-header {
    margin-bottom: 0.75rem;
}

.timeline-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.timeline-meta > span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.timeline-description {
    font-size: 0.875rem;
    color: #4b5563;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.timeline-status {
    margin-bottom: 0.75rem;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-accepted {
    background: #E8F5E9;
    color: #388E3C;
}

.status-rejected, .status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.status-ready {
    background: #F1F8E9;
    color: #558B2F;
}

.status-delivered, .status-completed {
    background: #C8E6C9;
    color: #2E7D32;
}

.status-default {
    background: #f3f4f6;
    color: #374151;
}

/* Timeline Details */
.timeline-details {
    margin-top: 0.75rem;
}

.details-summary {
    cursor: pointer;
    font-size: 0.75rem;
    color: #667eea;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    user-select: none;
    padding: 0.5rem 0;
    border-top: 1px solid #e5e7eb;
}

.details-summary:hover {
    color: #764ba2;
}

.event-data {
    margin-top: 0.5rem;
    background: #f9fafb;
    border-radius: 4px;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
}

.event-data-json {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    color: #374151;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Empty Timeline */
.empty-timeline {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.empty-timeline i {
    margin-bottom: 1rem;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    backdrop-filter: blur(2px);
    z-index: 10;
}

.loading-content {
    text-align: center;
    color: #6b7280;
}

/* Responsive Design */
@media (max-width: 768px) {
    .order-timeline-container {
        padding: 1rem;
        margin: 0 -1rem 2rem -1rem;
        border-radius: 0;
    }

    .timeline-header {
        flex-direction: column;
        gap: 1rem;
    }

    .timeline-controls {
        width: 100%;
    }

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

    .timeline-controls .btn {
        flex: 1;
    }

    .metrics-summary {
        margin: 0 -1rem 1.5rem -1rem;
        border-radius: 0;
    }

    .metric-card {
        padding: 0.75rem;
    }

    .metric-value {
        font-size: 1rem;
    }

    .timeline {
        padding-left: 1.5rem;
    }

    .timeline::before {
        left: 0.75rem;
    }

    .timeline-marker {
        left: -1.5rem;
        width: 1.5rem;
        height: 1.5rem;
    }

    .timeline-icon {
        font-size: 0.625rem;
    }

    .timeline-meta {
        flex-direction: column;
        gap: 0.5rem;
    }

    .timeline-content {
        padding: 0.75rem;
    }
}

/* Animation */
.timeline-item {
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Badge Styling */
.badge {
    font-size: 0.625rem;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
}

.badge.bg-secondary {
    background-color: #6b7280 !important;
}

.badge.bg-info {
    background-color: #0ea5e9 !important;
}

/* Print Styles */
@media print {
    .timeline-controls,
    .filters-panel {
        display: none !important;
    }

    .order-timeline-container {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    .timeline-content {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }
}
