/* input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    height: 1em;
    width: 1em;
    border-radius: 50em;
    background: url(https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&icon_names=cancel) no-repeat 50% 50%;
    background-size: contain;
    opacity: 0;
    pointer-events: none;
}

input[type="search"]:focus::-webkit-search-cancel-button {
    opacity: .3;
    pointer-events: all;
} */

.country-item {
    position:relative;
    width: 100%;
    height: 125px;
    color: #262524;
}

.country-image-wrapper {
    width: 150px;
    height: 120px;
    overflow: hidden;
    clip-path: polygon(0 0, 90px 0, 100% 100%, 0 100%);
    border-bottom-left-radius: 5px;
}

.country-image {
    width: 100%;
    height: 98%;
    background-size: cover;
}

[class*="cbg-"] {
    display: block;
    width: 150px;
    height: 120px;
    background: url("../images/default-bg.bfb205ec255a.jpg") no-repeat center;
    background-size: cover;
}

.country-flag {
    width: 90px;
    height: 60px;
    position:absolute;
    top: 20%;
    left: 55px;
    transition: left 0.3s ease;
    filter: drop-shadow( -2px 2px 2px rgba(0, 0, 0, 0.25));

    @media (min-width: 1400px) {
        left: 45px
    }
}

.country-item:hover .country-flag {
    left: 45px;

    @media (min-width: 1400px) {
        left: 35px
    }
}

.country-info-wrapper {
    position: absolute;
    width: 100%;
    height: 100%;
    filter: drop-shadow(-2px 2px 5px rgba(0, 0, 0, 0.25));
}

.country-info {
    width: inherit;
    height: inherit;
    text-align: end;
    padding: 10px 15px 10px 110px;
    background-color: white;
    clip-path: polygon(90px 0, 100% 0, 100% 100%, 150px 100%);

    @media (min-width: 1400px) {
        clip-path: polygon(80px 0, 100% 0, 100% 100%, 140px 100%);
    }
}

/* The countries block sits inside the shared `.container.my-5` page wrapper
   (home/templates/cjkcms/pages/web_page.html). Trim that wrapper's vertical
   margin only where this block renders, without touching the site-wide wrapper.
   `!important` is required to beat Bootstrap's `.my-5` utility. */
/* .container.my-5:has(#resource_types) {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
} */

/* --- Unified filter controls ---------------------------------------------
   Matched to the design system's SearchInput and Select form controls
   (components/forms): compact white fields with a 10px radius and hairline
   border that strengthens on hover/focus, sitting on the barely-there card
   shadow. Selects get a small uppercase label above the control; the whole
   toolbar aligns on one baseline row. */
.sf-toolbar {
    gap: 14px;
}

.sf-field {
    min-width: 0;
}

.sf-field-search {
    flex: 1 1 240px;
    max-width: 340px;
}

.sf-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #626262;
}

.sf-search {
    gap: 10px;
    padding: 9px 14px;
    border: 1px solid var(--mdb-border-color, #dededa);
    border-radius: var(--mdb-border-radius, 0.75rem);
    box-shadow: 0 1px 2px rgba(34, 34, 34, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.2s ease;
}

.sf-search:focus-within {
    border-color: var(--mdb-border-color-strong, #c9c9c4);
    box-shadow: 0 2px 8px rgba(34, 34, 34, 0.06), 0 1px 2px rgba(34, 34, 34, 0.04);
}

.sf-search-icon {
    flex: none;
    font-size: 0.9rem;
    color: #828282;
}

.sf-search input {
    min-width: 0;
    background: transparent;
    font-size: 0.9rem;
    color: #222222;
}

.sf-search input:focus {
    outline: none;
    box-shadow: none;
}

.sf-search input::placeholder {
    color: #828282;
}

/* Native <select> styled like the previous control: only the picker the
   browser opens is native. The caret is an inline SVG chevron. */
.sf-select {
    width: 100%;
    min-width: 160px;
    padding: 9px 36px 9px 14px;
    appearance: none;
    -webkit-appearance: none;
    background-color: #fff;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23828282' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    border: 1px solid var(--mdb-border-color, #dededa);
    border-radius: var(--mdb-border-radius, 0.75rem);
    font-size: 0.9rem;
    font-family: inherit;
    color: #222222;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(34, 34, 34, 0.04);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.sf-select:hover,
.sf-select:focus {
    border-color: var(--mdb-border-color-strong, #c9c9c4);
    box-shadow: 0 2px 8px rgba(34, 34, 34, 0.06), 0 1px 2px rgba(34, 34, 34, 0.04);
    outline: none;
}

/* Small screens: search takes the full row, filters pair up below it */
@media (max-width: 767.98px) {
    .sf-field {
        flex: 1 1 calc(50% - 14px);
    }

    .sf-field-search {
        flex: 1 1 100%;
        max-width: none;
    }

    .search-filter-bar .sf-select {
        min-width: 0;
    }
}

/* --- Active filter chips --------------------------------------------------
   The design system's FilterChip in its selected state: a brand-tinted pill
   with a red border and a plain inline remove cross — red stays reserved
   for the active selection (components/forms/FilterChip). */
.active-filters {
    font-size: 0.85rem;
    color: #626262;
}

.active-filters-results {
    font-weight: 600;
    color: #222222;
}

.active-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.2;
    color: #a92727;
    background-color: #f8e8e8;
    border: 1px solid #c53030;
    border-radius: var(--mdb-border-radius-pill, 999px);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.active-filter-chip:hover,
.active-filter-chip:focus-visible {
    background-color: #f3dcdc;
    outline: none;
}

.active-filter-chip .chip-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: inherit;
}

.active-filters-clear {
    font-weight: 600;
    color: #c53030;
}

.active-filters-clear:hover {
    color: #a92727;
}
/* --- All-countries header (sort + view toggle) ---------------------------- */
.country-sort-toggle {
    width: auto;
    min-width: 0;
    height: 42px;
    padding-top: 0;
    padding-bottom: 0;
    font-weight: 600;
    color: #626262;
}

/* Styled like the design system's SegmentedControl: a neutral soft-filled
   track with the active option raised on a white chip, not a red fill —
   red stays reserved for the one high-priority action per view. */
.view-toggle {
    height: 42px;
    background-color: #ececea;
    padding: 3px;
    gap: 2px;
    border-radius: var(--mdb-border-radius, 0.75rem);
}

.view-toggle-btn {
    width: 42px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--mdb-border-radius-sm, 0.5rem);
    background: transparent;
    color: #626262;
    font-size: 1rem;
    transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.view-toggle-btn + .view-toggle-btn {
    border-left: 0;
}

.view-toggle-btn.active {
    background-color: #fff;
    color: #222222;
    box-shadow: 0 1px 2px rgba(34, 34, 34, 0.04);
}

/* --- Alphabet quick filter ------------------------------------------------ */
.alphabet-bar {
    display: grid;
    /* Column count follows the localized alphabet's length */
    grid-auto-flow: column;
    grid-auto-columns: minmax(1.75rem, 1fr);
    grid-template-columns: max-content;
    gap: 0.25rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}

.alphabet-letter {
    border: 0;
    background: transparent;
    padding: 0.25rem 0.4rem;
    font-weight: 600;
    font-size: 0.95rem;
    color: #626262;
    border-radius: var(--mdb-border-radius-sm, 0.5rem);
    transition: color 0.15s ease, background-color 0.15s ease;
}

.alphabet-letter:hover:not(:disabled) {
    color: #c53030;
    background-color: #f8e8e8;
}

.alphabet-letter.active {
    color: #c53030;
}

.alphabet-letter:disabled {
    color: #c9c9c4;
    cursor: default;
}

/* --- Country card grids --------------------------------------------------- */
.country-card {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: var(--mdb-border-radius-lg, 1rem);
    text-decoration: none;
}

.country-card-background {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #73777b url("../images/default-bg.bfb205ec255a.jpg") center / cover no-repeat;
}

/* The generated sprite rules supply the URL and vertical offset. Each WebP
   fragment is a panoramic 320x80 image sized for the four-column card grid. */
.country-background-sprite {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    transform: scale(1);
    transform-origin: center;
    transition: transform 0.3s ease;
}

.country-card-flag {
    display: block;
    overflow: hidden;
    width: 45px;
    height: 30px;
    border: 0;
    border-radius: 3px;
    background: transparent;
}

.country-flag-sprite {
    width: 90px;
    height: 60px;
    display: block;
    border-radius: 3px;
    background-color: #fff;
    background-repeat: no-repeat;
    position: relative;
    left: 0;
    transform: scale(0.5);
    transform-origin: top left;
}

.country-card-content {
    position: relative;
    z-index: 2;
}

.country-name,
.country-continent,
.country-card-updated {
    display: block;
}

.country-updated-inline {
    display: none;
}

.country-name {
    overflow: hidden;
    font-weight: 700;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.country-card-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease;
}

/* Visual grid: panoramic image on top, country details below. */
.country-grid--background .country-card {
    height: auto;
    border: 1px solid #dededa;
    background: #fff;
    color: #626262;
    box-shadow: none;
    transition: border-color 0.15s ease;
}

.country-grid--background .country-card:hover {
    border-color: #c9c9c4;
    box-shadow: none;
}

.country-grid--background .country-card:hover .country-background-sprite {
    transform: scale(1.035);
}

.country-grid--background .country-card-background {
    position: relative;
    inset: auto;
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 1;
    border-radius: var(--mdb-border-radius-lg, 1rem) var(--mdb-border-radius-lg, 1rem) 0 0;
}

.country-grid--background .country-card::after {
    display: none;
}

.country-grid--background .country-card-content {
    display: grid;
    width: 100%;
    height: 88px;
    padding: 0.75rem 1rem;
    align-items: center;
    column-gap: 0.6rem;
    grid-template-columns: 42px minmax(0, 1fr) 38px;
    grid-template-rows: 1fr;
}

.country-grid--background .country-card-flag {
    position: static;
    width: 42px;
    height: 28px;
    border: 0;
    border-radius: 3px;
    background: transparent;
    box-shadow: none;
    filter: none;
    grid-column: 1;
    grid-row: 1;
}

.country-grid--background .country-flag-sprite {
    left: 0;
    transform: scale(0.4667);
}

.country-grid--background .country-card-copy {
    overflow: hidden;
    grid-column: 2;
    grid-row: 1;
}

.country-grid--background .country-name {
    color: #222222;
    font-size: 1rem;
}

.country-grid--background .country-continent,
.country-grid--background .country-card-updated {
    color: #828282;
    font-size: 0.8rem;
}

.country-grid--background .country-updated-inline {
    display: inline;
}

.country-grid--background .country-card-updated {
    display: none;
}

.country-grid--background .country-card-arrow {
    width: 38px;
    height: 38px;
    align-self: center;
    border-radius: 50%;
    background: transparent;
    color: #626262;
    grid-column: 3;
    grid-row: 1;
    transition: color 0.15s ease;
}

.country-grid--background .country-card:hover .country-card-arrow {
    color: #c53030;
    transform: translateX(3px);
}

/* Minimal grid: no background, compact flag-led cards. */
.country-grid--minimal .country-card {
    height: 100%;
    min-height: 78px;
    border: 1px solid #dededa;
    background: #fff;
    color: #626262;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.country-grid--minimal .country-card:hover {
    border-color: #c9c9c4;
    box-shadow: var(--mdb-shadow-sm);
}

.country-grid--minimal .country-card-background {
    display: none;
}

.country-grid--minimal .country-card-content {
    display: grid;
    min-height: 78px;
    padding: 0.75rem 1rem;
    align-items: center;
    column-gap: 0.75rem;
    grid-template-columns: 45px minmax(0, 1fr) auto;
}

.country-grid--minimal .country-card-flag {
    width: 45px;
    height: 30px;
    border-radius: 3px;
    box-shadow: none;
    filter: none;
}

.country-grid--minimal .country-flag-sprite {
    left: 0;
    transform: scale(0.5);
}

.country-grid--minimal .country-card-copy {
    min-width: 0;
}

.country-grid--minimal .country-name {
    color: #222222;
}

.country-grid--minimal .country-continent,
.country-grid--minimal .country-card-updated {
    color: #828282;
    font-size: 0.8rem;
}

.country-grid--minimal .country-updated-inline {
    display: inline;
}

.country-grid--minimal .country-card-updated {
    display: none;
}

.country-grid--minimal .country-card-arrow {
    color: #626262;
}

.country-grid--minimal .country-card:hover .country-card-arrow {
    color: #c53030;
    transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
    .country-background-sprite {
        transition: none;
    }
}

/* --- Recently viewed cards ------------------------------------------------ */
.recently-visited-view-all {
    color: #c53030;
}

.recently-visited-view-all:hover {
    color: #a92727;
}

.recently-visited-card {
    height: 220px;
    border-radius: var(--mdb-border-radius-lg, 1rem);
}

.recently-visited-card .country-background-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.15);
    transition: transform 0.25s ease;
}

.recently-visited-card:hover .country-background-image {
    transform: scale(1.04);
}

.recently-visited-card .country-flag-image {
    width: auto;
    height: 40px;
    object-fit: contain;
    align-self: flex-start;
    filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.35));
}

.recently-visited-card .country-content {
    background: linear-gradient(to top, rgba(34, 34, 34, 0.8), rgba(34, 34, 34, 0.5) 35%, transparent 70%);
}

.recently-visited-arrow {
    position: absolute;
    bottom: 1.25rem;
    right: 1rem;
    /* transform: translateY(-50%); */
    width: 44px;
    height: 44px;
    z-index: 1;
    transition: transform 0.15s ease;
}

.recently-visited-card:hover .recently-visited-arrow {
    transform: translateY(-50%) translateX(3px);
}

/* --- Letter grouping ------------------------------------------------------ */
.letter-header {
    margin-top: 1rem;
}

.letter-header-label {
    font-size: 1.15rem;
    font-weight: 700;
    color: #c53030;
    border-bottom: 1px solid #dededa;
    padding-bottom: 0.35rem;
    margin-bottom: 0;
}

/* Search phrase active: letter filtering is unavailable */
.alphabet-bar.disabled {
    opacity: 0.45;
    pointer-events: none;
}
