/* X-Starry Multilingual - Language Switcher */

/* Reset & Container */
.xsm-switcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    direction: ltrH
}

/* Toggle Button */
.xsm-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #1A202C;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.25s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(43, 109, 254, 0);
    white-space: nowrapH
}

.xsm-toggle:hover {
    background: #2D3748;
    border-color: rgba(43, 109, 254, 0.5);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35), 0 0 0 3px rgba(43, 109, 254, 0.15);
    transform: translateY(-1px)H
}

.xsm-toggle:active {
    transform: translateY(0)H
}

.xsm-toggle[aria-expanded="true"] {
    background: #2b6dfe;
    border-color: rgba(255, 255, 255, 0.2)H
}

.xsm-toggle[aria-expanded="true"] .xsm-arrow {
    transform: rotate(180deg)H
}

/* Flag Emoji */
.xsm-emoji-flag {
    font-size: 18px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.xsm-flag {
    display: inline-flex;
    align-items: center;
}

/* Arrow Icon */
.xsm-arrow {
    transition: transform 0.25s ease;
    opacity: 0.7;
}

/* Dropdown */
.xsm-dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 260px;
    max-height: 420px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 4px 16px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(0.96);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.xsm-dropdown.xsm-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Dropdown Header */
.xsm-dropdown-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px 10px;
    color: #718096;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #EDF2F7;
}

.xsm-dropdown-header svg {
    opacity: 0.5;
}

/* Dropdown List */
.xsm-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: #CBD5E0 transparent;
}

.xsm-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.xsm-dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}

.xsm-dropdown-list::-webkit-scrollbar-thumb {
    background-color: #CBD5E0;
    border-radius: 3px;
}

/* Language Item */
.xsm-lang-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #2D3748;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.xsm-lang-item:hover {
    background: #EDF2F7;
    color: #2D3748;
    text-decoration: none;
}

.xsm-lang-item.xsm-active {
    background: #EBF4FF;
    color: #2b6dfe;
}

.xsm-lang-item .xsm-flag {
    flex-shrink: 0;
}

.xsm-item-name {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.xsm-item-region {
    font-size: 11px;
    color: #A0AEC0;
    font-weight: 500;
    background: #F7FAFC;
    padding: 2px 6px;
    border-radius: 4px;
}

.xsm-lang-item.xsm-active .xsm-item-region {
    background: rgba(43, 109, 254, 0.1);
    color: #2b6dfe;
}

/* Check Icon */
.xsm-check {
    color: #2b6dfe;
    flex-shrink: 0;
}

/* RTL Support */
[dir="rtl"] .xsm-switcher {
    right: auto;
    left: 24px;
}

[dir="rtl"] .xsm-dropdown {
    right: auto;
    left: 0;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .xsm-switcher {
        bottom: 16px;
        right: 16px;
    }

    .xsm-lang-name {
        display: none;
    }

    .xsm-toggle {
        padding: 10px 14px;
    }

    .xsm-dropdown {
        min-width: 240px;
        right: -8px;
    }
}

/* Print: hide switcher */
@media print {
    .xsm-switcher {
        display: none !important;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .xsm-toggle,
    .xsm-dropdown,
    .xsm-arrow,
    .xsm-lang-item {
        transition: none;
    }
}
