/**
 * Activity Timeline Styles
 * تصميم نافذة Timeline للتعديلات الأخيرة
 */

/* زر فتح Timeline */
.activity-timeline-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 14px;
    transition: all 0.3s ease;
}

.activity-timeline-btn i {
    font-size: 16px;
}

.activity-timeline-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.activity-timeline-btn .activity-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    animation: badgePulse 2s infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* النافذة المنبثقة */
.activity-timeline-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.activity-timeline-modal.active {
    display: flex;
    opacity: 1;
}

.activity-timeline-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.activity-timeline-content {
    position: relative;
    width: 600px;
    max-width: 90vw;
    height: 80vh;
    max-height: 800px;
    margin: auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease;
    overflow: hidden;
}

@keyframes slideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* الرأس */
.activity-timeline-header {
    padding: 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.activity-timeline-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.activity-timeline-header h2 i {
    font-size: 24px;
}

.activity-timeline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.activity-filter-btn,
.activity-clear-btn,
.activity-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.activity-filter-btn:hover,
.activity-clear-btn:hover,
.activity-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.activity-filter-btn.active {
    background: white;
    color: #667eea;
    font-weight: 600;
}

.activity-clear-btn,
.activity-close-btn {
    padding: 6px 10px;
}

.activity-close-btn {
    background: rgba(231, 76, 60, 0.3);
    border-color: rgba(231, 76, 60, 0.5);
}

.activity-close-btn:hover {
    background: rgba(231, 76, 60, 0.5);
}

/* الجسم */
.activity-timeline-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8f9fa;
}

.activity-timeline-body::-webkit-scrollbar {
    width: 8px;
}

.activity-timeline-body::-webkit-scrollbar-track {
    background: #e9ecef;
}

.activity-timeline-body::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 4px;
}

.activity-timeline-body::-webkit-scrollbar-thumb:hover {
    background: #6c757d;
}

/* قائمة الأنشطة */
.activity-timeline-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.activity-day-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-day-header {
    font-size: 13px;
    font-weight: 700;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-bottom: 8px;
    border-bottom: 2px solid #dee2e6;
}

/* عنصر النشاط */
.activity-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.activity-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 100%;
    background: var(--activity-color, #3498db);
    transition: width 0.3s ease;
}

.activity-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.activity-item:hover::before {
    width: 6px;
}

.activity-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.activity-header strong {
    font-size: 15px;
    color: #2c3e50;
    font-weight: 600;
}

.activity-time {
    font-size: 12px;
    color: #95a5a6;
    white-space: nowrap;
}

.activity-description {
    font-size: 14px;
    color: #7f8c8d;
    line-height: 1.5;
    margin-bottom: 8px;
}

.activity-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.meta-item {
    background: #ecf0f1;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    color: #34495e;
}

.meta-item strong {
    color: #2c3e50;
    margin-left: 4px;
}

/* حالة فارغة */
.activity-timeline-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #95a5a6;
    text-align: center;
}

.activity-timeline-empty i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.activity-timeline-empty p {
    font-size: 16px;
    margin: 0;
}

/* ألوان حسب النوع */
.activity-item[data-type="clients"] {
    --activity-color: #2ecc71;
}

.activity-item[data-type="documents"] {
    --activity-color: #3498db;
}

.activity-item[data-type="tasks"] {
    --activity-color: #f39c12;
}

.activity-item[data-type="chat"] {
    --activity-color: #9b59b6;
}

.activity-item[data-type="general"] {
    --activity-color: #95a5a6;
}

/* Responsive */
@media (max-width: 768px) {
    .activity-timeline-content {
        width: 95vw;
        height: 90vh;
        border-radius: 12px;
    }

    .activity-timeline-header {
        padding: 16px;
    }

    .activity-timeline-header h2 {
        font-size: 18px;
    }

    .activity-timeline-actions {
        flex-wrap: wrap;
        gap: 4px;
    }

    .activity-filter-btn {
        font-size: 11px;
        padding: 4px 8px;
    }

    .activity-filter-btn span {
        display: none;
    }

    .activity-timeline-body {
        padding: 16px;
    }

    .activity-item {
        padding: 12px;
    }

    .activity-icon {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .activity-header strong {
        font-size: 14px;
    }

    .activity-description {
        font-size: 13px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .activity-timeline-content {
        background: #1a1a2e;
        color: #eee;
    }

    .activity-timeline-body {
        background: #16213e;
    }

    .activity-item {
        background: #0f3460;
        color: #eee;
    }

    .activity-header strong {
        color: #fff;
    }

    .activity-description {
        color: #bdc3c7;
    }

    .activity-day-header {
        color: #95a5a6;
        border-bottom-color: #34495e;
    }

    .meta-item {
        background: #16213e;
        color: #ecf0f1;
    }

    .meta-item strong {
        color: #fff;
    }

    .activity-timeline-body::-webkit-scrollbar-track {
        background: #0f3460;
    }

    .activity-timeline-body::-webkit-scrollbar-thumb {
        background: #95a5a6;
    }
}

/* تحسينات إضافية */
.activity-item.new {
    animation: highlight 1s ease;
}

@keyframes highlight {
    0%, 100% {
        background: white;
    }
    50% {
        background: #fff3cd;
    }
}

/* Loading State */
.activity-timeline-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #95a5a6;
}

.activity-timeline-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid #ecf0f1;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
