/**
 * Global Tooltip Styles for West City Boxing
 * Modern, clean tooltips that override jQuery UI defaults
 */

/* Override jQuery UI Tooltip Styles */
.ui-tooltip {
    background: rgba(0, 0, 0, 0.9) !important;
    color: white !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    max-width: 200px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    z-index: 9999 !important;
    text-align: center !important;
    word-wrap: break-word !important;
    animation: tooltipFadeIn 0.2s ease-out !important;
}

/* Remove jQuery UI default styling */
.ui-tooltip-content {
    padding: 0 !important;
    margin: 0 !important;
}

.ui-widget {
    font-family: inherit !important;
}

.ui-widget-content {
    border: none !important;
    background: transparent !important;
    color: inherit !important;
}

/* Fade in animation */
@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modern CSS-only tooltips for elements with data-tooltip attribute */
[data-tooltip] {
    position: relative;
}

/* Base tooltip styling with smart positioning */
[data-tooltip]:hover::before,
[data-tooltip]:focus::before {
    content: attr(data-tooltip);
    position: fixed; /* Use fixed positioning for better viewport handling */
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    max-width: 200px;
    word-wrap: break-word;
    white-space: normal;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease-out forwards;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    
    /* Smart positioning - default above element (better for action buttons) */
    bottom: calc(100% + 8px);
    left: 50%;
    right: auto;
    top: auto;
    transform: translateX(-50%);
    
    /* Ensure tooltip stays within viewport */
    min-width: 0;
    max-width: min(200px, 90vw);
}

/* Arrows removed for cleaner appearance */

/* Dynamic positioning classes for jQuery UI tooltips */
.wcb-modern-tooltip.tooltip-above {
    margin-bottom: 5px;
}

.wcb-modern-tooltip.tooltip-below {
    margin-top: 5px;
}

.wcb-modern-tooltip.tooltip-left {
    margin-right: 5px;
}

.wcb-modern-tooltip.tooltip-right {
    margin-left: 5px;
}

/* Viewport-aware positioning for CSS tooltips */
/* When element is near top of viewport - show tooltip below */
[data-tooltip].near-top:hover::before,
[data-tooltip].near-top:focus::before {
    top: calc(100% + 8px);
    bottom: auto;
    transform: translateX(-50%);
}



/* When element is near bottom of viewport - show tooltip above (this is now default) */
[data-tooltip].near-bottom:hover::before,
[data-tooltip].near-bottom:focus::before {
    bottom: calc(100% + 8px);
    top: auto;
    transform: translateX(-50%);
}



/* When element is near left edge - align tooltip to left */
[data-tooltip].near-left:hover::before,
[data-tooltip].near-left:focus::before {
    left: 0;
    transform: translateX(0);
}



/* When element is near right edge - align tooltip to right */
[data-tooltip].near-right:hover::before,
[data-tooltip].near-right:focus::before {
    left: auto;
    right: 0;
    transform: translateX(0);
}



/* Old arrow positioning rules removed for cleaner appearance */

/* Responsive adjustments */
@media (max-width: 768px) {
    .ui-tooltip,
    [data-tooltip]:hover::before,
    [data-tooltip]:focus::before {
        max-width: 150px !important;
        font-size: 11px !important;
        padding: 6px 10px !important;
    }
}

/* Special styling for action buttons - force tooltips above */
.btn-view[data-tooltip]:hover::before,
.btn-edit[data-tooltip]:hover::before,
.action-btn[data-tooltip]:hover::before,
.btn-view[data-tooltip]:focus::before,
.btn-edit[data-tooltip]:focus::before,
.action-btn[data-tooltip]:focus::before {
    bottom: calc(100% + 12px) !important;
    top: auto !important;
    transform: translateX(-50%) !important;
}



/* Ensure tooltips appear above modals and other high z-index elements */
.ui-tooltip {
    z-index: 999999 !important;
}

/* Remove default title tooltip when data-tooltip is present */
[data-tooltip][title]:hover::before {
    content: attr(data-tooltip) !important;
}