/* ========================================
   LANGUAGE SWITCHER TOOLTIPS
   Item 61/78: Tooltips for language selection
   ======================================== */

/* ====================================
   TOOLTIP BASE
   ==================================== */

.lang-btn {
    position: relative;
}

.lang-btn::before {
    content: attr(data-lang-name);
    position: absolute;
    bottom: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Tooltip arrow */
.lang-btn::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

/* Show tooltip on hover */
.lang-btn:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.lang-btn:hover::after {
    opacity: 1;
}

/* ====================================
   TOOLTIP VARIANTS
   ==================================== */

/* Light theme tooltip */
[data-theme="light"] .lang-btn::before {
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .lang-btn::after {
    border-top-color: rgba(255, 255, 255, 0.95);
}

/* ====================================
   ACTIVE STATE
   ==================================== */

.lang-btn.active::before {
    content: attr(data-lang-name) " ✓";
}

/* ====================================
   KEYBOARD FOCUS
   ==================================== */

.lang-btn:focus-visible::before,
.lang-btn:focus-visible::after {
    opacity: 1;
}

.lang-btn:focus-visible::before {
    transform: translateX(-50%) translateY(0);
}

/* ====================================
   MOBILE ADJUSTMENTS
   ==================================== */

@media (max-width: 768px) {
    .lang-btn::before {
        font-size: 13px;
        padding: 6px 10px;
        bottom: calc(100% + 10px);
    }
    
    .lang-btn::after {
        bottom: calc(100% + 2px);
    }
}

/* ====================================
   TOUCH DEVICES
   ==================================== */

@media (hover: none) {
    /* On touch devices, show tooltip on focus/active */
    .lang-btn:active::before,
    .lang-btn:active::after {
        opacity: 1;
    }
    
    .lang-btn:active::before {
        transform: translateX(-50%) translateY(0);
    }
}

/* ====================================
   ACCESSIBILITY
   ==================================== */

/* High contrast mode */
@media (prefers-contrast: high) {
    .lang-btn::before {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .lang-btn::before,
    .lang-btn::after {
        transition: none;
    }
}

/* ====================================
   ALTERNATIVE TOOLTIP POSITIONS
   ==================================== */

/* Bottom tooltip (if needed) */
.lang-btn.tooltip-bottom::before {
    bottom: auto;
    top: calc(100% + 12px);
    transform: translateX(-50%) translateY(-4px);
}

.lang-btn.tooltip-bottom::after {
    bottom: auto;
    top: calc(100% + 4px);
    border-top: none;
    border-bottom: 6px solid rgba(0, 0, 0, 0.9);
}

.lang-btn.tooltip-bottom:hover::before {
    transform: translateX(-50%) translateY(0);
}

/* ====================================
   ENHANCED TOOLTIP WITH FLAG
   ==================================== */

.lang-btn-enhanced::before {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Add flag emoji before text */
.lang-btn[data-lang="en"]::before {
    content: "🇺🇸 " attr(data-lang-name);
}

.lang-btn[data-lang="fr"]::before {
    content: "🇫🇷 " attr(data-lang-name);
}

.lang-btn[data-lang="th"]::before {
    content: "🇹🇭 " attr(data-lang-name);
}

.lang-btn[data-lang="zh"]::before {
    content: "🇨🇳 " attr(data-lang-name);
}

/* ====================================
   ANIMATION VARIANTS
   ==================================== */

/* Bounce in animation */
@keyframes tooltipBounceIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(10px) scale(0.8);
    }
    60% {
        opacity: 1;
        transform: translateX(-50%) translateY(-2px) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

.lang-btn.tooltip-animated:hover::before {
    animation: tooltipBounceIn 0.4s ease;
}

/* ====================================
   MULTI-LINE TOOLTIPS
   ==================================== */

.lang-btn.tooltip-multiline::before {
    white-space: normal;
    max-width: 200px;
    text-align: center;
}

/* ====================================
   TOOLTIP DELAYS
   ==================================== */

.lang-btn.tooltip-delay::before,
.lang-btn.tooltip-delay::after {
    transition-delay: 0.3s;
}

/* ====================================
   CUSTOM COLORS
   ==================================== */

.lang-btn.tooltip-primary::before {
    background: var(--primary-color, #1565C0);
    color: #fff;
}

.lang-btn.tooltip-primary::after {
    border-top-color: var(--primary-color, #1565C0);
}

.lang-btn.tooltip-secondary::before {
    background: var(--secondary-color, #00f2fe);
    color: #000;
}

.lang-btn.tooltip-secondary::after {
    border-top-color: var(--secondary-color, #00f2fe);
}
