/**
 * Carspace language switcher — front end.
 *
 * Sits above the WooCommerce My Account navigation, so it borrows the same
 * card look as the dashboard panels rather than introducing a new one.
 */

.carspace-lang-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 14px;
    padding: 6px;
    background: #f6f8fb;
    border: 1px solid #e4e9f0;
    border-radius: 10px;
}

.carspace-lang-switcher--pills {
    justify-content: stretch;
}

.carspace-lang-switcher__item {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    color: #5b6674;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.carspace-lang-switcher__item:hover,
.carspace-lang-switcher__item:focus {
    background: #eaeff7;
    color: #22303f;
    text-decoration: none;
}

.carspace-lang-switcher__item.is-active {
    background: #ffffff;
    border-color: #2b7dfa;
    color: #2b7dfa;
    box-shadow: 0 1px 2px rgba(16, 32, 56, .08);
}

.carspace-lang-switcher__item.is-active:hover {
    background: #ffffff;
}

.carspace-lang-switcher__flag {
    font-size: 1rem;
    line-height: 1;
}

.carspace-lang-switcher__code {
    letter-spacing: .02em;
}

/* ------------------------------------------------------------------ *
 * Dashboard topbar
 *
 * The icon buttons inherit Divi's global button padding, which stretches
 * them into tall narrow boxes and leaves no room for the language buttons.
 * Everything in the row is normalised to one identical square so the
 * language buttons and the tool icons are visibly the same control.
 * ------------------------------------------------------------------ */

.custom-dashboard-topbar {
    flex-wrap: wrap;
    gap: .75rem 1rem;
}

.custom-dashboard-topbar .user-info {
    flex: 0 1 auto;
    min-width: 0;
}

.custom-dashboard-topbar .dashboard-icons {
    flex: 1 1 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .6rem !important;
    overflow: visible;
}

/* One box shape for every child of the row — the icon buttons and the
   language group share it, so the group reads as a fourth control rather
   than three loose buttons. */
.custom-dashboard-topbar .dashboard-icons > .btn,
.custom-dashboard-topbar .dashboard-icons .carspace-lang-switcher--compact {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    min-width: 0;
    padding: 0 !important;
    margin: 0;
    line-height: 1 !important;
    border: 1px solid #ced4da;
    border-radius: 10px;
    background: #fff;
    color: #5b6674;
    text-transform: none;
    text-decoration: none;
    box-shadow: none;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.custom-dashboard-topbar .dashboard-icons > .btn:hover,
.custom-dashboard-topbar .dashboard-icons > .btn:focus {
    background: #eef2f7;
    border-color: #adb5bd;
    color: #22303f;
    text-decoration: none;
}

.custom-dashboard-topbar .dashboard-icons .lucide-icon,
.custom-dashboard-topbar .dashboard-icons svg {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
}

/* The group is the bordered box; it takes its width from its contents
   while keeping the shared 42px height. */
.custom-dashboard-topbar .dashboard-icons .carspace-lang-switcher--compact {
    width: auto;
    gap: 2px;
    padding: 3px !important;
    margin-left: .35rem;
}

.custom-dashboard-topbar .dashboard-icons .carspace-lang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-width: 30px;
    padding: 0 6px;
    font-size: .7rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .01em;
    color: #7a8694;
    background: transparent;
    border: 0;
    border-radius: 7px;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.custom-dashboard-topbar .dashboard-icons .carspace-lang-btn:hover,
.custom-dashboard-topbar .dashboard-icons .carspace-lang-btn:focus {
    background: #eef2f7;
    color: #22303f;
    text-decoration: none;
}

.custom-dashboard-topbar .dashboard-icons .carspace-lang-btn.is-active {
    background: #2b7dfa;
    color: #fff;
}

.custom-dashboard-topbar .dashboard-icons .carspace-lang-btn.is-active:hover,
.custom-dashboard-topbar .dashboard-icons .carspace-lang-btn.is-active:focus {
    background: #1f6ae0;
    color: #fff;
}

/* Keep the notification badge from colliding with the language buttons. */
.custom-dashboard-topbar .dashboard-icons #dashboard-notif-count {
    z-index: 2;
}

@media (max-width: 767.98px) {
    .custom-dashboard-topbar {
        flex-direction: column;
        /* Beats Bootstrap's .align-items-center, which centres on the cross
           axis — horizontally once the bar stacks. */
        align-items: stretch !important;
        gap: .75rem;
    }
    .custom-dashboard-topbar .user-info {
        width: 100%;
        text-align: left !important;
    }
    .custom-dashboard-topbar .dashboard-icons {
        justify-content: flex-start;
        gap: .5rem !important;
    }
}

@media (max-width: 400px) {
    .custom-dashboard-topbar .dashboard-icons > .btn,
    .custom-dashboard-topbar .dashboard-icons .carspace-lang-switcher--compact {
        width: 38px;
        height: 38px;
        border-radius: 9px;
    }
    .custom-dashboard-topbar .dashboard-icons .carspace-lang-switcher--compact {
        width: auto;
        margin-left: .15rem;
    }
    .custom-dashboard-topbar .dashboard-icons .lucide-icon,
    .custom-dashboard-topbar .dashboard-icons svg {
        width: 18px;
        height: 18px;
    }
    .custom-dashboard-topbar .dashboard-icons .carspace-lang-btn {
        min-width: 26px;
        padding: 0 4px;
        font-size: .65rem;
    }
}

/* Dropdown variant */

.carspace-lang-switcher--dropdown {
    flex-wrap: wrap;
    gap: 8px;
}

.carspace-lang-switcher__label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #7a8694;
    margin: 0;
}

.carspace-lang-switcher__select {
    flex: 1 1 auto;
    min-width: 140px;
    padding: 6px 8px;
    border: 1px solid #d7dee8;
    border-radius: 7px;
    background: #fff;
    font-size: .85rem;
    color: #22303f;
}

/* Georgian glyphs need a touch more line height to avoid clipping. */
.carspace-lang-switcher:lang(ka) .carspace-lang-switcher__item {
    line-height: 1.35;
}

@media (max-width: 480px) {
    .carspace-lang-switcher__item {
        padding: 6px 4px;
        font-size: .72rem;
    }
    .carspace-lang-switcher__flag {
        font-size: .9rem;
    }
}
