/**
 * ChronoEye Insights - Advanced Analytics Dashboard
 * Company Branding: Insights with ChronoEye color palette
 * Primary: #387186, Accent: #55C4C7, Warning: #D4B119, Secondary: #A07553, Muted: #7D98B5
 */

/* ===== INSIGHTS DASHBOARD ===== */
.insights-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ===== KPI CARDS ===== */
.kpi-card {
    background: linear-gradient(135deg, var(--card-bg, rgba(56, 113, 134, 0.1)) 0%, rgba(26, 32, 44, 0.8) 100%);
    border: 1px solid var(--border-color, rgba(56, 113, 134, 0.3));
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-blue, #387186) 0%, var(--accent-teal, #55C4C7) 100%);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(56, 113, 134, 0.2);
    border-color: var(--accent-teal, #55C4C7);
}

.kpi-title {
    font-size: 0.9rem;
    color: var(--text-secondary, #a0aec0);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.kpi-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent-teal, #55C4C7);
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 8px rgba(85, 196, 199, 0.3);
}

.kpi-unit {
    font-size: 0.8rem;
    color: var(--text-muted, #718096);
    font-weight: 500;
}

.kpi-change {
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.kpi-change.positive {
    color: #68d391;
}

.kpi-change.negative {
    color: #fc8181;
}

/* ===== TABBED INTERFACE ===== */
.insights-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color, rgba(56, 113, 134, 0.3));
}

.tab-button {
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    color: var(--text-secondary, #a0aec0);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 8px 8px 0 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.tab-button:hover {
    color: var(--accent-teal, #55C4C7);
    background: rgba(85, 196, 199, 0.1);
}

.tab-button.active {
    color: var(--accent-teal, #55C4C7);
    background: var(--card-bg, rgba(56, 113, 134, 0.1));
    border-bottom: 3px solid var(--accent-teal, #55C4C7);
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-blue, #387186) 0%, var(--accent-teal, #55C4C7) 100%);
}

/* ===== TAB CONTENT ===== */
.tab-content {
    display: none;
    background: var(--card-bg, rgba(56, 113, 134, 0.1));
    border-radius: 16px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color, rgba(56, 113, 134, 0.3));
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.tab-content h3 {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.3rem;
}

/* ===== BOTTLENECK ANALYSIS ===== */
.bottleneck-item {
    background: rgba(26, 32, 44, 0.6);
    border: 1px solid var(--border-color, rgba(56, 113, 134, 0.3));
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
    border-left: 4px solid var(--warning-gold, #D4B119);
}

.bottleneck-item:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 25px rgba(212, 177, 25, 0.2);
    border-left-color: var(--accent-teal, #55C4C7);
}

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

.bottleneck-step {
    font-weight: bold;
    color: var(--accent-teal, #55C4C7);
    font-size: 1.1rem;
}

.bottleneck-duration {
    background: linear-gradient(135deg, var(--warning-gold, #D4B119) 0%, var(--secondary-brown, #A07553) 100%);
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 8px rgba(212, 177, 25, 0.3);
}

.bottleneck-description {
    color: var(--text-secondary, #a0aec0);
    font-size: 0.95rem;
    line-height: 1.5;
}

.bottleneck-impact {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(212, 177, 25, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(212, 177, 25, 0.3);
}

.impact-label {
    font-weight: bold;
    color: var(--warning-gold, #D4B119);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.impact-value {
    color: var(--text-primary, #ffffff);
    font-size: 0.9rem;
}

/* ===== EFFICIENCY METRICS ===== */
.efficiency-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.efficiency-card {
    background: rgba(26, 32, 44, 0.6);
    border: 1px solid var(--border-color, rgba(56, 113, 134, 0.3));
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.efficiency-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(56, 113, 134, 0.2);
    border-color: var(--accent-teal, #55C4C7);
}

.efficiency-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    color: var(--accent-teal, #55C4C7);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.efficiency-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(125, 152, 181, 0.2);
}

.efficiency-metric:last-child {
    border-bottom: none;
}

.metric-label {
    color: var(--text-secondary, #a0aec0);
    font-size: 0.95rem;
    font-weight: 500;
}

.metric-value {
    color: var(--accent-teal, #55C4C7);
    font-weight: bold;
    font-size: 1rem;
    background: rgba(85, 196, 199, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    border: 1px solid rgba(85, 196, 199, 0.3);
}

/* ===== RECOMMENDATIONS ===== */
.recommendations-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recommendation-item {
    background: rgba(26, 32, 44, 0.6);
    border: 1px solid var(--border-color, rgba(56, 113, 134, 0.3));
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.recommendation-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(180deg, var(--primary-blue, #387186) 0%, var(--accent-teal, #55C4C7) 100%);
}

.recommendation-item:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 25px rgba(56, 113, 134, 0.2);
    border-color: var(--accent-teal, #55C4C7);
}

.recommendation-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.recommendation-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-blue, #387186) 0%, var(--accent-teal, #55C4C7) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.2rem;
    box-shadow: 0 4px 15px rgba(56, 113, 134, 0.3);
}

.recommendation-title {
    font-weight: bold;
    color: var(--accent-teal, #55C4C7);
    font-size: 1.1rem;
}

.recommendation-description {
    color: var(--text-secondary, #a0aec0);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.recommendation-impact {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.impact-metric {
    background: rgba(85, 196, 199, 0.1);
    border: 1px solid rgba(85, 196, 199, 0.3);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    text-align: center;
    flex: 1;
}

.impact-metric-label {
    font-size: 0.8rem;
    color: var(--text-muted, #718096);
    margin-bottom: 0.25rem;
}

.impact-metric-value {
    font-weight: bold;
    color: var(--accent-teal, #55C4C7);
    font-size: 1rem;
}

/* ===== PRIORITY INDICATORS ===== */
.priority-high {
    border-left-color: var(--error-red, #f56565) !important;
}

.priority-high .recommendation-icon {
    background: linear-gradient(135deg, var(--error-red, #f56565) 0%, #fc8181 100%) !important;
}

.priority-medium {
    border-left-color: var(--warning-gold, #D4B119) !important;
}

.priority-medium .recommendation-icon {
    background: linear-gradient(135deg, var(--warning-gold, #D4B119) 0%, var(--secondary-brown, #A07553) 100%) !important;
}

.priority-low {
    border-left-color: var(--success-green, #48bb78) !important;
}

.priority-low .recommendation-icon {
    background: linear-gradient(135deg, var(--success-green, #48bb78) 0%, #68d391 100%) !important;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .insights-dashboard {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 1rem;
    }
    
    .kpi-card {
        padding: 1rem;
    }
    
    .kpi-value {
        font-size: 2rem;
    }
    
    .insights-tabs {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .tab-button {
        padding: 0.75rem 1rem;
        border-radius: 8px;
        border-bottom: none;
    }
    
    .tab-button.active {
        border-bottom: none;
        border-left: 3px solid var(--accent-teal, #55C4C7);
    }
    
    .tab-button.active::after {
        display: none;
    }
    
    .efficiency-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .efficiency-card,
    .bottleneck-item,
    .recommendation-item {
        padding: 1rem;
    }
    
    .recommendation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .recommendation-impact {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .tab-content {
        padding: 1rem;
    }
}

/* ===== LOADING STATES ===== */
.insights-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-secondary, #a0aec0);
}

.insights-loading::before {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-color, rgba(56, 113, 134, 0.3));
    border-top: 3px solid var(--accent-teal, #55C4C7);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 1rem;
}

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

/* ===== UTILITY CLASSES ===== */
.insights-hidden {
    display: none !important;
}

.text-highlight {
    color: var(--accent-teal, #55C4C7);
    font-weight: bold;
}

.text-warning {
    color: var(--warning-gold, #D4B119);
    font-weight: bold;
}

.text-success {
    color: var(--success-green, #48bb78);
    font-weight: bold;
}

.text-error {
    color: var(--error-red, #f56565);
    font-weight: bold;
}

/* ===== METRIC TOOLTIPS ===== */
.metric-tooltip {
    position: absolute;
    background: linear-gradient(135deg, rgba(26, 32, 44, 0.98) 0%, rgba(23, 25, 35, 0.98) 100%);
    border: 2px solid var(--accent-teal);
    border-radius: 12px;
    padding: 1rem;
    max-width: 300px;
    z-index: 10000;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    animation: tooltipFadeIn 0.2s ease-out;
}

.tooltip-header {
    font-weight: 600;
    color: var(--accent-teal);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(85, 196, 199, 0.3);
    padding-bottom: 0.5rem;
}

.tooltip-description {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.tooltip-calculation {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.3;
    font-style: italic;
    background: rgba(85, 196, 199, 0.1);
    padding: 0.5rem;
    border-radius: 6px;
    border-left: 3px solid var(--accent-teal);
}

.tooltip-calculation strong {
    color: var(--accent-teal);
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== TOOLTIP SYSTEM ===== */
.tooltip-container {
    position: relative;
    display: inline-block;
}

.tooltip {
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 32, 44, 0.95);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    white-space: normal;
}

.tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: rgba(26, 32, 44, 0.95);
}

.tooltip-container:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* KPI Card Tooltips */
.kpi-card.tooltip-container .tooltip {
    bottom: 110%;
    max-width: 250px;
}

.kpi-card.tooltip-container:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 48px rgba(56, 113, 134, 0.3);
}

/* Executive Dashboard Tooltips */
.executive-dashboard .kpi-card.tooltip-container .tooltip {
    bottom: 115%;
    max-width: 280px;
}

/* Enhanced Tooltip Styling for Detailed Content */
.executive-dashboard .kpi-card.tooltip-container .tooltip {
    bottom: 115%;
    max-width: 350px;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(26, 32, 44, 0.98) 0%, rgba(23, 25, 35, 0.98) 100%);
    border: 2px solid var(--accent-teal, #55C4C7);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
}

.executive-dashboard .tooltip-header {
    font-weight: 600;
    color: var(--accent-teal, #55C4C7);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgba(85, 196, 199, 0.3);
    padding-bottom: 0.5rem;
}

.executive-dashboard .tooltip-description {
    color: var(--text-primary, #e2e8f0);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.executive-dashboard .tooltip-description strong {
    color: var(--accent-teal, #55C4C7);
    font-weight: 600;
}

.executive-dashboard .tooltip-calculation {
    color: var(--text-secondary, #a0aec0);
    font-size: 0.8rem;
    line-height: 1.4;
    background: rgba(85, 196, 199, 0.1);
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent-teal, #55C4C7);
    margin-top: 0.5rem;
}

.executive-dashboard .tooltip-calculation strong {
    color: var(--accent-teal, #55C4C7);
    font-weight: 600;
}

/* Responsive Tooltips */
@media (max-width: 768px) {
    .tooltip {
        position: fixed;
        bottom: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        max-width: 90vw;
        z-index: 10000;
    }
    
    .tooltip::after {
        display: none;
    }
} 