/* ===== SALESFORCE PIPELINE PAGE SPECIFIC OVERRIDES ===== */

/* Analytics dashboard container should use full width */
#salesforce-pipeline .analytics-dashboard {
    width: 100%;
    max-width: 100%;
}

/* Analytics section should use full width */
#salesforce-pipeline .analytics-section {
    width: 100%;
    max-width: 100%;
}

/* Ensure Salesforce page analytics grid uses full width */
#salesforce-pipeline .analytics-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-bottom: 2rem;
}

#salesforce-pipeline .analytics-grid.full-width {
    grid-template-columns: 1fr !important;
}

/* Ensure analytics cards stretch to fill their grid cells */
#salesforce-pipeline .analytics-card {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    box-sizing: border-box;
    flex: 1 1 auto;
}

/* Charts should fill their containers */
#salesforce-pipeline .analytics-card .chart-content {
    width: 100%;
    height: 300px;
}

#salesforce-pipeline .analytics-card .chart-content canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Full width cards span all columns */
#salesforce-pipeline .analytics-card.full-width {
    grid-column: 1 / -1;
}

/* ===== END SALESFORCE PIPELINE OVERRIDES ===== */

/* Health Score Visualization */
.health-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.health-bar {
    width: 60px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.health-value {
    font-size: 12px;
    font-weight: 600;
    color: #ffffff;
    min-width: 20px;
}

/* Stage Badges */
.stage-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stage-prospecting {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.stage-qualification {
    background: rgba(168, 85, 247, 0.2);
    color: #a78bfa;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.stage-proposal {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.stage-negotiation {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.stage-closed-won {
    background: rgba(34, 197, 94, 0.3);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.stage-closed-lost {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Salesforce Analytics Dashboard Styles */
.analytics-dashboard {
    margin-top: 2rem;
}

.analytics-section {
    margin-bottom: 3rem;
}

.analytics-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.analytics-section .section-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Even distribution - 2 charts per row */
    gap: 1.5rem;
    margin-bottom: 2rem;
    width: 100%;
}

/* Override for full-width grid */
.analytics-grid.full-width {
    grid-template-columns: 1fr;
}

.analytics-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    /* Ensure cards stretch to fill their grid cell */
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.analytics-card.large,
.analytics-card.full-width {
    grid-column: 1 / -1; /* Span all columns */
    width: 100%;
}

.analytics-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.analytics-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

.chart-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #ffffff;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    backdrop-filter: blur(10px);
    transition: all 0.2s ease;
}

.chart-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.chart-select option {
    background: #1a1a1a;
    color: #ffffff;
}

.chart-content {
    position: relative;
    height: 300px;
}

.chart-content canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Advanced Metrics Grid */
.metrics-grid-advanced {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.metric-card-advanced {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card-advanced:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.metric-card-advanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.metric-card-advanced .metric-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: #ffffff;
}

.metric-card-advanced .metric-content {
    text-align: left;
}

.metric-card-advanced .metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.25rem;
    line-height: 1;
}

.metric-card-advanced .metric-label {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.metric-card-advanced .metric-change {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.metric-card-advanced .metric-change.positive {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.metric-card-advanced .metric-change.negative {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.metric-card-advanced .metric-change.neutral {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
    border: 1px solid rgba(156, 163, 175, 0.3);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .analytics-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .analytics-card.large {
        grid-column: span 2; /* Full width on smaller screens */
    }
}

@media (max-width: 768px) {
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .analytics-card.large {
        grid-column: span 1;
    }
    
    .metrics-grid-advanced {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .analytics-section .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Chart Animation Effects */
.chart-content {
    position: relative;
}

.chart-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
    animation: shimmer 2s infinite;
    pointer-events: none;
    z-index: 1;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Loading States */
.analytics-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.analytics-card.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    margin: -16px 0 0 -16px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Enhanced Button Styles */
.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.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;
}

.btn:hover::before {
    left: 100%;
}

/* Data Table Enhancements */
.data-table {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.data-table th {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%);
    color: #ffffff;
    font-weight: 600;
    padding: 1rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.01);
    transition: all 0.2s ease;
}

/* Section Controls */
.section-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.section-controls .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: #ffffff;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}
