/**
 * AI Predictive Analytics Dashboard Styles
 * Modern data visualization and analytics interface
 */

/* ===== ANALYTICS CONTAINER ===== */
.ai-predictive-analytics {
    position: fixed;
    bottom: 260px;
    right: 20px;
    z-index: 9997;
    font-family: 'Inter', sans-serif;
}

/* ===== ANALYTICS TOGGLE BUTTON ===== */
.analytics-toggle {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.analytics-toggle:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.4);
}

.analytics-toggle:active {
    transform: translateY(0) scale(0.98);
}

.analytics-icon {
    position: relative;
    color: white;
    font-size: 24px;
    transition: transform 0.3s ease;
}

.analytics-toggle:hover .analytics-icon {
    transform: scale(1.1);
}

.analytics-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #8b5cf6;
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.analytics-pulse {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.3);
    animation: analyticsPulse 2s infinite;
    pointer-events: none;
}

@keyframes analyticsPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* ===== ANALYTICS DASHBOARD ===== */
.analytics-dashboard {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 450px;
    max-height: 85vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.15);
    transform: translateY(20px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(59, 130, 246, 0.1);
    overflow: hidden;
}

.ai-predictive-analytics.analytics-open .analytics-dashboard {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

.ai-predictive-analytics.analytics-open .analytics-toggle {
    transform: rotate(45deg);
}

/* ===== ANALYTICS HEADER ===== */
.analytics-header {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.analytics-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.analytics-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.analytics-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.analytics-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.analytics-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.analytics-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== ANALYTICS TABS ===== */
.analytics-tabs {
    display: flex;
    background: var(--warm-beige);
    border-bottom: 1px solid #e5e7eb;
}

.analytics-tab {
    flex: 1;
    padding: 12px 8px;
    border: none;
    background: transparent;
    color: var(--forest-green);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
    text-align: center;
}

.analytics-tab.active {
    background: white;
    border-bottom-color: #3b82f6;
    color: #3b82f6;
    font-weight: 600;
}

.analytics-tab:hover:not(.active) {
    background: rgba(59, 130, 246, 0.1);
}

/* ===== TAB CONTENT ===== */
.analytics-tab-content {
    display: none;
    padding: 20px;
    overflow-y: auto;
    max-height: 65vh;
    animation: fadeInAnalytics 0.3s ease-in-out;
}

.analytics-tab-content.active {
    display: block;
}

@keyframes fadeInAnalytics {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== METRIC CARDS ===== */
.score-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.metric-card {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.1);
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 4px;
    display: block;
}

.metric-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== VISITOR SCORE DISPLAY ===== */
.current-visitor-score {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.current-visitor-score h5 {
    margin: 0 0 16px 0;
    color: var(--forest-green);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.visitor-score-display {
    display: flex;
    gap: 20px;
    align-items: center;
}

.score-gauge {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(#3b82f6 var(--gauge-percentage, 0%), #e5e7eb 0%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.score-gauge::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
}

.gauge-score {
    position: relative;
    font-size: 18px;
    font-weight: 700;
    color: #3b82f6;
    z-index: 1;
}

.score-factors {
    flex: 1;
}

.factor-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.score-factor {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 12px;
}

.score-factor.positive {
    border-left: 3px solid #22c55e;
}

.factor-name {
    color: #374151;
    font-weight: 500;
}

.factor-value {
    color: #3b82f6;
    font-weight: 600;
}

.factor-loading {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 20px;
}

/* ===== RECOMMENDATIONS ===== */
.lead-recommendations,
.optimization-suggestions {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.lead-recommendations h5,
.optimization-suggestions h5 {
    margin: 0 0 16px 0;
    color: var(--forest-green);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recommendation-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    position: relative;
}

.recommendation-item.high {
    border-left: 4px solid #ef4444;
    background: #fef2f2;
}

.recommendation-item.medium {
    border-left: 4px solid #f59e0b;
    background: #fffbeb;
}

.recommendation-item.low {
    border-left: 4px solid #22c55e;
    background: #f0fdf4;
}

.recommendation-priority {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recommendation-item.high .recommendation-priority {
    background: #fee2e2;
    color: #dc2626;
}

.recommendation-item.medium .recommendation-priority {
    background: #fef3c7;
    color: #d97706;
}

.recommendation-item.low .recommendation-priority {
    background: #dcfce7;
    color: #16a34a;
}

.recommendation-item h6 {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
}

.recommendation-item p {
    margin: 0 0 12px 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
}

.recommendation-action {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recommendation-action:hover {
    background: #2563eb;
    transform: translateY(-1px);
}

/* ===== CONVERSION PREDICTIONS ===== */
.conversion-predictions {
    margin-bottom: 24px;
}

.conversion-predictions h5 {
    margin: 0 0 16px 0;
    color: var(--forest-green);
    font-size: 14px;
}

.prediction-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.prediction-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
    transition: all 0.3s ease;
}

.prediction-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.1);
}

.prediction-type {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prediction-value {
    font-size: 24px;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 4px;
}

.prediction-confidence {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.prediction-confidence.high {
    background: #dcfce7;
    color: #16a34a;
}

.prediction-confidence.medium {
    background: #fef3c7;
    color: #d97706;
}

.prediction-confidence.low {
    background: #fee2e2;
    color: #dc2626;
}

/* ===== CONVERSION FACTORS ===== */
.conversion-factors {
    margin-bottom: 24px;
}

.conversion-factors h5 {
    margin: 0 0 16px 0;
    color: var(--forest-green);
    font-size: 14px;
}

.factors-chart {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
}

.factor-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.factor-item:last-child {
    margin-bottom: 0;
}

.factor-bar {
    width: 60px;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.factor-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.factor-item.high .factor-fill {
    background: #22c55e;
}

.factor-item.medium .factor-fill {
    background: #f59e0b;
}

.factor-item.low .factor-fill {
    background: #6b7280;
}

.factor-details {
    flex: 1;
}

.factor-name {
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 2px;
}

.factor-description {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.4;
}

/* ===== OPTIMIZATION SUGGESTIONS ===== */
.optimization-suggestion {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: white;
}

.optimization-suggestion h6 {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
}

.optimization-suggestion p {
    margin: 0 0 12px 0;
    color: #6b7280;
    font-size: 13px;
    line-height: 1.5;
}

.suggestion-metrics {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
}

.metric-impact {
    font-size: 12px;
    font-weight: 600;
    color: #22c55e;
}

.metric-effort {
    font-size: 12px;
    color: #6b7280;
}

.implement-suggestion {
    background: #22c55e;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.implement-suggestion:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

/* ===== FORECASTING ===== */
.revenue-forecast,
.lead-pipeline {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.revenue-forecast h5,
.lead-pipeline h5 {
    margin: 0 0 16px 0;
    color: var(--forest-green);
    font-size: 14px;
}

.forecast-chart {
    margin-bottom: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    background: #f8fafc;
}

.forecast-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.forecast-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.forecast-metric .metric-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.forecast-metric .metric-value {
    font-size: 18px;
    font-weight: 700;
    color: #3b82f6;
}

/* ===== PIPELINE STAGES ===== */
.pipeline-stages {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.pipeline-stage {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.stage-name {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stage-value {
    font-size: 18px;
    font-weight: 700;
    color: #3b82f6;
    margin-bottom: 4px;
}

.stage-trend {
    font-size: 14px;
}

.stage-trend.up {
    color: #22c55e;
}

.stage-trend.down {
    color: #ef4444;
}

.stage-trend.flat {
    color: #6b7280;
}

/* ===== MARKET INSIGHTS ===== */
.market-insights {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
}

.market-insights h5 {
    margin: 0 0 16px 0;
    color: var(--forest-green);
    font-size: 14px;
}

.market-insight {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.market-insight.positive {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.market-insight.negative {
    background: #fef2f2;
    border: 1px solid #fecaca;
}

.market-insight.neutral {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.insight-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
}

.market-insight.positive .insight-icon {
    background: #22c55e;
    color: white;
}

.market-insight.negative .insight-icon {
    background: #ef4444;
    color: white;
}

.market-insight.neutral .insight-icon {
    background: #6b7280;
    color: white;
}

.insight-content h6 {
    margin: 0 0 4px 0;
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
}

.insight-content p {
    margin: 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

/* ===== BUSINESS INSIGHTS ===== */
.insight-categories {
    margin-bottom: 24px;
}

.insight-category {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.insight-category h5 {
    margin: 0 0 12px 0;
    color: var(--forest-green);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.insight-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insight-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    line-height: 1.5;
}

.insight-item i {
    color: #22c55e;
    margin-top: 2px;
    flex-shrink: 0;
}

/* ===== ACTIONABLE RECOMMENDATIONS ===== */
.actionable-recommendations {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
}

.actionable-recommendations h5 {
    margin: 0 0 16px 0;
    color: var(--forest-green);
    font-size: 14px;
}

.recommendations-priority {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.priority-section h6 {
    margin: 0 0 12px 0;
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.priority-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.priority-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    background: #f8fafc;
}

.priority-item h6 {
    margin: 0 0 6px 0;
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
}

.priority-item p {
    margin: 0 0 8px 0;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.4;
}

.item-metrics {
    display: flex;
    gap: 12px;
}

.impact,
.effort {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.impact.high {
    background: #dcfce7;
    color: #16a34a;
}

.impact.medium {
    background: #fef3c7;
    color: #d97706;
}

.impact.low {
    background: #fee2e2;
    color: #dc2626;
}

.effort.low {
    background: #dcfce7;
    color: #16a34a;
}

.effort.medium {
    background: #fef3c7;
    color: #d97706;
}

.effort.high {
    background: #fee2e2;
    color: #dc2626;
}

/* ===== QUICK ACTIONS ===== */
.analytics-quick-actions {
    padding: 16px 20px 20px;
    background: var(--warm-beige);
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
}

.analytics-action-btn {
    flex: 1;
    background: var(--forest-green);
    color: white;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.analytics-action-btn:hover {
    background: var(--accent-moss);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 61, 46, 0.3);
}

/* ===== TOAST NOTIFICATIONS ===== */
.analytics-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #3b82f6;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 10006;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 1;
    transition: opacity 0.3s ease;
    animation: toastSlideIn 0.3s ease-out;
}

.analytics-toast.error {
    background: #dc2626;
}

.analytics-toast.info {
    background: #0891b2;
}

.analytics-toast.success {
    background: #22c55e;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .ai-predictive-analytics {
        bottom: 280px;
        right: 16px;
    }
    
    .analytics-dashboard {
        width: calc(100vw - 32px);
        max-width: 420px;
        height: 80vh;
        bottom: 70px;
        right: 0;
    }
    
    .analytics-toggle {
        width: 56px;
        height: 56px;
    }
    
    .analytics-icon {
        font-size: 22px;
    }
    
    .analytics-tab-content {
        padding: 16px;
        max-height: 70vh;
    }
    
    .score-metrics {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .visitor-score-display {
        flex-direction: column;
        text-align: center;
        gap: 16px;
    }
    
    .prediction-cards {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .pipeline-stages {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .forecast-metrics {
        grid-template-columns: 1fr;
    }
    
    .analytics-quick-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .analytics-dashboard {
        width: calc(100vw - 16px);
        height: 90vh;
        bottom: 70px;
        right: 8px;
        left: 8px;
    }
    
    .analytics-tabs {
        flex-wrap: wrap;
    }
    
    .analytics-tab {
        font-size: 10px;
        padding: 8px 6px;
    }
    
    .pipeline-stages {
        grid-template-columns: 1fr;
    }
    
    .suggestion-metrics {
        flex-direction: column;
        gap: 4px;
    }
}

/* ===== ACCESSIBILITY ===== */
.analytics-toggle:focus,
.analytics-close:focus,
.analytics-tab:focus,
.analytics-action-btn:focus,
.recommendation-action:focus,
.implement-suggestion:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    .analytics-dashboard {
        background: #1f2937;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .analytics-tab-content {
        color: #e5e7eb;
    }
    
    .analytics-tabs {
        background: #374151;
    }
    
    .analytics-tab {
        color: #d1d5db;
    }
    
    .analytics-tab.active {
        background: #1f2937;
        color: #3b82f6;
    }
    
    .metric-card,
    .current-visitor-score,
    .lead-recommendations,
    .revenue-forecast,
    .lead-pipeline,
    .market-insights,
    .insight-category,
    .actionable-recommendations {
        background: #374151;
        border-color: rgba(255, 255, 255, 0.1);
        color: #e5e7eb;
    }
    
    .score-gauge::before {
        background: #1f2937;
    }
    
    .score-factor,
    .optimization-suggestion,
    .recommendation-item,
    .pipeline-stage,
    .priority-item {
        background: #374151;
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .forecast-chart {
        background: #374151;
        border-color: rgba(255, 255, 255, 0.1);
    }
} 