/* Enhanced Contextual Tooltips for AI Trade King */

.custom-tooltip {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500;
    letter-spacing: 0.3px;
    word-wrap: break-word;
    z-index: 9999 !important;
}

.custom-tooltip::before {
    content: '';
    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 rgba(44, 62, 80, 0.95);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.custom-tooltip.bottom::before {
    top: auto;
    bottom: -8px;
    border-bottom: none;
    border-top: 8px solid rgba(44, 62, 80, 0.95);
}

/* Tooltip trigger styling */
[data-tooltip] {
    position: relative;
    cursor: help !important;
    transition: all 0.2s ease;
}

[data-tooltip]:not(button):not(a) {
    text-decoration: underline dotted;
    text-decoration-color: #007bff;
    text-underline-offset: 2px;
}

[data-tooltip]:hover {
    color: #0056b3;
    text-decoration-color: #0056b3;
}

/* Button tooltips */
button[data-tooltip] {
    cursor: pointer !important;
}

button[data-tooltip]:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Trading-specific tooltip classes */
.tooltip-greek {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: rgba(102, 126, 234, 0.3);
}

.tooltip-strategy {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-color: rgba(240, 147, 251, 0.3);
}

.tooltip-risk {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    border-color: rgba(255, 107, 107, 0.3);
}

.tooltip-market {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    border-color: rgba(78, 205, 196, 0.3);
}

/* Responsive tooltip widths */
@media (max-width: 768px) {
    .custom-tooltip {
        max-width: 280px;
        font-size: 12px;
        padding: 10px 14px;
    }
}

@media (max-width: 480px) {
    .custom-tooltip {
        max-width: 250px;
        font-size: 11px;
        padding: 8px 12px;
    }
}

/* Animation enhancements */
.custom-tooltip {
    animation: tooltipFadeIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes tooltipFadeIn {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Enhanced typography for trading terms */
.custom-tooltip .tooltip-title {
    font-weight: 600;
    font-size: 14px;
    color: #ffd700;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    padding-bottom: 3px;
}

.custom-tooltip .tooltip-content {
    color: #f8f9fa;
    line-height: 1.5;
    font-size: 13px;
}

/* Trading terminology highlighting */
.custom-tooltip .trading-term {
    color: #17a2b8;
    font-weight: 600;
}

.custom-tooltip .risk-warning {
    color: #ffc107;
    font-weight: 500;
}

.custom-tooltip .profit-indicator {
    color: #28a745;
    font-weight: 500;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .custom-tooltip {
        transition: none;
        animation: none;
    }
    
    [data-tooltip]:hover {
        transform: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .custom-tooltip {
        background: #000;
        border: 2px solid #fff;
        color: #fff;
    }
    
    [data-tooltip] {
        text-decoration: underline solid;
    }
}

/* Dark theme adjustments */
@media (prefers-color-scheme: dark) {
    .custom-tooltip {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
        border-color: rgba(255, 255, 255, 0.2);
        box-shadow: 0 8px 32px rgba(0,0,0,0.8);
    }
}

/* Focus states for keyboard navigation */
[data-tooltip]:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Loading state for dynamic tooltips */
.tooltip-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, transparent 37%, #f0f0f0 63%);
    background-size: 400% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}