/* Enhanced Tooltip Styles */

.tooltip {
    position: fixed;
    background: var(--tooltip-bg);
    color: var(--tooltip-text);
    border: 1px solid var(--tooltip-border);
    border-radius: 12px;
    padding: 20px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.25),
        0 20px 25px -5px rgba(0, 0, 0, 0.15),
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    line-height: 1.6;
    max-width: 400px;
    min-width: 300px;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%) translateY(8px) scale(0.95);
    transition:
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

/* Tooltip Arrow */
.tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: var(--tooltip-bg);
    border-left: 1px solid var(--tooltip-border);
    border-top: 1px solid var(--tooltip-border);
}

/* Tooltip Header */
.tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding-bottom: 8px;
}

.tooltip-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-gradient);
    color: #fafafa;
    border-radius: 50%;
    font-size: 14px;
    flex-shrink: 0;
}

.tooltip-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--tooltip-title);
}

/* Tooltip Content Sections */
.tooltip-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px 0;
    gap: 20px;
    min-height: 24px;
}

.tooltip-label {
    font-size: 14px;
    color: var(--tooltip-label);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 90px;
    text-align: left;
}

.tooltip-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--tooltip-value);
    text-align: right;
    flex: 1;
}

/* Highlight values */
.tooltip-value.highlight {
    color: var(--primary-color);
    font-weight: 700;
}

/* Tooltip for stats */
.tooltip-stats {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.tooltip-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tooltip-stat-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    background: var(--table-hover);
    color: var(--label-color);
}

.tooltip-stat-badge.primary {
    background: var(--primary-color);
    color: #fafafa;
}

.tooltip-stat-badge.success {
    background: light-dark(#d1fae5, #065f46);
    color: light-dark(#065f46, #d1fae5);
}

.tooltip-stat-badge.warning {
    background: light-dark(#fed7aa, #92400e);
    color: light-dark(#92400e, #fed7aa);
}

.tooltip-stat-badge.danger {
    background: light-dark(#fee2e2, #991b1b);
    color: light-dark(#991b1b, #fee2e2);
}

/* Tooltip Footer */
.tooltip-footer {
    margin-top: 12px;
    padding-top: 8px;
    font-size: 12px;
    color: var(--tooltip-footer);
    font-style: italic;
}

/* Loading state */
.tooltip.loading {
    background: white;
}

.tooltip.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Position variants */
.tooltip.bottom {
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px) scale(0.95);
    margin-top: 8px;
}

.tooltip.bottom.show {
    transform: translateX(-50%) translateY(0) scale(1);
}

.tooltip.bottom::before {
    top: -6px;
}

.tooltip.top {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px) scale(0.95);
    margin-bottom: 8px;
    box-shadow:
        0 -25px 50px -12px rgba(0, 0, 0, 0.25),
        0 -20px 25px -5px rgba(0, 0, 0, 0.15),
        0 -10px 15px -3px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(0, 0, 0, 0.1);
}

.tooltip.top.show {
    transform: translateX(-50%) translateY(0) scale(1);
}

.tooltip.top::before {
    top: auto;
    bottom: -6px;
    transform: translateX(-50%) rotate(225deg);
}

/* Simple info tooltip for titles */
.info-tooltip {
    display: inline-block;
    margin-left: 8px;
    font-size: 16px;
    color: var(--text-secondary);
    cursor: help;
    transition: color 0.2s ease;
    font-weight: normal;
}

.info-tooltip:hover {
    color: var(--primary-color);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .tooltip {
        max-width: 280px;
        font-size: 13px;
    }

    .tooltip-title {
        font-size: 14px;
    }

    .tooltip-value {
        font-size: 13px;
    }
}
