/**
 * Professional Tooltips System Styles for THE WEALTH WELL
 * Enhanced user guidance with elegant design
 */

/* Tooltip Container */
.wealth-well-tooltip {
    position: fixed;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(-10px);
}

.wealth-well-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Tooltip Content */
.tooltip-content {
    background: var(--tooltip-bg, linear-gradient(135deg, #1a1a2e 0%, #2d2d5a 100%));
    border: 1px solid var(--tooltip-border, #fbbf24);
    border-radius: 12px;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.3),
        0 10px 10px -5px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(251, 191, 36, 0.1);
    max-width: 350px;
    min-width: 250px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Dark mode styles */
[data-theme="dark"] .tooltip-content {
    --tooltip-bg: linear-gradient(135deg, #1a1a2e 0%, #2d2d5a 100%);
    --tooltip-border: #fbbf24;
    --tooltip-text: #e5e5e5;
    --tooltip-title: #fbbf24;
    --tooltip-close: #9ca3af;
}

/* Light mode styles */
[data-theme="light"] .tooltip-content {
    --tooltip-bg: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
    --tooltip-border: #d97706;
    --tooltip-text: #374151;
    --tooltip-title: #d97706;
    --tooltip-close: #6b7280;
}

/* Tooltip Header */
.tooltip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid rgba(251, 191, 36, 0.1);
}

.tooltip-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--tooltip-title, #fbbf24);
    margin: 0;
    line-height: 1.2;
}

.tooltip-close {
    background: none;
    border: none;
    color: var(--tooltip-close, #9ca3af);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 0;
    margin: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.tooltip-close:hover {
    background: rgba(251, 191, 36, 0.1);
    color: var(--tooltip-title, #fbbf24);
    transform: scale(1.1);
}

/* Tooltip Body */
.tooltip-body {
    padding: 12px 20px 20px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--tooltip-text, #e5e5e5);
}

/* Tooltip Arrow */
.tooltip-arrow {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--tooltip-border, #fbbf24);
}

.tooltip-arrow::after {
    content: '';
    position: absolute;
    top: 1px;
    left: -7px;
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 7px solid var(--tooltip-bg, #1a1a2e);
}

/* Arrow positioning for tooltip above */
.wealth-well-tooltip.tooltip-above .tooltip-arrow {
    top: auto;
    bottom: -8px;
    border-bottom: none;
    border-top: 8px solid var(--tooltip-border, #fbbf24);
}

.wealth-well-tooltip.tooltip-above .tooltip-arrow::after {
    top: -8px;
    border-bottom: none;
    border-top: 7px solid var(--tooltip-bg, #1a1a2e);
}

/* Elements with tooltips */
[data-tooltip] {
    cursor: help;
    position: relative;
}

[data-tooltip]:hover {
    transition: all 0.2s ease;
}

/* Special styling for specific tooltip targets */
.vix-display[data-tooltip-attached] {
    border-bottom: 1px dotted rgba(251, 191, 36, 0.5);
}

.spy-holdings-widget[data-tooltip-attached],
.premarket-widget[data-tooltip-attached],
.market-breadth-widget[data-tooltip-attached],
.global-markets-widget[data-tooltip-attached] {
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.spy-holdings-widget[data-tooltip-attached]:hover,
.premarket-widget[data-tooltip-attached]:hover,
.market-breadth-widget[data-tooltip-attached]:hover,
.global-markets-widget[data-tooltip-attached]:hover {
    border-color: rgba(251, 191, 36, 0.3);
}

/* AI Assistant buttons with tooltips */
.ai-chat-btn[data-tooltip-attached],
.ai-voice-btn[data-tooltip-attached] {
    position: relative;
}

.ai-chat-btn[data-tooltip-attached]::before,
.ai-voice-btn[data-tooltip-attached]::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px solid transparent;
    border-radius: 50%;
    transition: border-color 0.3s ease;
    pointer-events: none;
}

.ai-chat-btn[data-tooltip-attached]:hover::before,
.ai-voice-btn[data-tooltip-attached]:hover::before {
    border-color: rgba(251, 191, 36, 0.4);
    animation: tooltipPulse 2s infinite;
}

/* Premium Bot Builder tooltips */
.premium-builder-tab[data-tooltip-attached] {
    position: relative;
}

.premium-builder-tab[data-tooltip-attached]::after {
    content: '💡';
    position: absolute;
    top: 5px;
    right: 10px;
    font-size: 12px;
    opacity: 0.7;
    animation: tooltipHint 3s infinite;
}

/* Navigation tooltips */
.nav-link[data-tooltip-attached] {
    position: relative;
}

.nav-link[data-tooltip-attached]:hover {
    background: rgba(251, 191, 36, 0.1);
    border-radius: 6px;
}

/* Performance optimizations */
.wealth-well-tooltip * {
    box-sizing: border-box;
}

/* Animations */
@keyframes tooltipPulse {
    0%, 100% {
        border-color: rgba(251, 191, 36, 0.4);
        transform: scale(1);
    }
    50% {
        border-color: rgba(251, 191, 36, 0.8);
        transform: scale(1.05);
    }
}

@keyframes tooltipHint {
    0%, 100% {
        opacity: 0.7;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

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

.wealth-well-tooltip.visible .tooltip-content {
    animation: tooltipSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Mobile responsive design */
@media (max-width: 768px) {
    .wealth-well-tooltip {
        max-width: 90vw;
        left: 5vw !important;
        right: 5vw;
    }
    
    .tooltip-content {
        max-width: none;
        min-width: 280px;
    }
    
    .tooltip-header {
        padding: 14px 16px 10px;
    }
    
    .tooltip-body {
        padding: 10px 16px 16px;
        font-size: 13px;
    }
    
    .tooltip-title {
        font-size: 15px;
    }
    
    /* Larger touch targets on mobile */
    .tooltip-close {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .tooltip-content {
        min-width: 260px;
    }
    
    .tooltip-header {
        padding: 12px 14px 8px;
    }
    
    .tooltip-body {
        padding: 8px 14px 14px;
        font-size: 12px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tooltip-content {
        border-width: 2px;
        box-shadow: 
            0 4px 6px -1px rgba(0, 0, 0, 0.5),
            0 2px 4px -1px rgba(0, 0, 0, 0.3);
    }
    
    .tooltip-title {
        font-weight: 700;
    }
    
    .tooltip-close:hover {
        background: rgba(251, 191, 36, 0.2);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .wealth-well-tooltip,
    .tooltip-close,
    .ai-chat-btn[data-tooltip-attached]::before,
    .ai-voice-btn[data-tooltip-attached]::before {
        transition: none;
    }
    
    .tooltipPulse,
    .tooltipHint,
    .tooltipSlideIn {
        animation: none;
    }
}

/* Focus management for accessibility */
.wealth-well-tooltip:focus-within {
    outline: 2px solid var(--tooltip-border, #fbbf24);
    outline-offset: 2px;
}

/* Screen reader support */
.wealth-well-tooltip[aria-hidden="true"] {
    display: none;
}

/* Custom scrollbar for long tooltip content */
.tooltip-body::-webkit-scrollbar {
    width: 6px;
}

.tooltip-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.tooltip-body::-webkit-scrollbar-thumb {
    background: rgba(251, 191, 36, 0.3);
    border-radius: 3px;
}

.tooltip-body::-webkit-scrollbar-thumb:hover {
    background: rgba(251, 191, 36, 0.5);
}

/* Print styles */
@media print {
    .wealth-well-tooltip {
        display: none !important;
    }
}