/* =================================================================
   Magic & Animated Timeline Styles
   ================================================================= */

:root {
    --timeline-primary-color: #0ea5e9; /* Sky 500 - لون أكثر حيوية */
    --timeline-completed-color: #22c55e; /* Green 500 */
    --timeline-upcoming-color: #9ca3af; /* Gray 400 */
    --timeline-line-color: #e5e7eb; /* Gray 200 */
    --timeline-dark-line-color: #374151; /* Gray 700 */
}

html.dark {
    --timeline-line-color: var(--timeline-dark-line-color);
}

.timeline-widget-container .timeline-wrapper {
    overflow-x: auto;
    padding: 1rem 0;
    scrollbar-width: thin;
    scrollbar-color: var(--timeline-primary-color) #f1f5f9;
}

.timeline-list {
    display: flex;
    list-style: none;
    padding: 0 1rem;
    margin: 0;
    min-width: fit-content;
} 

.timeline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    padding: 0.5rem 1rem;
    min-width: 130px;
    text-align: center;
}

/* --- الخط السحري الذي يربط المراحل --- */
.timeline-item:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 1.1rem;
    left: 50%;
    width: 100%;
    height: 3px;
    background-color: var(--timeline-line-color);
    z-index: 1;
}

/* ✨ 1. الخط المتحرك: يظهر فقط بعد المرحلة الحالية ✨ */
.timeline-item.current::after {
    background: linear-gradient(to right, var(--timeline-primary-color) 50%, var(--timeline-line-color) 50%);
    background-size: 20px 3px;
    animation: loading-line 2s linear infinite;
}

@keyframes loading-line {
    0% { background-position: 0 0; }
    100% { background-position: -20px 0; }
}


.timeline-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #fff;
    border: 3px solid var(--timeline-upcoming-color);
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s ease-in-out;
}

html.dark .timeline-marker {
    background-color: var(--timeline-dark-line-color);
}


.timeline-content {
    margin-top: 0.75rem;
}

.timeline-title {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--timeline-upcoming-color);
    transition: all 0.3s ease;
}

html.dark .timeline-title {
    color: #d1d5db;
}

.timeline-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    line-height: 1.2;
}

/* --- حالات المراحل --- */

.timeline-item.completed .timeline-marker {
    background-color: var(--timeline-completed-color);
    border-color: var(--timeline-completed-color);
    color: white;
}
.timeline-item.completed .timeline-title { color: #1f2937; }
html.dark .timeline-item.completed .timeline-title { color: #f9fafb; }
.timeline-item.completed::after {
    background-color: var(--timeline-completed-color);
}

/* ✨ 2. النقطة المتوهجة: هالة دائرية حول المرحلة الحالية ✨ */
.timeline-item.current .timeline-marker {
    border-color: var(--timeline-primary-color);
    animation: glowing-dot 2s ease-in-out infinite;
}
.timeline-item.current .timeline-marker::before {
    content: '';
    width: 10px;
    height: 10px;
    background-color: var(--timeline-primary-color);
    border-radius: 50%;
}
.timeline-item.current .timeline-title {
    color: var(--timeline-primary-color);
    font-weight: 700;
}

@keyframes glowing-dot {
    0% { box-shadow: 0 0 5px rgba(14, 165, 233, 0.4); }
    50% { box-shadow: 0 0 20px rgba(14, 165, 233, 0.8); }
    100% { box-shadow: 0 0 5px rgba(14, 165, 233, 0.4); }
}

/* Add this to the end of custom-timeline-styles.css */
.summary-card { background: #fff; border-radius: 12px; box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1); margin-bottom: 1.5rem; }
html.dark .summary-card { background: #1f2937; }
.summary-content { display:flex; flex-wrap:wrap; justify-content:space-between; align-items:center; padding: 1.25rem; gap: 1rem; }
.summary-main-info { display:flex; align-items:center; gap: 1.5rem; flex-grow: 1; }
.summary-qr-code { text-align:center; font-weight:700; color:#374151; }
html.dark .summary-qr-code { color: #d1d5db; }
.summary-details { display:grid; grid-template-columns: repeat(2, 1fr); gap: 1rem 2rem; }
.summary-item { display:flex; align-items:center; gap: 0.5rem; font-size:0.9rem; }
.summary-item.current-stage span { font-weight: 700; color: var(--timeline-primary-color); }
.summary-icon { width: 20px; height: 20px; color: #9ca3af; }
.summary-actions-and-total { display: flex; align-items: center; gap: 1.5rem; }
.summary-actions { display:flex; gap: 0.5rem; }
.summary-total { text-align:right; border-right: 1px solid #e5e7eb; padding-right: 1.5rem; }
html.dark .summary-total { border-color: #374151; }
.summary-total p { margin:0; font-size:0.9rem; color:#6b7280; }
.summary-total strong { font-size: 1.75rem; font-weight: 800; color: #16a34a; }
.priority-icon-urgent { color: #ef4444 !important; } .priority-icon-high { color: #f97316 !important; }
.priority-badge-urgent { background-color: #fee2e2; color: #b91c1c; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.priority-badge-high { background-color: #ffedd5; color: #c2410c; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.priority-badge-normal { background-color: #dbeafe; color: #1d4ed8; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.priority-badge-low { background-color: #f3f4f6; color: #4b5563; padding: 2px 8px; border-radius: 6px; font-weight: 600; }

.view-order-grid { display:grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 1024px) { .view-order-grid { grid-template-columns: 2fr 1fr; } }
.sidebar-content { display: flex; flex-direction: column; gap: 1.5rem; }
.section-icon { width: 1.2rem; height: 1.2rem; display: inline-block; margin-inline-end: 0.5rem; }
.sidebar-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1rem; align-items: center; }

/* Tabs Styling */
.tabs-container { display: flex; border-bottom: 1px solid #e5e7eb; margin-bottom: 1.5rem; }
html.dark .tabs-container { border-color: #374151; }
.tabs-container button { padding: 0.75rem 1rem; border: none; background: none; cursor: pointer; display: flex; align-items: center; gap: 0.5rem; font-weight: 500; color: #6b7280; border-bottom: 2px solid transparent; }
html.dark .tabs-container button { color: #9ca3af; }
.tabs-container button.active { color: var(--timeline-primary-color); border-bottom-color: var(--timeline-primary-color); }
.tab-content [x-cloak] { display: none; }