.langtools-shell {
    position: relative;
    font-family: 'Scada', sans-serif;
}

.langtools-trigger {
    box-sizing: border-box;
    width: 42px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 9px;
    background: rgba(255,255,255,.07);
    color: rgba(255,255,255,.9);
    font: 600 15px/1 'Scada', sans-serif;
    text-shadow: 0 1px 2px rgba(0,0,0,.55);
    cursor: pointer;
    outline: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.langtools-trigger:hover,
.langtools-shell.is-open .langtools-trigger {
    background: rgba(255,255,255,.14);
    border-color: rgba(255,255,255,.24);
    color: #fff;
}

.langtools-trigger:focus-visible {
    outline: 2px solid rgba(158,202,255,.9);
    outline-offset: 2px;
}

.langtools-trigger__label {
    display: none;
}

.langtools-trigger__chevron {
    font-size: 11px;
    transition: transform .15s ease;
}

.langtools-shell.is-open .langtools-trigger__chevron {
    transform: rotate(180deg);
}

.langtools-panel {
    box-sizing: border-box;
    position: absolute;
    z-index: 100;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    max-width: calc(100vw - 30px);
    padding: 12px;
    border: 1px solid #d7dae2;
    border-radius: 10px;
    background: #fff;
    color: #2c3242;
    box-shadow: 0 10px 32px rgba(0,0,0,.26);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity .14s ease, transform .14s ease, visibility 0s linear .14s;
}

.langtools-shell.is-open .langtools-panel {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition-delay: 0s;
}

.langtools {
    display: flex;
    flex-direction: column;
    gap: 11px;
    margin: 0;
    font-family: 'Scada', sans-serif;
}

.langtools__system,
.langtools__translate {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.langtools__translate {
    align-items: flex-start;
}

.langswitch_label,
.gtranslate_title {
    flex: 0 0 auto;
    color: #343a4a;
    font-size: 14px;
    font-weight: 700;
    line-height: 28px;
    white-space: nowrap;
}

.langswitch_form {
    display: inline-block;
    margin: 0;
}

.langswitch_flags {
    display: flex;
    gap: 6px;
}

.langswitch_flag,
.gtranslate_wrapper .gt_quick_flag {
    box-sizing: border-box;
    width: 34px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    padding: 0;
    box-shadow: none;
    outline: none !important;
}

.langswitch_flag:hover,
.gtranslate_wrapper .gt_quick_flag:hover {
    background: #f7f7f7;
}

.langswitch_flag.is-active,
.gtranslate_wrapper .gt_quick_flag.is-active {
    border-color: #9a9bab;
    background: #dedfeb;
}

.langswitch_flag:focus,
.langswitch_flag:active,
.gtranslate_wrapper .gt_quick_flag:focus,
.gtranslate_wrapper .gt_quick_flag:active {
    outline: none !important;
    box-shadow: none !important;
}

.langswitch_flag::-moz-focus-inner,
.gtranslate_wrapper .gt_quick_flag::-moz-focus-inner {
    border: 0;
}

.langswitch_flag img,
.gtranslate_wrapper .gt_quick_flag img {
    width: 16px;
    height: 16px;
    display: block;
}

.langtools__help {
    padding-top: 9px;
    border-top: 1px solid #e6e8ee;
    text-align: right;
}

.langtools__help a {
    color: #4b5871;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.langtools__help a:hover {
    color: #243b66;
    text-decoration: underline;
}

/*** GTranslate ***/
.gtranslate_wrapper {
    display: inline-block;
    position: relative;
    overflow: visible !important;
    z-index: 10 !important;
}

.gtranslate_wrapper .gt_switcher {
    position: relative;
    overflow: visible !important;
    z-index: 10 !important;
}

.gtranslate_wrapper .gt_switcher .gt_selected {
    position: relative;
    z-index: 10 !important;
}

.gtranslate_wrapper .gt_switcher .gt_option {
    position: absolute !important;
    top: calc(100% - 1px);
    right: 0;
    left: auto;
    z-index: 19 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.gtranslate_wrapper .gt_quick_flags {
    width: 163px;
    display: flex;
    gap: 6px;
    margin-top: 6px;
    position: relative;
    z-index: 9 !important;
}

.gtranslate_wrapper .gt_quick_flag {
    flex: 1 1 0;
    width: auto;
}

.gtranslate_wrapper .gt_search_wrap {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #eee;
    padding: 4px;
    border-bottom: 1px solid #ccc;
}

.gtranslate_wrapper .gt_search {
    width: 100%;
    box-sizing: border-box;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
    box-shadow: none;
    background: #fff;
    font-size: 13px;
}

.gtranslate_wrapper .gt_search:focus {
    border-color: #bdbdbd;
    outline: none;
    box-shadow: none;
}

/* Site Header desktop: make Language a visible navigation-style control.
   The light settings UI stays inside the popover. */
@media (min-width: 761px) {
    .spru-site-header__tools .langtools-shell {
        display: inline-flex;
    }

    .spru-site-header__tools .langtools-trigger {
        width: auto;
        height: 40px;
        padding: 0 14px;
        gap: 8px;
        border: 0;
        border-radius: 9px;
        background: transparent;
        color: rgba(255,255,255,.88);
        font: 600 18px/1 Oswald, 'Open Sans', sans-serif;
        text-shadow: 0 1px 2px rgba(0,0,0,.72);
    }

    .spru-site-header__tools .langtools-trigger:hover,
    .spru-site-header__tools .langtools-shell.is-open .langtools-trigger {
        background: rgba(255,255,255,.095);
        border-color: transparent;
        color: #fff;
    }

    .spru-site-header__tools .langtools-trigger__label {
        display: inline;
    }

    .spru-site-header__tools .langtools-trigger > .fa-globe {
        width: 18px;
        font-size: 19px;
        text-align: center;
        opacity: .95;
    }

    .spru-site-header__tools .langtools-trigger__chevron {
        margin-left: 1px;
        font-size: 11px;
        opacity: .65;
    }
}

/* Mobile drawer: the same single DOM instance becomes a compact accordion row.
   The settings themselves remain on a light card, so GTranslate/system controls
   do not need a separate dark-theme redesign. */
@media (max-width: 760px) {
    .spru-mobile-tools .langtools-shell {
        width: 100%;
    }

    .spru-mobile-tools .langtools-trigger {
        width: 100%;
        height: 44px;
        padding: 0 9px;
        justify-content: flex-start;
        border: 0;
        border-radius: 7px;
        background: transparent;
        color: #cad3e4;
        text-shadow: none;
        font-size: 14px;
        font-weight: 700;
    }

    .spru-mobile-tools .langtools-trigger:hover,
    .spru-mobile-tools .langtools-shell.is-open .langtools-trigger {
        background: rgba(255,255,255,.06);
        color: #fff;
    }

    .spru-mobile-tools .langtools-trigger__label {
        display: inline;
        margin-left: 3px;
    }

    .spru-mobile-tools .langtools-trigger__chevron {
        margin-left: auto;
    }

    .spru-mobile-tools .langtools-panel {
        position: static;
        width: auto;
        max-width: none;
        margin: 4px 0 8px;
        transform: none;
        box-shadow: 0 8px 22px rgba(0,0,0,.22);
        display: none;
    }

    .spru-mobile-tools .langtools-shell.is-open .langtools-panel {
        display: block;
        transform: none;
    }

    .spru-mobile-tools .langtools__system,
    .spru-mobile-tools .langtools__translate {
        flex-wrap: wrap;
    }

    .spru-mobile-tools .gtranslate_wrapper .gt_switcher .gt_option {
        right: auto;
        left: 0;
        max-width: calc(100vw - 72px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .langtools-trigger__chevron,
    .langtools-panel {
        transition: none;
    }
}
