/* Floating Language Switcher Button */
.kqr-lang-switcher {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

/* Inline Language Switcher Container (for shortcode) */
.kqr-lang-switcher-container {
    position: relative;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    margin: 10px 0;
    -webkit-tap-highlight-color: transparent;
}

.kqr-lang-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2271b1;
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.kqr-lang-btn:hover {
    background: #135e96;
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.kqr-lang-btn:active {
    transform: scale(0.95);
}

.kqr-lang-menu {
    position: absolute;
    bottom: 70px;
    right: 0;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Inline version positions menu below button */
.kqr-lang-switcher-container .kqr-lang-menu {
    bottom: auto;
    top: 60px;
    left: 0;
    right: auto;
}

.kqr-lang-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.kqr-lang-menu-item {
    padding: 14px 20px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s ease;
    flex-shrink: 0;
    min-height: 52px;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
    z-index: 1;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* Ensure Bengali item is always clickable */
.kqr-lang-menu-item[data-lang="bn"] {
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    display: flex !important;
    z-index: 2;
}

.kqr-lang-menu-item:last-child {
    border-bottom: none;
}

.kqr-lang-menu-item:hover {
    background: #f5f5f5;
}

.kqr-lang-menu-item.active {
    background: #e7f3ff;
    color: #2271b1;
    font-weight: 600;
}

/* Visual feedback when clicking already-active language */
.kqr-lang-menu-item.kqr-lang-pulse {
    animation: kqr-pulse 0.3s ease;
}

@keyframes kqr-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(0.98); background: #d0e7ff; }
}

.kqr-lang-flag {
    font-size: 24px;
    line-height: 1;
    pointer-events: none !important;
    flex-shrink: 0;
}

.kqr-lang-name {
    font-size: 15px;
    pointer-events: none !important;
    flex-shrink: 0;
}

.kqr-lang-check {
    margin-left: auto;
    color: #2271b1;
    font-size: 18px;
    pointer-events: none !important;
    flex-shrink: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .kqr-lang-switcher {
        position: fixed;
        bottom: 20px;
        right: 20px;
        z-index: 9999;
    }
    
    .kqr-lang-btn {
        width: 54px;
        height: 54px;
        font-size: 24px;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
    }
    
    .kqr-lang-menu {
        bottom: 65px;
        min-width: 220px;
        max-width: calc(100vw - 30px);
    }
    
    .kqr-lang-menu-item {
        padding: 16px 20px;
        min-height: 56px;
        font-size: 16px;
    }
    
    .kqr-lang-flag {
        font-size: 26px;
    }
    
    .kqr-lang-name {
        font-size: 16px;
    }
    
    /* Inline version adjustments */
    .kqr-lang-switcher-container .kqr-lang-menu {
        top: 60px;
        min-width: 220px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
    
    .kqr-lang-switcher-container .kqr-lang-menu.active {
        transform: translateX(-50%) translateY(0);
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    .kqr-lang-switcher {
        bottom: 10px;
        right: 10px;
    }
    
    .kqr-lang-btn {
        width: 52px;
        height: 52px;
    }
    
    .kqr-lang-menu {
        bottom: 60px;
        right: 0;
        min-width: 200px;
        max-width: calc(100vw - 20px);
    }
    
    .kqr-lang-menu-item {
        padding: 18px 16px;
        min-height: 60px;
    }
}

/* Accessibility */
.kqr-lang-btn:focus,
.kqr-lang-menu-item:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}
