/* WP Translate – frontend language switcher */

.wpt-switcher {
    /* Appearance is configurable on the "Sprachumschalter" admin page.
       The values below are the defaults; the plugin overrides them with
       inline CSS variables. */
    --wpt-bg: #ffffff;
    --wpt-text: #222222;
    --wpt-hover-bg: #f2f2f2;
    --wpt-border: #d0d0d0;
    --wpt-accent: #2271b1;
    --wpt-radius: 6px;
    --wpt-font-size: 14px;
    --wpt-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    --wpt-list-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);

    font-size: var(--wpt-font-size);
    line-height: 1.4;
    position: relative;
    display: inline-block;
    z-index: 99999;
}

.wpt-switcher-current {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 8px 12px;
    background: var(--wpt-bg);
    color: var(--wpt-text);
    border: 1px solid var(--wpt-border);
    border-radius: var(--wpt-radius);
    box-shadow: var(--wpt-shadow);
    user-select: none;
    font: inherit;
    line-height: inherit;
    text-align: start;
    appearance: none;
    -webkit-appearance: none;
}

.wpt-switcher-current:focus-visible {
    outline: 2px solid var(--wpt-accent);
    outline-offset: 2px;
}

.wpt-switcher-arrow {
    font-size: 10px;
    opacity: 0.6;
}

.wpt-switcher-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 100%;
    margin-top: 4px;
    z-index: 1;
}

.wpt-switcher-panel {
    position: relative;
    background: var(--wpt-bg);
    border: 1px solid var(--wpt-border);
    border-radius: var(--wpt-radius);
    box-shadow: var(--wpt-list-shadow);
    color: var(--wpt-text);
}

.wpt-switcher-list {
    margin: 0;
    padding: 4px 0;
    list-style: none;
    white-space: nowrap;
}

.wpt-switcher.wpt-is-open .wpt-switcher-popup {
    display: block;
}

.wpt-switcher-backdrop,
.wpt-switcher-close {
    display: none;
}

/* Opening direction variants */

.wpt-opening-dropdown-up .wpt-switcher-popup {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
}

.wpt-flag {
    display: inline-flex;
    flex: 0 0 auto;
}

.wpt-flag-image {
    display: block;
    width: 20px;
    height: 15px;
    object-fit: cover;
    border-radius: 1px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
}

/* Flag shape variants */

.wpt-flagstyle-rounded .wpt-flag-image {
    border-radius: 3px;
}

.wpt-flagstyle-circle .wpt-flag-image {
    width: 18px;
    height: 18px;
    border-radius: 50%;
}

.wpt-switcher-list li {
    margin: 0;
    padding: 0;
}

.wpt-switcher-list a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    color: var(--wpt-text);
    text-decoration: none;
}

.wpt-switcher-list a:hover {
    background: var(--wpt-hover-bg);
}

.wpt-switcher-list a:focus-visible {
    outline: 2px solid var(--wpt-accent);
    outline-offset: -2px;
}

.wpt-switcher-list li.wpt-active a {
    font-weight: 600;
    color: var(--wpt-accent);
    opacity: 0.85;
    pointer-events: none;
}

/* The legacy [language-switcher] shortcode sits in a narrow, dark header
   slot. Match its former compact footprint while retaining the accessible
   dropdown panel and the full language names in ARIA labels. */
header.ast-custom-header .wpt-switcher-translatepress-compat .wpt-switcher-current {
    gap: 3px;
    padding: 0;
    background: transparent;
    color: #ffffff;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

header.ast-custom-header .wpt-switcher-translatepress-compat .wpt-name {
    text-transform: uppercase;
}

/* Floating variant */

.wpt-switcher-floating {
    position: fixed;
}

.wpt-position-bottom-right { right: 20px; bottom: 20px; }
.wpt-position-bottom-left  { left: 20px;  bottom: 20px; }
.wpt-position-top-right    { right: 20px; top: 20px; }
.wpt-position-top-left     { left: 20px;  top: 20px; }

.wpt-position-bottom-right .wpt-switcher-popup,
.wpt-position-top-right .wpt-switcher-popup {
    left: auto;
    right: 0;
}

/* Modal variant */

.wpt-opening-modal .wpt-switcher-popup {
    position: fixed;
    inset: 0;
    z-index: 100000;
    margin: 0;
    min-width: 0;
    padding: 24px;
    align-items: center;
    justify-content: center;
}

.wpt-opening-modal.wpt-is-open .wpt-switcher-popup {
    display: flex;
}

.wpt-opening-modal .wpt-switcher-backdrop {
    display: block;
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    cursor: pointer;
}

.wpt-opening-modal .wpt-switcher-panel {
    width: min(420px, 100%);
    max-height: min(80vh, 640px);
    padding: 42px 8px 8px;
    overflow: hidden;
}

.wpt-opening-modal .wpt-switcher-close {
    display: inline-flex;
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    padding: 0;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 0;
    border-radius: calc(var(--wpt-radius) / 2);
    color: var(--wpt-text);
    cursor: pointer;
    font: inherit;
    font-size: 24px;
    line-height: 1;
}

.wpt-opening-modal .wpt-switcher-close:hover {
    background: var(--wpt-hover-bg);
}

.wpt-opening-modal .wpt-switcher-close:focus-visible {
    outline: 2px solid var(--wpt-accent);
    outline-offset: 1px;
}

.wpt-opening-modal .wpt-switcher-list {
    max-height: calc(min(80vh, 640px) - 58px);
    overflow-y: auto;
}

.wpt-opening-modal .wpt-switcher-list a {
    padding: 10px 14px;
}

html.wpt-modal-open {
    overflow: hidden;
}

@media (max-width: 480px) {
    .wpt-opening-modal .wpt-switcher-popup {
        padding: 16px;
    }
}
