/**
 * Fancy Custom Tooltips - StanShareAI
 * Animated, styled tooltips for all action buttons
 * Created: January 18, 2026
 */

/* Tooltip Container */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

/* Tooltip Content */
[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    
    /* Styling */
    background: linear-gradient(135deg, rgba(10, 14, 39, 0.98) 0%, rgba(5, 8, 18, 0.98) 100%);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 300px;
    text-align: center;
    
    /* Glass effect */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(0, 212, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    
    /* Smooth animation */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    z-index: 10000;
}

/* Tooltip Arrow */
[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    
    border: 8px solid transparent;
    border-top-color: rgba(10, 14, 39, 0.98);
    
    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    
    /* Smooth animation */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    z-index: 10000;
}

/* Show on Hover */
[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Tooltip Variants */

/* Top placement (default) */
[data-tooltip-position="top"]::before {
    bottom: calc(100% + 12px);
    top: auto;
}

[data-tooltip-position="top"]::after {
    bottom: calc(100% + 4px);
    top: auto;
    border-top-color: rgba(10, 14, 39, 0.98);
    border-bottom-color: transparent;
}

/* Bottom placement */
[data-tooltip-position="bottom"]::before {
    top: calc(100% + 12px);
    bottom: auto;
    transform: translateX(-50%) translateY(8px);
}

[data-tooltip-position="bottom"]::after {
    top: calc(100% + 4px);
    bottom: auto;
    border-bottom-color: rgba(10, 14, 39, 0.98);
    border-top-color: transparent;
    transform: translateX(-50%);
}

[data-tooltip-position="bottom"]:hover::before {
    transform: translateX(-50%) translateY(0);
}

/* Left placement */
[data-tooltip-position="left"]::before {
    right: calc(100% + 12px);
    left: auto;
    top: 50%;
    bottom: auto;
    transform: translate(-8px, -50%);
}

[data-tooltip-position="left"]::after {
    right: calc(100% + 4px);
    left: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    border-left-color: rgba(10, 14, 39, 0.98);
    border-right-color: transparent;
    border-top-color: transparent;
}

[data-tooltip-position="left"]:hover::before {
    transform: translate(0, -50%);
}

/* Right placement */
[data-tooltip-position="right"]::before {
    left: calc(100% + 12px);
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translate(8px, -50%);
}

[data-tooltip-position="right"]::after {
    left: calc(100% + 4px);
    right: auto;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    border-right-color: rgba(10, 14, 39, 0.98);
    border-left-color: transparent;
    border-top-color: transparent;
}

[data-tooltip-position="right"]:hover::before {
    transform: translate(0, -50%);
}

/* Color Themes */
[data-tooltip-theme="success"]::before {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95) 0%, rgba(5, 150, 105, 0.95) 100%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(16, 185, 129, 0.3);
}

[data-tooltip-theme="warning"]::before {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.95) 0%, rgba(217, 119, 6, 0.95) 100%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(245, 158, 11, 0.3);
}

[data-tooltip-theme="error"]::before {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95) 0%, rgba(220, 38, 38, 0.95) 100%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(239, 68, 68, 0.3);
}

[data-tooltip-theme="info"]::before {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95) 0%, rgba(37, 99, 235, 0.95) 100%);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(59, 130, 246, 0.3);
}

/* Multiline support */
[data-tooltip][data-tooltip-multiline]::before {
    white-space: normal;
    max-width: 250px;
    text-align: left;
}

/* Icon support */
[data-tooltip-icon]::before {
    padding-left: 36px;
}

/* Delayed show */
[data-tooltip-delay]::before,
[data-tooltip-delay]::after {
    transition-delay: 0.5s;
}

/* Animation variants */
@keyframes tooltip-bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(-4px);
    }
}

[data-tooltip-animate="bounce"]:hover::before {
    animation: tooltip-bounce 0.5s ease-in-out;
}

/* Glow effect for interactive elements */
[data-tooltip]:hover {
    filter: brightness(1.1);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    [data-tooltip]::before {
        font-size: 12px;
        padding: 10px 14px;
        max-width: 220px;
    }
    
    [data-tooltip]::after {
        border-width: 6px;
    }
}

/* Accessibility */
[data-tooltip]:focus::before,
[data-tooltip]:focus::after {
    opacity: 1;
    visibility: visible;
}

/* Prevent tooltip overflow on edges */
[data-tooltip].tooltip-edge-left::before {
    left: 0;
    transform: translateX(0) translateY(-8px);
}

[data-tooltip].tooltip-edge-left:hover::before {
    transform: translateX(0) translateY(0);
}

[data-tooltip].tooltip-edge-right::before {
    left: auto;
    right: 0;
    transform: translateX(0) translateY(-8px);
}

[data-tooltip].tooltip-edge-right:hover::before {
    transform: translateX(0) translateY(0);
}
