/* Shared language control. JavaScript moves it into the most suitable header. */
.peso-language-picker {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 2147482000;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--peso-ink, #17251e);
}

.peso-language-picker select {
    width: auto;
    min-width: 112px;
    min-height: 42px;
    margin: 0;
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--peso-line, #d3e0d8);
    border-radius: 11px;
    background-color: var(--peso-surface, #fff);
    color: var(--peso-ink, #17251e);
    box-shadow: 0 7px 18px rgba(15, 49, 31, .08);
    font: 700 13px/1.2 var(--peso-font-ui, "Segoe UI Variable Text", Aptos, Inter, "Segoe UI", sans-serif);
    cursor: pointer;
}

.peso-language-picker select:hover {
    border-color: color-mix(in srgb, var(--peso-green, #087443) 48%, var(--peso-line, #d3e0d8));
    background-color: color-mix(in srgb, var(--peso-surface, #fff) 94%, var(--peso-green, #087443));
}

.peso-language-picker select:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--peso-gold, #d6a514) 65%, transparent);
    outline-offset: 2px;
}

.peso-language-picker--inline {
    position: static !important;
    inset: auto !important;
    z-index: auto !important;
    order: 50;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    transform: none !important;
}

.auth-toolbar .peso-language-picker--inline {
    margin-left: auto;
}

.peso-public-header .header-actions .peso-language-picker--inline,
.site-header .header-actions .peso-language-picker--inline,
.js-dashboard-actions .peso-language-picker--inline,
.topbar .top-right .peso-language-picker--inline {
    margin-inline: 2px;
}

body.peso-has-assistant:not(.peso-language-in-header) .peso-language-picker {
    right: 300px;
}

body.peso-assistant-open:not(.peso-language-in-header) .peso-language-picker {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

html:not(.light) .peso-language-picker select,
body:not(.light) .peso-language-picker select {
    color-scheme: dark;
}

body.light .peso-language-picker select,
html.light .peso-language-picker select,
.auth-toolbar .peso-language-picker select,
.peso-public-header .peso-language-picker select,
.site-header .peso-language-picker select {
    color-scheme: light;
}

@media (max-width: 920px) {
    .peso-language-picker--inline select {
        min-width: 104px;
        min-height: 40px;
        padding-block: 7px;
        font-size: 12.5px;
    }

    .header-actions,
    .js-dashboard-actions,
    .topbar .top-right,
    .auth-toolbar {
        flex-wrap: wrap;
    }
}

@media (max-width: 720px) {
    html body[data-peso-page] .site-header.peso-public-header .container.header-inner,
    html body[data-peso-page] .site-header .container.header-inner {
        min-height: 0 !important;
        padding-block: 10px !important;
        flex-wrap: wrap !important;
        align-items: center !important;
    }

    html body[data-peso-page] .site-header.peso-public-header .container.header-inner > .header-actions,
    html body[data-peso-page] .site-header .container.header-inner > .header-actions {
        width: 100% !important;
        max-width: 100% !important;
        flex: 1 0 100% !important;
        justify-content: flex-end !important;
        gap: 8px !important;
        margin-left: 0 !important;
    }

    html body[data-peso-page] .site-header.peso-public-header .peso-language-picker--inline,
    html body[data-peso-page] .site-header .peso-language-picker--inline {
        margin-left: auto !important;
    }

    .peso-language-picker:not(.peso-language-picker--inline) {
        right: 14px;
        bottom: 14px;
    }

    body.peso-has-assistant:not(.peso-language-in-header) .peso-language-picker {
        right: 14px;
        bottom: calc(82px + env(safe-area-inset-bottom));
    }

    body.peso-role-jobseeker.peso-has-assistant:not(.peso-auth-page):not(.peso-language-in-header) .peso-language-picker {
        bottom: calc(146px + env(safe-area-inset-bottom));
    }

    .peso-language-picker--inline select {
        min-width: 96px;
        max-width: 138px;
    }
}

@media (min-width: 721px) and (max-width: 1100px) {
    body.peso-has-assistant:not(.peso-language-in-header) .peso-language-picker {
        right: 20px;
        bottom: 94px;
    }
}

/* Bilingual layout guardrails -------------------------------------------------
   Tagalog labels are commonly longer than their English equivalents. These
   rules reserve real layout space for either language instead of clipping text
   or allowing adjacent controls to overlap. */
html[lang] body[data-peso-page] :is(
    .page-header, .section-header, .card-header, .panel-header,
    .header-actions, .top-right, .filter-bar, .tabs, .filter-tabs
) > * {
    min-width: 0;
}

html[lang="fil"] body[data-peso-page] :is(
    button, .btn, .peso-btn, .nav-link, .tab, .filter-tab, .badge,
    h1, h2, h3, h4, p, label, strong, small
) {
    overflow-wrap: break-word;
}

/* Public landing footer: avoid the old fixed 300/180/300 columns at tablets. */
@media (min-width: 721px) and (max-width: 1100px) {
    html body[data-peso-page="index"] .footer-grid {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr) !important;
        gap: 28px !important;
    }

    html body[data-peso-page="index"] .footer-grid > :first-child {
        grid-column: 1 / -1;
    }

    html body[data-peso-page="index"] .footer-grid > * {
        width: auto !important;
        min-width: 0 !important;
        max-width: 100% !important;
    }

    /* Three cards leave too little room for titles, company names and the
       translated Posted label. Two balanced columns keep every field legible. */
    html body[data-peso-page="index"] .ref-job-list {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}

@media (max-width: 720px) {
    html body[data-peso-page="index"] .footer-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 26px !important;
    }

    html body[data-peso-page="index"] .ref-job-list {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    /* The language selector gets its own fixed slot between Back and Theme. */
    html body.auth-page .auth-toolbar .peso-language-picker--inline {
        position: fixed !important;
        z-index: 2147482001 !important;
        top: 12px !important;
        right: 70px !important;
        bottom: auto !important;
        left: auto !important;
        width: auto !important;
        margin: 0 !important;
    }

    html body.auth-page .auth-toolbar .peso-language-picker--inline select {
        width: auto !important;
        min-width: 116px !important;
        max-width: 126px !important;
    }
}

/* Registration uses fixed corner actions; center the brand independently so
   the longer Tagalog Back label can never sit on top of it. */
html body[data-peso-page="jobseeker-register"] .registration-toolbar .registration-brand {
    grid-column: 1 / -1 !important;
    width: max-content !important;
    max-width: calc(100% - 390px) !important;
    justify-self: center !important;
}

@media (max-width: 760px) {
    html body[data-peso-page="jobseeker-register"] .registration-toolbar .registration-brand {
        max-width: calc(100% - 150px) !important;
    }
}

/* Keep translated authenticated navigation labels intact. */
html[lang="fil"] body.peso-jobseeker-suite .js-dashboard-links .js-suite-added-link,
html[lang="fil"] body[data-peso-page^="employer-"] .navbar .nav-links .nav-link {
    flex: 0 0 auto !important;
}

@media (min-width: 1181px) {
    html[lang="fil"] body.peso-jobseeker-suite .js-dashboard-links .js-suite-added-link {
        gap: 6px !important;
        padding-inline: 10px !important;
    }
}

/* Give the longer category controls a complete row on tablet widths. */
@media (max-width: 1000px) {
    html body[data-peso-page="jobseeker-home"] .js-panel-heading {
        align-items: flex-start !important;
        flex-direction: column !important;
    }

    html body[data-peso-page="jobseeker-home"] .js-match-controls {
        width: 100% !important;
        max-width: 100% !important;
        flex-wrap: wrap !important;
        overflow: visible !important;
        padding-bottom: 0 !important;
    }

    html body[data-peso-page="jobseeker-home"] .js-match-controls > a {
        max-width: 100% !important;
        white-space: normal !important;
    }
}
