/* VaiFrame Language Picker (custom dropdown with search)
 *
 * [Changelog]
 * 2026-05-02 | 최초 생성 - <select> 대체용 커스텀 언어 드롭다운
 *             - 검색 input + 사용자 수 정렬 + 시스템/최근 사용 최상단 그룹
 */

.vf-lang-picker {
    position: relative;
    display: inline-block;
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
}

.vf-lang-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #334155;
    font-size: 13px;
    line-height: 1.2;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    max-width: 180px;
}

.vf-lang-trigger:hover {
    background: #f9fafb;
    border-color: #c7d2fe;
}

.vf-lang-trigger:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
}

.vf-lang-trigger-label {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vf-lang-trigger-icon {
    flex: 0 0 auto;
    width: 12px;
    height: 12px;
    opacity: 0.6;
    transition: transform 0.15s;
}

.vf-lang-picker.is-open .vf-lang-trigger-icon {
    transform: rotate(180deg);
}

.vf-lang-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 9999;
    min-width: 240px;
    max-width: 280px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.vf-lang-picker.is-open .vf-lang-dropdown {
    display: flex;
}

/* Drop-up variant: auto-applied when not enough space below trigger */
.vf-lang-picker.is-drop-up .vf-lang-dropdown {
    top: auto;
    bottom: calc(100% + 4px);
}

.vf-lang-search-wrap {
    position: relative;
    padding: 8px 8px 6px 8px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
}

.vf-lang-search {
    width: 100%;
    padding: 6px 10px 6px 28px;
    font-size: 13px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    outline: none;
    background: #ffffff;
    color: #334155;
    box-sizing: border-box;
}

.vf-lang-search:focus {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(99,102,241,0.12);
}

.vf-lang-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: #94a3b8;
    pointer-events: none;
}

.vf-lang-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 0;
}

.vf-lang-group-label {
    padding: 6px 12px 4px 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #94a3b8;
    background: #ffffff;
    user-select: none;
}

.vf-lang-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 4px 0;
}

.vf-lang-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 7px 12px;
    font-size: 13px;
    color: #334155;
    cursor: pointer;
    transition: background 0.1s;
    user-select: none;
}

.vf-lang-item:hover {
    background: #f1f5f9;
}

.vf-lang-item.is-selected {
    background: #eef2ff;
    color: #4338ca;
    font-weight: 600;
}

.vf-lang-item-name {
    flex: 1 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vf-lang-item-check {
    flex: 0 0 auto;
    width: 14px;
    height: 14px;
    color: #4f46e5;
    display: none;
}

.vf-lang-item.is-selected .vf-lang-item-check {
    display: inline-block;
}

.vf-lang-empty {
    padding: 16px 12px;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
}

/* RTL items use logical text-align */
[dir="rtl"] .vf-lang-dropdown {
    right: auto;
    left: 0;
}

[dir="rtl"] .vf-lang-search {
    padding: 6px 28px 6px 10px;
}

[dir="rtl"] .vf-lang-search-icon {
    left: auto;
    right: 16px;
}

/* Page footer (Gallery / Explore / Gallery Assets / My Galleries)
 * - Language selector aligned right (ArtStation/Pinterest pattern)
 * - Subtle, small footprint so it does not steal focus from content */
.vf-page-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 18px 20px;
    border-top: 1px solid #e2e8f0;
    margin-top: 24px;
    font-size: 11px;
    color: #94a3b8;
}
html.vf-theme-dark .vf-page-footer {
    border-top-color: #334155;
    color: #64748b;
}
.vf-page-footer .vf-page-footer-copy {
    margin-right: auto;
}

.vf-page-footer-left {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-right: auto;
}
.vf-page-footer-link {
    font: inherit;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s;
}
.vf-page-footer-link:hover {
    color: #475569;
    text-decoration: underline;
}
html.vf-theme-dark .vf-page-footer-link {
    color: inherit;
}
html.vf-theme-dark .vf-page-footer-link:hover {
    color: #cbd5e1;
}

/* Dark trigger variant for lang picker inside page footer */
html.vf-theme-dark .vf-page-footer .vf-lang-trigger {
    background: #1e293b;
    border-color: #334155;
    color: #cbd5e1;
}
html.vf-theme-dark .vf-page-footer .vf-lang-trigger:hover {
    background: #334155;
    border-color: #475569;
}