/* ===== CraftLauncher Language Selector ===== */

/* Hide Google Translate default UI */
.skiptranslate,
.goog-te-banner-frame,
.goog-te-menu-frame,
#google_translate_element,
.goog-te-spinner-pos,
.goog-te-ftab-frame,
.goog-te-balloon-frame,
.VIpgJd-ZVi9od-xl07Ob-lTBxed,
.goog-te-gadget,
body > .skiptranslate {
    display: none !important;
    position: absolute !important;
    top: -9999px !important;
    left: -9999px !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

body { top: 0 !important; }

/* ── Wrapper ── */
.cl-lang-wrapper {
    position: relative;
    display: inline-block;
}

/* ── Button ── */
.cl-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: transparent;
    border: 1px solid #27272A;
    border-radius: 0.5rem;
    color: #71717A;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    user-select: none;
    line-height: 1;
}

.cl-lang-btn:hover {
    color: #A1A1AA;
    border-color: #3F3F46;
}

.cl-lang-btn svg {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
}

.cl-lang-btn .cl-lang-code {
    text-transform: uppercase;
    font-size: 0.6875rem;
}

.cl-lang-btn .cl-lang-arrow {
    width: 0.625rem;
    height: 0.625rem;
    transition: transform 0.15s;
    opacity: 0.5;
}

.cl-lang-btn.open .cl-lang-arrow {
    transform: rotate(180deg);
}

/* ── Dropdown ── */
.cl-lang-dropdown {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    width: 240px;
    background: #18181B;
    border: 1px solid #27272A;
    border-radius: 0.75rem;
    box-shadow: 0 16px 48px -8px rgba(0,0,0,0.5);
    z-index: 200;
    display: none;
    flex-direction: column;
}

.cl-lang-dropdown.open {
    display: flex;
}

/* Navbar variant: dropdown below */
.cl-lang-dropdown.navbar-variant {
    bottom: auto;
    top: calc(100% + 6px);
}

/* ── Search ── */
.cl-lang-search {
    padding: 0.5rem;
    border-bottom: 1px solid #27272A;
    flex-shrink: 0;
}

.cl-lang-search input {
    width: 100%;
    padding: 0.375rem 0.625rem;
    background: #09090B;
    border: 1px solid #27272A;
    border-radius: 0.375rem;
    color: #FAFAFA;
    font-size: 0.75rem;
    outline: none;
    transition: border-color 0.15s;
}

.cl-lang-search input::placeholder {
    color: #52525B;
}

.cl-lang-search input:focus {
    border-color: #3F3F46;
}

/* ── List (scrollable) ── */
.cl-lang-list {
    overflow-y: auto;
    overflow-x: hidden;
    height: 280px;
    padding: 0.25rem;
    scrollbar-width: thin;
    scrollbar-color: #3F3F46 transparent;
}

.cl-lang-list::-webkit-scrollbar {
    width: 4px;
}

.cl-lang-list::-webkit-scrollbar-track {
    background: transparent;
}

.cl-lang-list::-webkit-scrollbar-thumb {
    background: #3F3F46;
    border-radius: 2px;
}

/* ── Option ── */
.cl-lang-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 0.75rem;
    color: #A1A1AA;
}

.cl-lang-option:hover {
    background: #27272A;
    color: #FAFAFA;
}

.cl-lang-option.active {
    background: #27272A;
    color: #FAFAFA;
}

.cl-lang-option .cl-lang-opt-flag {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

.cl-lang-option .cl-lang-opt-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cl-lang-option .cl-lang-check {
    width: 0.875rem;
    height: 0.875rem;
    flex-shrink: 0;
    color: #22C55E;
    display: none;
}

.cl-lang-option.active .cl-lang-check {
    display: block;
}

/* ── Empty state ── */
.cl-lang-empty {
    padding: 1rem 0.5rem;
    text-align: center;
    color: #52525B;
    font-size: 0.75rem;
}

/* ── Mobile ── */
@media (max-width: 640px) {
    .cl-lang-dropdown {
        width: 220px;
        max-height: 300px;
    }
}
