/* File: static/css/tooltips-styled.css */
/* Author: blksmn */
/* Last Updated: 2025-07-12 10:45:00 */

/* ================================================================
   STYLED TOOLTIP SYSTEM - ENHANCED WITH PERSISTENT MODE
   ================================================================ */

/* Main tooltip container - enhanced for styled content */
.tooltip-popup {
    position: absolute;
    z-index: 2000;
    background: rgba(17, 24, 39, 0.95); /* Dark background like mockup */
    border: 1px solid rgba(34, 197, 94, 0.3); /* Subtle green border */
    border-radius: 12px; /* Rounded corners like mockup */
    padding: 0; /* Remove default padding - content handles its own */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    font-size: 13px;
    max-width: 320px;
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
    backdrop-filter: blur(12px);
    color: #f9fafb; /* White text like mockup */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Light mode tooltip (for light theme) */
:not(.dark) .tooltip-popup {
    background: rgba(255, 255, 255, 0.95);
    color: #111827;
    border: 1px solid rgba(34, 197, 94, 0.2);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* Show tooltip - CRITICAL for JavaScript integration */
.tooltip-popup.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Persistent tooltip styling - enhanced border and backdrop */
.tooltip-popup.persistent {
    border-color: #22c55e;
    border-width: 2px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8),
                0 0 0 1px rgba(34, 197, 94, 0.3),
                0 0 20px rgba(34, 197, 94, 0.2);
    backdrop-filter: blur(16px);
    z-index: 9999;
}

:not(.dark) .tooltip-popup.persistent {
    border-color: #22c55e;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25),
                0 0 0 1px rgba(34, 197, 94, 0.3),
                0 0 20px rgba(34, 197, 94, 0.1);
}

/* ================================================================
   STYLED TOOLTIP CONTENT STRUCTURE - CENTERED
   ================================================================ */

.tooltip-content-styled {
    padding: 16px;
    line-height: 1.4;
    text-align: center;
}

/* Header styling */
.tooltip-header-styled {
    font-weight: 700;
    font-size: 15px;
    color: inherit;
    margin-bottom: 6px;
    line-height: 1.2;
}

/* Description styling */
.tooltip-description-styled {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.4;
    margin-bottom: 12px;
    color: inherit;
}

/* Score information */
.tooltip-score-styled {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    color: inherit;
    text-align: center;
}

/* ================================================================
   PROGRESS BAR SYSTEM (MATCHING MOCKUP)
   ================================================================ */

.tooltip-progress-section {
    margin: 12px 0;
}

.tooltip-progress-bar-styled {
    width: 100%;
    height: 12px; /* Thicker like in mockup */
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    margin-bottom: 6px;
    display: flex;
}

/* Light mode progress bar background */
:not(.dark) .tooltip-progress-bar-styled {
    background: rgba(0, 0, 0, 0.1);
}

/* Progress bar fills */
.progress-fill-pro {
    background: #22c55e; /* Green like mockup */
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 6px 0 0 6px;
}

.progress-fill-anti {
    background: #ef4444; /* Red for anti */
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 0 6px 6px 0;
}

.progress-fill-no-data {
    background: rgba(156, 163, 175, 0.6); /* Gray for no data */
    height: 100%;
    border-radius: 6px;
    position: relative;
    overflow: hidden;
}

/* Animated loading effect for no data */
.progress-fill-no-data::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Progress labels */
.tooltip-progress-label {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: inherit;
    opacity: 0.9;
}

/* ================================================================
   EXPLANATORY TEXT (LIKE MOCKUP FOOTER)
   ================================================================ */

.tooltip-explanation {
    font-size: 11px;
    line-height: 1.3;
    margin: 12px 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    text-align: center;
    color: inherit;
    opacity: 0.9;
}

:not(.dark) .tooltip-explanation {
    background: rgba(0, 0, 0, 0.05);
}

/* ================================================================
   NO DATA STATE STYLING
   ================================================================ */

.tooltip-no-data {
    text-align: center;
}

.tooltip-no-data-message {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: inherit;
}

.tooltip-no-data-subtitle {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 12px;
    font-style: italic;
    color: inherit;
}

.tooltip-progress-no-data {
    background: rgba(156, 163, 175, 0.2);
}

/* ================================================================
   ACTION BUTTONS (MATCHING MOCKUP)
   ================================================================ */

.tooltip-actions-styled {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 8px;
    justify-content: center;
}

:not(.dark) .tooltip-actions-styled {
    border-top-color: rgba(0, 0, 0, 0.1);
}

/* Base button styling */
.tooltip-btn-view,
.tooltip-btn-add {
    font-size: 10px;
    padding: 6px 10px;
    border: 1px solid rgba(34, 197, 94, 0.3);
    background-color: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tooltip-btn-view:hover,
.tooltip-btn-add:hover {
    background-color: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.5);
    transform: translateY(-1px);
}

/* Primary button (for no-data state) */
.tooltip-btn-primary {
    background-color: #22c55e;
    color: white;
    border-color: #22c55e;
}

.tooltip-btn-primary:hover {
    background-color: #16a34a;
    border-color: #16a34a;
}

/* Icon spacing */
.tooltip-btn-view i,
.tooltip-btn-add i {
    font-size: 8px;
}

/* ================================================================
   THEME-AWARE TOOLTIP SYSTEM - CORRECT STYLING
   ================================================================ */

/* Base tooltip container */
.ultra-tooltip {
    position: fixed;
    z-index: 10000;
    padding: 0;
    font-size: 13px;
    max-width: 320px;
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    border-radius: 12px;
    backdrop-filter: blur(12px);

    /* DARK THEME (default) */
    background: rgba(17, 24, 39, 0.95);
    color: #f9fafb;
    border: 1px solid rgba(34, 197, 94, 0.3);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

/* LIGHT THEME - when html does NOT have 'dark' class */
html:not(.dark) .ultra-tooltip {
    background: rgba(255, 255, 255, 0.95);
    color: #111827;
    border: 1px solid rgba(34, 197, 94, 0.2);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
}

/* Visible state - CRITICAL for showing tooltip */
.ultra-tooltip[style*="opacity: 1"] {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* ================================================================
   MOBILE OPTIMIZATIONS
   ================================================================ */

@media (max-width: 640px) {
    .tooltip-popup {
        position: fixed !important;
        max-width: calc(100vw - 32px);
        min-width: calc(100vw - 32px);
        font-size: 12px;
        left: 16px !important;
        right: 16px !important;
        top: 50% !important;
        bottom: auto;
        transform: translateY(-50%) !important;
        margin: 0;
        z-index: 9999;
    }

    .tooltip-popup.show {
        backdrop-filter: blur(16px);
        border-color: #22c55e;
        border-width: 2px;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8),
                    0 0 0 1px rgba(34, 197, 94, 0.5),
                    0 0 30px rgba(34, 197, 94, 0.3);
    }

    .tooltip-content-styled {
        padding: 14px;
    }

    .tooltip-header-styled {
        font-size: 14px;
    }

    .tooltip-description-styled {
        font-size: 11px;
        margin-bottom: 10px;
    }

    .tooltip-progress-bar-styled {
        height: 10px;
    }

    .tooltip-actions-styled {
        flex-direction: column;
        gap: 6px;
    }

    .tooltip-btn-view,
    .tooltip-btn-add {
        width: 100%;
        justify-content: center;
        padding: 8px 12px;
        font-size: 11px;
    }

    .tooltip-explanation {
        font-size: 10px;
        padding: 6px;
    }

    .ultra-tooltip {
        position: fixed !important;
        max-width: calc(100vw - 32px) !important;
        min-width: calc(100vw - 32px) !important;
        font-size: 12px;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;
        margin: 0;
        border-width: 2px;
        border-color: #22c55e;
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8),
                    0 0 0 1px rgba(34, 197, 94, 0.5),
                    0 0 30px rgba(34, 197, 94, 0.3);
    }
}

/* Very small screens */
@media (max-width: 320px) {
    .tooltip-popup {
        max-width: calc(100vw - 16px);
        min-width: calc(100vw - 16px);
        font-size: 11px;
        left: 8px !important;
        right: 8px !important;
    }

    .tooltip-content-styled {
        padding: 12px;
    }

    .tooltip-header-styled {
        font-size: 13px;
    }

    .tooltip-description-styled {
        font-size: 10px;
    }
}

/* ================================================================
   PERFORMANCE & ACCESSIBILITY
   ================================================================ */

.ultra-tooltip {
    will-change: opacity, visibility;
    contain: layout style paint;
}

@media (prefers-contrast: high) {
    .ultra-tooltip {
        border-width: 2px;
        border-color: currentColor;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ultra-tooltip,
    .tooltip-popup,
    .tooltip-btn-view,
    .tooltip-btn-add {
        transition: none;
    }
}