/**
 * Medal Recipients V2 widget — scoped BEM styles.
 *
 * All rules are namespaced under the widget's own root `.wc-mr` (a unique
 * BEM namespace) so styling applies regardless of the Elementor wrapper and
 * never bleeds into the rest of the page. Layout, colours, typography and
 * spacing mirror the supplied design reference.
 */

.wc-mr {
    --wc-mr-primary: #281e6b;
    --wc-mr-accent: #009de1;
    --wc-mr-bg: #f6f6f6;
    --wc-mr-card-bg: #ffffff;
    --wc-mr-text: #000000;
    --wc-mr-muted: #9a9a9a;
    --wc-mr-border: #f9f9f9;
    --wc-mr-radius: 10px;
    --wc-mr-max: 1230px;

    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    color: var(--wc-mr-text);
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
}

.wc-mr *,
.wc-mr *::before,
.wc-mr *::after {
    box-sizing: border-box;
}

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.wc-mr__tabs {
    display: flex;
    flex-wrap: nowrap;
    gap: 0;
    width: 100%;
    max-width: var(--wc-mr-max);
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: hidden;
}

.wc-mr__tab {
    flex: 1 1 auto;
    min-width: 0;
    padding: clamp(16px, 2.4vw, 30px) clamp(12px, 2vw, 30px) !important;
    margin: 0 !important;
    border: 2px solid var(--wc-mr-border) !important;
    border-bottom: 0 !important;
    border-radius: 10px 10px 0 0 !important;
    background: #ffffff !important;
    color: var(--wc-mr-primary) !important;
    font-family: inherit !important;
    font-size: clamp(14px, 1.9vw, 23px) !important;
    font-weight: 400 !important;
    line-height: 1.2 !important;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    cursor: pointer;
    white-space: normal;
    overflow-wrap: break-word;
    box-shadow: none !important;
    transition: background-color 0.2s ease;
}

.wc-mr__tab.is-active {
    background: var(--wc-mr-bg) !important;
    border-color: var(--wc-mr-bg) !important;
    color: var(--wc-mr-primary) !important;
    font-weight: 700 !important;
}

.wc-mr__tab:hover,
.wc-mr__tab:focus {
    background: var(--wc-mr-accent) !important;
    border-color: var(--wc-mr-accent) !important;
    color: #ffffff !important;
}

.wc-mr__tab.is-active:hover,
.wc-mr__tab.is-active:focus {
    background: var(--wc-mr-bg) !important;
    border-color: var(--wc-mr-bg) !important;
    color: var(--wc-mr-primary) !important;
}

.wc-mr__tab:focus-visible {
    outline: 2px solid var(--wc-mr-accent);
    outline-offset: -2px;
}

/* ── Panel layout (full-width background, boxed content) ──────────────── */
.wc-mr__panels {
    width: 100%;
    background: var(--wc-mr-bg);
}

.wc-mr__panel {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 20px;
    width: 100%;
    max-width: var(--wc-mr-max);
    margin: 0 auto;
    padding: 70px 20px 100px;
    background: transparent;
}

.wc-mr__panel[hidden] {
    display: none;
}

/* ── Mobile toolbar (hidden on desktop) ───────────────────────── */
.wc-mr__toolbar {
    display: none;
}

/* ── Sidebar filter ───────────────────────────────────────────────────── */
.wc-mr__sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    flex: 0 0 295px;
    width: 295px;
    padding: 20px;
    background: var(--wc-mr-primary);
    border-radius: var(--wc-mr-radius);
    position: sticky;
    top: 20px;
}

.wc-mr__sort,
.wc-mr__filters {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wc-mr__label {
    margin: 0;
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #ffffff;
    opacity: 0.8;
}

.wc-mr__sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.wc-mr__field-input {
    width: 100%;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 11px 12px !important;
    background-color: rgba(255, 255, 255, 0.2) !important;
    background-image: none;
    border: 0 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    color: #ffffff !important;
    font-family: inherit !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
    -webkit-appearance: none;
    appearance: none;
}

.wc-mr__field-input::placeholder {
    color: rgba(255, 255, 255, 0.7) !important;
    opacity: 1;
}

.wc-mr__field-input:focus,
.wc-mr__field-input:focus-visible {
    background-color: rgba(255, 255, 255, 0.28) !important;
    outline: 2px solid var(--wc-mr-accent);
    outline-offset: 1px;
}

/* Native select option colours fall back to the OS, so force readable text. */
.wc-mr__field-input option {
    color: #000000;
}

/* Dropdown caret. */
.wc-mr select.wc-mr__field-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23ffffff' d='M6 8 0 0h12z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    padding-right: 30px !important;
}

/* Search field magnifier icon (right-aligned, like the design). */
.wc-mr input.wc-mr__search {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    padding-right: 34px !important;
}

.wc-mr input.wc-mr__search::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.wc-mr__search-btn {
    width: 100%;
    margin: 0 !important;
    padding: 11px !important;
    background: var(--wc-mr-accent) !important;
    border: 0 !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    color: #ffffff !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.wc-mr__search-btn:hover,
.wc-mr__search-btn:focus {
    background: var(--wc-mr-accent) !important;
    color: #ffffff !important;
    opacity: 0.9;
}

.wc-mr__reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    align-self: flex-start;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    color: #ffffff !important;
    font-family: inherit !important;
    font-size: 10px !important;
    font-weight: 400 !important;
    text-transform: uppercase;
    cursor: pointer;
}

.wc-mr__reset-btn:hover,
.wc-mr__reset-btn:focus {
    background: transparent !important;
    color: #ffffff !important;
    text-decoration: underline;
}

/* ── Content / grid ───────────────────────────────────────────────────── */
.wc-mr__content {
    flex: 1 1 auto;
    min-width: 0;    max-width: 100%;}

.wc-mr__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.wc-mr__empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 30px;
    background: var(--wc-mr-card-bg);
    border-radius: var(--wc-mr-radius);
    text-align: center;
}

/* ── Card ─────────────────────────────────────────────────────────────── */
.wc-mr__card {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 30px;
    padding: 30px;
    background: var(--wc-mr-card-bg);
    border-radius: var(--wc-mr-radius);
}

.wc-mr__card-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.wc-mr__country {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wc-mr__flag {
    width: 22px;
    height: auto;
    flex: 0 0 auto;
    border-radius: 2px;
}

.wc-mr__country-name {
    font-size: 14px;
    font-weight: 400;
    color: var(--wc-mr-text);
}

.wc-mr__field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wc-mr__field-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--wc-mr-muted);
}

.wc-mr__field-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--wc-mr-text);
    word-break: break-word;
}

.wc-mr__photo {
    flex: 0 0 147px;
    width: 147px;
    height: 141px;
    background: #d9d9d9;
    border-radius: 8px;
    overflow: hidden;
}

.wc-mr__photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.wc-mr__photo-img--fallback {
    object-fit: contain;
    padding: 16px;
}

/* ── Load more ────────────────────────────────────────────────────────── */
.wc-mr__more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.wc-mr__more-wrap.hidden {
    display: none;
}

.wc-mr__more-btn {
    min-width: 200px;
    margin: 0;
    padding: 11px 24px;
    background: var(--wc-mr-accent);
    border: 0;
    border-radius: 20px;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.wc-mr__more-btn:hover {
    opacity: 0.9;
}

.wc-mr__more-btn:disabled {
    opacity: 0.6;
    cursor: progress;
}

/* ── Loading state ────────────────────────────────────────────────────── */
.wc-mr__panel.is-loading .wc-mr__grid {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Responsive: tablet & mobile (collapsible filters) ────────────────── */
@media (max-width: 1024px) {
    .wc-mr__panel {
        flex-direction: column;
        padding: 40px 16px 60px;
    }

    .wc-mr__content {
        width: 100%;
        order: 2;
    }

    /* Toolbar with SORT BY / FILTERS toggles + reset link. */
    .wc-mr__toolbar {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 16px;
        width: 100%;
        order: 0;
    }

    .wc-mr__toolbar-buttons {
        display: flex;
        flex-direction: row;
        gap: 7px;
    }

    .wc-mr__toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        margin: 0 !important;
        padding: 10px 12px !important;
        border: 1px solid var(--wc-mr-primary) !important;
        border-radius: 6px !important;
        background: #ffffff !important;
        box-shadow: none !important;
        color: var(--wc-mr-primary) !important;
        font-family: inherit !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        line-height: 1 !important;
        text-transform: uppercase;
        letter-spacing: normal !important;
        cursor: pointer;
    }

    .wc-mr__toggle--filters {
        background: var(--wc-mr-primary) !important;
        border-color: var(--wc-mr-primary) !important;
        color: #ffffff !important;
    }

    .wc-mr__toggle[aria-expanded="true"] {
        background: var(--wc-mr-accent) !important;
        border-color: var(--wc-mr-accent) !important;
        color: #ffffff !important;
    }

    .wc-mr__toolbar .wc-mr__reset-btn--toolbar {
        color: var(--wc-mr-primary) !important;
        align-self: flex-start;
    }

    /* Sidebar collapses by default; toolbar toggles it open. */
    .wc-mr__sidebar {
        flex: 0 0 auto;
        width: 100%;
        position: static;
        top: auto;
        order: 1;
        display: none;
        margin-top: 16px;
    }

    .wc-mr__panel.is-filters-open .wc-mr__sidebar {
        display: flex;
    }
}

/* ── Responsive: mobile ───────────────────────────────────────────────── */
@media (max-width: 767px) {
    .wc-mr__panel {
        padding: 40px 16px 50px;
    }

    .wc-mr__grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .wc-mr__tabs {
        gap: 4px;
        padding: 0 16px;
    }

    .wc-mr__tab {
        flex: 1 1 0;
        padding: 20px !important;
        font-size: 14px !important;
        line-height: 16px !important;
        letter-spacing: -0.3px;
        white-space: normal;
    }

    .wc-mr__more-btn {
        width: 100%;
    }
}
