/* ==================== TOOLTIP SYSTEM ==================== */

/* Base tooltip container */
.tooltip-trigger {
    position: relative;
    cursor: help;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
}

.tooltip-trigger:hover {
    transform: translateY(-2px);
}

/* Tooltip bubble */
.tooltip {
    position: absolute;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98) 0%, rgba(30, 58, 138, 0.95) 100%);
    backdrop-filter: blur(20px);
    color: #fff;
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 1px solid rgba(234, 179, 8, 0.3);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 
                0 0 20px rgba(234, 179, 8, 0.2);
    min-width: 180px;
    max-width: 300px;
    white-space: normal;
}

/* Tooltip arrow */
.tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    filter: drop-shadow(0 -2px 4px rgba(0, 0, 0, 0.3));
}

/* Tooltip positions */
/* Top */
.tooltip.top {
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(5px);
}

.tooltip.top::before {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 8px 8px 0 8px;
    border-color: rgba(15, 23, 42, 0.98) transparent transparent transparent;
}

/* Bottom */
.tooltip.bottom {
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
}

.tooltip.bottom::before {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 8px 8px 8px;
    border-color: transparent transparent rgba(15, 23, 42, 0.98) transparent;
}

/* Left */
.tooltip.left {
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(5px);
}

.tooltip.left::before {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 8px 0 8px 8px;
    border-color: transparent transparent transparent rgba(15, 23, 42, 0.98);
}

/* Right */
.tooltip.right {
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-5px);
}

.tooltip.right::before {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 8px 8px 8px 0;
    border-color: transparent rgba(15, 23, 42, 0.98) transparent transparent;
}

/* Show tooltip on hover/focus */
.tooltip-trigger:hover .tooltip,
.tooltip-trigger:focus .tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0); /* For top/bottom */
}

.tooltip-trigger:hover .tooltip.left,
.tooltip-trigger:focus .tooltip.left {
    transform: translateY(-50%) translateX(0);
}

.tooltip-trigger:hover .tooltip.right,
.tooltip-trigger:focus .tooltip.right {
    transform: translateY(-50%) translateX(0);
}

/* Premium glow effect */
.tooltip-trigger:hover .tooltip {
    animation: tooltipGlow 2s ease-in-out infinite;
}

@keyframes tooltipGlow {
    0%, 100% { 
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 
                    0 0 20px rgba(234, 179, 8, 0.2);
    }
    50% { 
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5), 
                    0 0 30px rgba(234, 179, 8, 0.4);
    }
}

/* Tooltip for feature icons in vehicle cards */
.feature-item.tooltip-trigger {
    position: relative;
}

.feature-item .tooltip {
    min-width: 200px;
    text-align: center;
}

/* Rich tooltip with icon */
.tooltip-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.tooltip-icon {
    font-size: 1.5rem;
    color: #eab308;
    flex-shrink: 0;
}

.tooltip-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
}

.tooltip-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #eab308;
    margin-bottom: 0.25rem;
}

.tooltip-description {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.4;
}

/* Mobile touch support */
@media (max-width: 768px) {
    .tooltip {
        position: fixed;
        left: 50% !important;
        right: auto !important;
        top: auto !important;
        bottom: 20px !important;
        transform: translateX(-50%) !important;
        max-width: calc(100vw - 40px);
        white-space: normal;
    }
    
    .tooltip::before {
        display: none;
    }
    
    /* Touch-friendly: show on tap, hide after 3s */
    .tooltip-trigger.active .tooltip {
        opacity: 1;
        visibility: visible;
    }
}

/* Accessibility */
.tooltip-trigger:focus {
    outline: 2px solid rgba(234, 179, 8, 0.5);
    outline-offset: 3px;
    border-radius: 8px;
}

/* Performance: Hardware acceleration */
.tooltip {
    will-change: opacity, transform;
    transform: translateZ(0);
}

