/* ==================== Fixed Timeline Container ==================== */
.syncfusion-timeline-container {
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 20px;
}

/* ==================== Enhanced Header ==================== */
.timeline-header {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border-left: 4px solid #3b82f6;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-icon {
    font-size: 32px;
    color: #3b82f6;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    padding: 10px;
    border-radius: 10px;
}

.header-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.header-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 10px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: #3b82f6;
    line-height: 1;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ==================== Enhanced Filter Section ==================== */
.sf-timeline-filters {
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    flex-shrink: 0;
}

.filter-row {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #0f172a;
    font-size: 13px;
    white-space: nowrap;
}

.filter-icon {
    font-size: 18px;
    color: #3b82f6;
}

.patient-filter {
    min-width: 240px;
    flex: 1;
    max-width: 350px;
}

.filter-actions {
    margin-left: auto;
}

.refresh-btn {
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3) !important;
}

/* ==================== Enhanced Chip List ==================== */
.custom-chip-list .e-chip {
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.chip-content {
    display: flex;
    align-items: center;
    gap: 5px;
}

.chip-icon {
    font-size: 16px;
}

.e-chip-all {
    background: #f1f5f9 !important;
    color: #475569 !important;
}

.e-chip-all.e-active {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4) !important;
    border-color: #1e40af !important;
}

.e-chip-notes {
    background: #f0fdf4 !important;
    color: #059669 !important;
}

.e-chip-notes.e-active {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4) !important;
    border-color: #047857 !important;
}

.e-chip-labs {
    background: #fdf2f8 !important;
    color: #db2777 !important;
}

.e-chip-labs.e-active {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4) !important;
    border-color: #be185d !important;
}

.e-chip-xrays {
    background: #fffbeb !important;
    color: #d97706 !important;
}

.e-chip-xrays.e-active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important;
    border-color: #b45309 !important;
}

/* ==================== Timeline Wrapper ==================== */
.sf-timeline-wrapper {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px;
    min-height: 0;
}

/* Enhanced Scrollbar */
.sf-timeline-wrapper::-webkit-scrollbar {
    width: 8px;
}

.sf-timeline-wrapper::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.sf-timeline-wrapper::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
    border-radius: 4px;
    border: 2px solid #f1f5f9;
}

.sf-timeline-wrapper::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
}

/* ==================== Loading & Empty States ==================== */
.timeline-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #64748b;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.timeline-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-illustration {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    padding: 28px;
    border-radius: 50%;
    margin-bottom: 20px;
}

.empty-icon {
    font-size: 70px;
    color: #cbd5e1;
}

.timeline-empty h3 {
    font-size: 20px;
    font-weight: 700;
    color: #475569;
    margin: 0 0 10px 0;
}

.timeline-empty p {
    font-size: 14px;
    color: #94a3b8;
    max-width: 400px;
    line-height: 1.6;
}

/* ==================== Syncfusion Timeline Customization ==================== */
.medical-timeline.e-timeline {
    padding: 0;
}

.medical-timeline .e-timeline-item {
    margin-bottom: 28px;
}

/* Custom Dot Styles */
.medical-timeline .timeline-dot-notes {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    border: 3px solid #d1fae5 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15), 0 4px 10px rgba(16, 185, 129, 0.3) !important;
    width: 20px !important;
    height: 20px !important;
}

.medical-timeline .timeline-dot-labs {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%) !important;
    border: 3px solid #fce7f3 !important;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15), 0 4px 10px rgba(236, 72, 153, 0.3) !important;
    width: 20px !important;
    height: 20px !important;
}

.medical-timeline .timeline-dot-xrays {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    border: 3px solid #fed7aa !important;
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15), 0 4px 10px rgba(245, 158, 11, 0.3) !important;
    width: 20px !important;
    height: 20px !important;
}

/* ==================== Enhanced Timeline Cards ==================== */
.timeline-custom-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 2px solid transparent;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.timeline-custom-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #e2e8f0 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.timeline-custom-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    transform: translateY(-3px);
    border-color: #e2e8f0;
}

.timeline-custom-card:hover::before {
    opacity: 1;
}

.timeline-item-notes .timeline-custom-card:hover {
    border-color: #10b981;
}

.timeline-item-notes .timeline-custom-card:hover::before {
    background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.timeline-item-labs .timeline-custom-card:hover {
    border-color: #ec4899;
}

.timeline-item-labs .timeline-custom-card:hover::before {
    background: linear-gradient(90deg, #ec4899 0%, #db2777 100%);
}

.timeline-item-xrays .timeline-custom-card:hover {
    border-color: #f59e0b;
}

.timeline-item-xrays .timeline-custom-card:hover::before {
    background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

/* Card Header */
.timeline-card-header-section {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.timeline-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.timeline-icon-badge .material-icons {
    font-size: 24px;
    color: white;
}

.icon-notes {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.icon-labs {
    background: linear-gradient(135deg, #ec4899 0%, #db2777 100%);
}

.icon-xrays {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.timeline-info-section {
    flex: 1;
    min-width: 0;
}

.timeline-card-title {
    font-size: 17px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 8px 0;
}

.timeline-patient-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #475569;
    font-weight: 500;
}

.patient-icon {
    font-size: 16px;
    color: #3b82f6;
}

.patient-id {
    color: #64748b;
    font-weight: 400;
}

.timeline-date-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 14px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 10px;
    min-width: 75px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

.date-primary {
    font-size: 17px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1;
}

.date-secondary {
    font-size: 11px;
    color: #64748b;
    margin-top: 2px;
    font-weight: 600;
}

.time-info {
    font-size: 10px;
    color: #94a3b8;
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px solid #cbd5e1;
    font-weight: 600;
}

/* Card Content */
.timeline-card-description {
    font-size: 13px;
    color: #64748b;
    margin-bottom: 16px;
    line-height: 1.6;
    padding-left: 64px;
}

/* Enhanced Image Preview */
.timeline-image-preview {
    position: relative;
    width: calc(100% - 64px);
    max-width: 400px;
    height: 200px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    margin-bottom: 16px;
    margin-left: 64px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.timeline-image-preview:hover {
    border-color: #3b82f6;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.2);
}

.timeline-image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.timeline-image-preview:hover img {
    transform: scale(1.06);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.timeline-image-preview:hover .image-overlay {
    background: rgba(0, 0, 0, 0.6);
}

.image-overlay .material-icons {
    color: white;
    font-size: 48px;
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.3s ease;
}

.overlay-text {
    color: white;
    font-size: 13px;
    font-weight: 700;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.3s ease;
}

.timeline-image-preview:hover .image-overlay .material-icons,
.timeline-image-preview:hover .overlay-text {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Card Footer */
.timeline-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 2px solid #f1f5f9;
    margin-top: 4px;
}

.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}

.type-badge .material-icons {
    font-size: 16px;
}

.badge-notes {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #047857;
}

.badge-labs {
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
    color: #be185d;
}

.badge-xrays {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #b45309;
}

/* Enhanced Action Buttons */
.timeline-actions-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    transition: all 0.2s ease !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    font-size: 12px !important;
}

.view-btn {
    border-color: #3b82f6 !important;
    color: #3b82f6 !important;
}

.view-btn:hover {
    background: #3b82f6 !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3) !important;
}

.edit-btn {
    border-color: #10b981 !important;
    color: #10b981 !important;
}

.edit-btn:hover {
    background: #10b981 !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3) !important;
}

.delete-btn {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

.delete-btn:hover {
    background: #ef4444 !important;
    color: white !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3) !important;
}

/* ==================== Enhanced Dialog Styles ==================== */
.timeline-detail-dialog .e-dialog {
    border-radius: 16px !important;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3) !important;
}

.timeline-detail-dialog .e-dlg-header-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
    border-bottom: 2px solid #e2e8f0 !important;
    padding: 20px !important;
}

.enhanced-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.dialog-icon-wrapper {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dialog-icon-wrapper .material-icons {
    font-size: 28px;
    color: white;
}

.dialog-title-section h3 {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 4px 0;
}

.dialog-subtitle {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.type-badge-large {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 700;
}

.type-badge-large .material-icons {
    font-size: 18px;
}

/* Dialog Content */
.enhanced-dialog-content {
    padding: 24px;
    background: #f8fafc;
    max-height: calc(90vh - 200px);
    overflow-y: auto;
}

.detail-full-image-container {
    margin-bottom: 24px;
    border-radius: 14px;
    overflow: hidden;
    border: 2px solid #e2e8f0;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.detail-full-image {
    width: 100%;
    height: auto;
    max-height: 450px;
    object-fit: contain;
    background: white;
    display: block;
}

.info-sections-wrapper {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-info-section {
    background: white;
    padding: 20px;
    border-radius: 14px;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f1f5f9;
}

.section-header .material-icons {
    font-size: 24px;
    color: #3b82f6;
}

.section-header h5 {
    font-size: 16px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}

.detail-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.detail-info-item {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.detail-info-item.full-width {
    grid-column: 1 / -1;
}

.detail-info-item label {
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.detail-info-item span {
    font-size: 14px;
    color: #0f172a;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    font-weight: 500;
}

.text-content {
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Enhanced Dialog Footer */
.timeline-detail-dialog .e-footer-content {
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%) !important;
    border-top: 2px solid #e2e8f0 !important;
    padding: 18px 24px !important;
}

.enhanced-dialog-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left {
    display: flex;
    align-items: center;
}

.last-modified {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
}

.footer-actions {
    display: flex;
    gap: 10px;
}

.edit-dialog-btn,
.close-dialog-btn {
    padding: 10px 20px !important;
    font-weight: 700 !important;
    border-radius: 8px !important;
    transition: all 0.2s ease !important;
}

.edit-dialog-btn:hover {
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4) !important;
    transform: translateY(-2px) !important;
}

.close-dialog-btn:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
}

/* Priority & Status Badges */
.priority-badge,
.result-status {
    display: inline-block !important;
    padding: 5px 12px !important;
    border-radius: 14px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    border: none !important;
}

.priority-routine {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%) !important;
    color: #1e40af !important;
}

.priority-urgent {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%) !important;
    color: #9a3412 !important;
}

.priority-stat, .priority-emergency {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%) !important;
    color: #991b1b !important;
}

.result-normal {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
    color: #065f46 !important;
}

.result-abnormal {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%) !important;
    color: #9a3412 !important;
}

.result-critical {
    background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%) !important;
    color: #991b1b !important;
}

/* ==================== Toast Customization ==================== */
.custom-toast .e-toast-message {
    border-radius: 10px !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15) !important;
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    .syncfusion-timeline-container {
        padding: 12px;
    }

    .header-content {
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
    }

    .header-left {
        justify-content: center;
    }

    .header-stats {
        justify-content: center;
    }

    .sf-timeline-filters {
        padding: 14px;
    }

    .filter-row {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }

    .patient-filter {
        min-width: 100%;
        max-width: 100%;
    }

    .filter-actions {
        margin-left: 0;
    }

    .timeline-card-header-section {
        flex-direction: column;
    }

    .timeline-date-badge {
        align-self: flex-start;
    }

    .timeline-card-description,
    .timeline-image-preview {
        margin-left: 0;
        padding-left: 0;
        width: 100%;
    }

    .timeline-card-footer {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .timeline-actions-group {
        flex-direction: column;
    }

    .action-btn {
        width: 100%;
    }

    .detail-info-grid {
        grid-template-columns: 1fr;
    }

    .enhanced-dialog-header {
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
    }

    .enhanced-dialog-footer {
        flex-direction: column;
        gap: 14px;
        align-items: stretch;
    }

    .footer-actions {
        flex-direction: column;
    }
}
