/* ===================================================================
   CUSTOMERS PAGE - FILTERS & SEARCH
   =================================================================== */

/* Filters Bar */
.filters-bar-v2 {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-bottom: 20px;
    position: relative;
    z-index: 10;
}

/* Filters Layout */
.filters-bar-v2 > * {
    margin-bottom: 12px;
}

.filters-bar-v2 > *:last-child {
    margin-bottom: 0;
}

/* Search Box */
.search-box-v2 {
    position: relative;
    width: 100%;
    margin-bottom: 16px;
}

.search-box-v2 i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #6C757D;
    font-size: 14px;
}

.search-box-v2 input {
    width: 100%;
    padding: 12px 16px 12px 45px;
    border: 1px solid #DEE2E6;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-box-v2 input:focus {
    outline: none;
    border-color: #0066CC;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.search-box-v2 input::placeholder {
    color: #ADB5BD;
}

/* Filters Group */
.filters-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    align-items: start;
}

.filter-select {
    width: 100%;
    padding: 12px 36px 12px 14px;
    border: 1px solid #DEE2E6;
    border-radius: 8px;
    font-size: 14px;
    color: #495057;
    background: #fff url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"><path fill="%23495057" d="M6 9L1 4h10z"/></svg>') no-repeat right 12px center;
    background-size: 12px;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1.5;
}

.filter-select:hover {
    border-color: #ADB5BD;
}

.filter-select:focus {
    outline: none;
    border-color: #0066CC;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
    position: relative;
    z-index: 100;
}

/* Ensure dropdowns don't overflow or cover other elements */
.filter-select option {
    padding: 8px 12px;
}

/* Stats Summary Bar - REDESIGNED with Enhanced Colors */
.stats-summary-bar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #0066CC 0%, #0052A3 100%);
    border-radius: 12px;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0, 102, 204, 0.25);
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

/* Subtle gradient overlay for each card */
.stat-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent 70%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-item:hover::after {
    opacity: 1;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 20px 16px;
    min-height: 110px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
}

/* Color variations for each stat card */
.stat-item:nth-child(1) {
    /* TỔNG KH - Blue */
    background: rgba(33, 150, 243, 0.15);
    border-color: rgba(33, 150, 243, 0.3);
}

.stat-item:nth-child(1)::before {
    background: linear-gradient(90deg, #2196F3, #1976D2);
}

.stat-item:nth-child(1):hover {
    background: rgba(33, 150, 243, 0.25);
    border-color: rgba(33, 150, 243, 0.5);
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.3);
}

.stat-item:nth-child(2) {
    /* ĐIỂM TB - Purple */
    background: rgba(156, 39, 176, 0.15);
    border-color: rgba(156, 39, 176, 0.3);
}

.stat-item:nth-child(2)::before {
    background: linear-gradient(90deg, #9C27B0, #7B1FA2);
}

.stat-item:nth-child(2):hover {
    background: rgba(156, 39, 176, 0.25);
    border-color: rgba(156, 39, 176, 0.5);
    box-shadow: 0 8px 20px rgba(156, 39, 176, 0.3);
}

.stat-item:nth-child(3) {
    /* HEALTHY - Green */
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
}

.stat-item:nth-child(3)::before {
    background: linear-gradient(90deg, #4CAF50, #388E3C);
}

.stat-item:nth-child(3):hover {
    background: rgba(76, 175, 80, 0.25);
    border-color: rgba(76, 175, 80, 0.5);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.3);
}

.stat-item:nth-child(4) {
    /* AT RISK - Orange */
    background: rgba(255, 152, 0, 0.15);
    border-color: rgba(255, 152, 0, 0.3);
}

.stat-item:nth-child(4)::before {
    background: linear-gradient(90deg, #FF9800, #F57C00);
}

.stat-item:nth-child(4):hover {
    background: rgba(255, 152, 0, 0.25);
    border-color: rgba(255, 152, 0, 0.5);
    box-shadow: 0 8px 20px rgba(255, 152, 0, 0.3);
}

.stat-item:nth-child(5) {
    /* CRITICAL - Red */
    background: rgba(244, 67, 54, 0.15);
    border-color: rgba(244, 67, 54, 0.3);
}

.stat-item:nth-child(5)::before {
    background: linear-gradient(90deg, #F44336, #D32F2F);
}

.stat-item:nth-child(5):hover {
    background: rgba(244, 67, 54, 0.25);
    border-color: rgba(244, 67, 54, 0.5);
    box-shadow: 0 8px 20px rgba(244, 67, 54, 0.3);
}

.stat-item:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
}

.stat-item:hover::before {
    height: 5px;
    background: rgba(255, 255, 255, 0.8);
}

.stat-item i {
    font-size: 36px;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 6px;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.stat-item:hover i {
    transform: scale(1.15);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

/* Icon glow effects for each card */
.stat-item:nth-child(1) i {
    filter: drop-shadow(0 2px 4px rgba(33, 150, 243, 0.4));
}

.stat-item:nth-child(2) i {
    filter: drop-shadow(0 2px 4px rgba(156, 39, 176, 0.4));
}

.stat-item:nth-child(3) i {
    filter: drop-shadow(0 2px 4px rgba(76, 175, 80, 0.4));
}

.stat-item:nth-child(4) i {
    filter: drop-shadow(0 2px 4px rgba(255, 152, 0, 0.4));
}

.stat-item:nth-child(5) i {
    filter: drop-shadow(0 2px 4px rgba(244, 67, 54, 0.4));
}

.stat-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
    gap: 6px;
}

.stat-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.95);
    font-weight: 700;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.stat-value {
    font-size: 36px;
    font-weight: 800;
    line-height: 1;
    color: #FFFFFF;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.1);
    letter-spacing: -0.5px;
}

.stat-divider {
    display: none;
}

/* Customers Grid Enhanced */
.customers-grid-v2 {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 24px;
    margin-top: 0;
}

.customer-card-v2 {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: visible;
}

.customer-card-v2:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #0066CC;
}

.customer-card-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.customer-avatar-v2 {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0066CC, #3399FF);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}

.customer-info-basic h3 {
    font-size: 18px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 8px 0;
}

.customer-meta {
    font-size: 13px;
    color: #6C757D;
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.customer-meta i {
    color: #ADB5BD;
    width: 14px;
}

.separator {
    color: #DEE2E6;
}

/* Engagement Score Mini */
.customer-card-metrics {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.engagement-score-mini {
    position: relative;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-value {
    font-size: 20px;
    font-weight: 700;
    color: #212529;
}

/* Status Badges */
.customer-status-badges {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.health-badge i {
    font-size: 12px;
}

.health-healthy {
    background: #D4EDDA;
    color: #155724;
}

.health-at-risk {
    background: #FFF3CD;
    color: #856404;
}

.health-critical {
    background: #F8D7DA;
    color: #721C24;
}

.metric-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #495057;
    padding: 4px 0;
}

.metric-badge i {
    color: #0066CC;
    width: 16px;
}

/* MSO Badge */
.mso-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #E6F2FF;
    color: #0066CC;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
}

.mso-badge i {
    font-size: 11px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.empty-state i {
    display: block;
    margin-bottom: 16px;
}

.empty-state p {
    color: #6C757D;
    font-size: 16px;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 1200px) {
    .filters-group {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    .customers-grid-v2 {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
    
    .filters-group {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 1024px) {
    .stats-summary-bar {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .stat-item:nth-child(4),
    .stat-item:nth-child(5) {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .filters-bar-v2 {
        padding: 16px;
    }
    
    .search-box-v2 {
        width: 100%;
    }
    
    .filters-group {
        grid-template-columns: 1fr;
    }
    
    .filter-select {
        width: 100%;
    }
    
    .customers-grid-v2 {
        grid-template-columns: 1fr;
    }
    
    .stats-summary-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 12px;
    }
    
    .stat-item {
        padding: 16px 12px;
        min-height: 95px;
    }
    
    .stat-item i {
        font-size: 28px;
    }
    
    .stat-value {
        font-size: 28px;
        font-weight: 800;
    }
    
    .stat-label {
        font-size: 11px;
        letter-spacing: 0.8px;
    }
}
    
    .stat-divider {
        display: none;
    }
}

/* Loading State */
.customers-loading {
    text-align: center;
    padding: 40px;
    color: #6C757D;
}

.customers-loading i {
    font-size: 32px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* No Results */
.no-results {
    text-align: center;
    padding: 40px 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.no-results i {
    font-size: 48px;
    color: #ADB5BD;
    margin-bottom: 16px;
}

.no-results h3 {
    color: #495057;
    margin-bottom: 8px;
}

.no-results p {
    color: #6C757D;
    font-size: 14px;
}

/* ======================
   ACTIVITY TIMELINE BADGES
   ====================== */

/* Priority Badges */
.priority-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    margin-left: 8px;
}

.priority-badge.priority-high {
    background: #FEE2E2;
    color: #991B1B;
}

.priority-badge.priority-medium {
    background: #FEF3C7;
    color: #92400E;
}

.priority-badge.priority-low {
    background: #D1FAE5;
    color: #065F46;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
    margin-left: 8px;
}

.status-badge.status-pending {
    background: #F3F4F6;
    color: #4B5563;
}

.status-badge.status-in-progress,
.status-badge.status-in_progress {
    background: #DBEAFE;
    color: #1E40AF;
}

.status-badge.status-completed {
    background: #D1FAE5;
    color: #065F46;
}

/* Timeline Meta Info */
.timeline-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    font-size: 13px;
    color: #6C757D;
}

.timeline-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.timeline-meta i {
    font-size: 12px;
    color: #ADB5BD;
}
