/* OSU Polylang Multisite Language Switcher — frontend styles */

.osu-pmls {
    display: inline-block;
    position: relative;
    font: inherit;
    line-height: 1.4;
}

.osu-pmls *,
.osu-pmls *::before,
.osu-pmls *::after {
    box-sizing: border-box;
}

/* ---------- Trigger ---------- */

.osu-pmls-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.osu-pmls-trigger:hover {
    color: #FF3642;
    border-color: #FF3642;
    background: transparent;
}

.osu-pmls-trigger:focus,
.osu-pmls-trigger:focus-visible {
    background: transparent;
    color: inherit;
    outline: none;
}

img.osu-pmls-flag {
    width: 16px;
    height: 11px;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
    display: inline-block;
    vertical-align: middle;
}

.osu-pmls-flag--text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.4em;
    height: auto;
    padding: 0 4px;
    font-size: 1.05em;
    font-weight: 600;
    line-height: 1;
    font-variant-emoji: emoji;
    letter-spacing: 0;
    color: inherit;
    background: none;
    border-radius: 2px;
    white-space: nowrap;
}

.osu-pmls-trigger .osu-pmls-label {
    font-weight: 600;
    font-size: 16px;
    font-family: var(--e-global-typography-primary-font-family), Sans-serif;
    line-height: 1;
}

.osu-pmls-trigger .osu-pmls-caret {
    display: inline-flex;
    align-items: center;
    padding-top: 2px;
    opacity: 0.7;
    transition: transform 0.15s ease;
}

.osu-pmls-trigger[aria-expanded="true"] .osu-pmls-caret {
    transform: rotate(180deg);
}

/* ---------- Panel (off-canvas) ---------- */

.osu-pmls-panel {
    position: fixed;
    inset: 0;
    z-index: 99990;
    pointer-events: none;
}

.osu-pmls-panel[hidden] {
    display: none;
}

.osu-pmls-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: auto;
}

.osu-pmls-panel-inner {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    width: min(420px, 100%);
    background: #ffffff;
    color: #111827;
    box-shadow: -10px 0 40px rgba(15, 23, 42, 0.25);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    overflow: hidden;
}

.osu-pmls-panel.is-open .osu-pmls-backdrop {
    opacity: 1;
}

.osu-pmls-panel.is-open .osu-pmls-panel-inner {
    transform: translateX(0);
}

.osu-pmls-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.osu-pmls-panel-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.osu-pmls-close {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: #fa6069;
    font-size: 24px;
    line-height: 1;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, font-size 0.15s ease;
}

.osu-pmls-close:hover,
.osu-pmls-close:focus,
.osu-pmls-close:focus-visible {
    background: transparent;
    color: #d94653;
    outline: none;
}

/* ---------- Sections ---------- */

.osu-pmls-section {
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.osu-pmls-section:last-child {
    border-bottom: 0;
}

.osu-pmls-section-title {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

/* ---------- Dropdowns ---------- */

.osu-pmls-dd {
    position: relative;
}

.osu-pmls-dd-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.osu-pmls-dd-trigger:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
    color: #111827;
}

.osu-pmls-dd-trigger:focus,
.osu-pmls-dd-trigger:focus-visible {
    background: #f8fafc;
    color: #111827;
    outline: none;
}

.osu-pmls-dd-trigger:active {
    background: #f8fafc;
}

.osu-pmls-dd-trigger[aria-expanded="true"] {
    border-color: #3b82f6;
}

.osu-pmls-dd-current {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
}

.osu-pmls-dd-current img.osu-pmls-flag {
    width: 22px;
    height: 16px;
    flex: 0 0 auto;
}

.osu-pmls-dd-current .osu-pmls-flag--text {
    flex: 0 0 auto;
    font-size: 1.15em;
}

.osu-pmls-dd-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.osu-pmls-dd-sub {
    margin-left: auto;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.osu-pmls-dd .osu-pmls-caret {
    color: #64748b;
    transition: transform 0.15s ease;
}

.osu-pmls-dd-trigger[aria-expanded="true"] .osu-pmls-caret {
    transform: rotate(180deg);
    color: #3b82f6;
}

.osu-pmls-dd-list {
    margin: 6px 0 0;
    padding: 4px;
    list-style: none;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
    max-height: 320px;
    overflow-y: auto;
}

.osu-pmls-dd-list[hidden] {
    display: none;
}

.osu-pmls-dd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.12s ease;
}

.osu-pmls-dd-item:hover,
.osu-pmls-dd-item:focus,
.osu-pmls-dd-item:focus-visible {
    background: #f1f5f9;
    color: #111827;
    outline: none;
}

.osu-pmls-dd-item.is-active {
    background: #e0ecff;
}

.osu-pmls-dd-item img.osu-pmls-flag {
    width: 22px;
    height: 16px;
    flex: 0 0 auto;
}

.osu-pmls-dd-item .osu-pmls-flag--text {
    flex: 0 0 auto;
    font-size: 1.15em;
}

/* ---------- Site (fancy) dropdown specifics ---------- */

.osu-pmls-site-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #3b82f6;
    color: #ffffff;
    flex: 0 0 auto;
}

.osu-pmls-dd-list--fancy .osu-pmls-dd-item {
    padding: 12px;
    gap: 12px;
}

.osu-pmls-site-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #cbd5f5;
    flex: 0 0 auto;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.osu-pmls-site-item.is-active .osu-pmls-site-dot {
    background: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.osu-pmls-site-main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    gap: 2px;
}

.osu-pmls-site-main .osu-pmls-dd-sub {
    margin: 0;
}

.osu-pmls-chip {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    background: #3b82f6;
    color: #ffffff;
    border-radius: 999px;
    flex: 0 0 auto;
}

/* ---------- Body lock ---------- */

body.osu-pmls-lock {
    overflow: hidden;
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
    .osu-pmls-panel-inner {
        width: 100%;
    }
    .osu-pmls-panel-header {
        padding: 16px 18px;
    }
    .osu-pmls-section {
        padding: 16px 18px;
    }
}
