/* CRM Timeline and Analytics Styles */

/* Metric Cards */
.metric-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.metric-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.875rem;
    color: #6c757d;
    font-weight: 500;
}

/* Timeline Styles */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e9ecef;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.875rem;
    z-index: 1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.timeline-content {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    padding: 1rem;
    margin-left: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.3s ease;
}

.timeline-content:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.timeline-content h6 {
    margin-bottom: 0.5rem;
    color: #495057;
    font-weight: 600;
}

.timeline-content p {
    margin-bottom: 0.5rem;
    color: #6c757d;
    line-height: 1.4;
}

/* Sales Timeline specific styles */
.sales-timeline {
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #6c757d #f8f9fa;
}

.sales-timeline::-webkit-scrollbar {
    width: 6px;
}

.sales-timeline::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.sales-timeline::-webkit-scrollbar-thumb {
    background: #6c757d;
    border-radius: 3px;
}

.sales-timeline-item {
    border-left: 3px solid #007bff;
    padding-left: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.sales-timeline-item:hover {
    border-left-color: #0056b3;
    background-color: #f8f9fa;
    margin-left: 0.25rem;
}

.sales-timeline-item:last-child {
    border-bottom: none;
}

.sales-timeline-date {
    font-weight: 600;
    color: #007bff;
    font-size: 0.9rem;
}

.sales-timeline-amount {
    font-weight: 700;
    color: #28a745;
    font-size: 1.1rem;
}

.sales-timeline-products {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

/* Customer Analytics Cards */
.analytics-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.analytics-score {
    font-size: 3rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.analytics-label {
    text-align: center;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.analytics-description {
    text-align: center;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Communication Features */
.communication-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.quick-action-btn {
    transition: all 0.3s ease;
    border-radius: 0.5rem;
    position: relative;
    overflow: hidden;
}

.quick-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.quick-action-btn:hover::before {
    left: 100%;
}

.quick-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Follow-up Plans */
.follow-up-item {
    padding: 0.75rem;
    border-radius: 0.375rem;
    background: #f8f9fa;
    margin-bottom: 0.5rem;
    border-left: 3px solid #007bff;
    transition: all 0.3s ease;
}

.follow-up-item:hover {
    background: #e9ecef;
    transform: translateX(4px);
}

.follow-up-date {
    font-size: 0.8rem;
    color: #007bff;
    font-weight: 500;
}

/* Enhanced modal for customer details */
.customer-detail-modal .modal-dialog {
    max-width: 90%;
}

.customer-detail-modal .modal-content {
    border-radius: 1rem;
    overflow: hidden;
}

.customer-detail-modal .nav-tabs {
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
    margin: 0;
    padding: 0.5rem 1rem 0;
}

.customer-detail-modal .nav-link {
    border: none;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    border-radius: 0.5rem 0.5rem 0 0;
    margin-right: 0.25rem;
}

.customer-detail-modal .nav-link:hover {
    background: rgba(0, 123, 255, 0.1);
    color: #007bff;
}

.customer-detail-modal .nav-link.active {
    background: white;
    border-bottom-color: #007bff;
    color: #007bff;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.1);
}

.customer-detail-modal .tab-content {
    padding: 1.5rem;
    min-height: 500px;
    background: white;
}

/* Customer Info Header */
.customer-info-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.customer-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin-right: 1rem;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .timeline {
        padding-left: 1.5rem;
    }
    
    .timeline::before {
        left: 0.75rem;
    }
    
    .timeline-marker {
        left: -1.5rem;
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.75rem;
    }
    
    .timeline-content {
        margin-left: 0.75rem;
    }
    
    .customer-detail-modal .modal-dialog {
        max-width: 95%;
        margin: 0.5rem auto;
    }
    
    .metric-card {
        margin-bottom: 0.75rem;
    }
    
    .metric-value {
        font-size: 1.25rem;
    }
    
    .communication-actions {
        flex-direction: column;
    }
    
    .quick-action-btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Animation for charts loading */
@keyframes chartFade {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.chart-container {
    animation: chartFade 0.5s ease-in-out;
    position: relative;
}

.chart-container canvas {
    border-radius: 0.375rem;
}

/* Loading state for charts */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: #6c757d;
}

.chart-loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Advanced Analytics */
.analytics-insight {
    background: #f8f9fa;
    border-left: 4px solid #28a745;
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 0 0.375rem 0.375rem 0;
}

.analytics-insight.warning {
    border-left-color: #ffc107;
}

.analytics-insight.danger {
    border-left-color: #dc3545;
}

.analytics-insight h6 {
    color: #495057;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.analytics-insight p {
    margin-bottom: 0;
    color: #6c757d;
    line-height: 1.4;
}

/* Customer Status Badges */
.customer-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.customer-status.vip {
    background: linear-gradient(135deg, #ffd700, #ffb347);
    color: #8b4513;
}

.customer-status.loyal {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.customer-status.new {
    background: linear-gradient(135deg, #007bff, #17a2b8);
    color: white;
}

.customer-status.inactive {
    background: linear-gradient(135deg, #6c757d, #adb5bd);
    color: white;
}