/* =====================================================================
   PCME Country Selector — Max Trade Design System
   Mirrors maxtradetopbar (.mtr-modal-*) and maxtradereassurance (.mtr-block)
   Tokens: Poppins / navy #003755 / red #e21a22 / card #f4f8fa + #e5eff5
   ===================================================================== */

/* ---------------------------------------------------------------------
   MODAL  (1:1 with .mtr-modal from maxtradetopbar)
   --------------------------------------------------------------------- */
.pcme-country-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1999999999;
    display: none;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pcme-country-modal-backdrop.is-active {
    display: flex;
}

.pcme-country-modal-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #dfdfdf;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    width: 485px;
    max-width: 92vw;
    padding: 24px;
    z-index: 2;
    font-family: 'Poppins', sans-serif;
    box-sizing: border-box;
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

.pcme-country-modal-backdrop.is-active .pcme-country-modal-card {
    transform: scale(1);
    opacity: 1;
}

/* Close button — identical to .mtr-modal-close */
.pcme-country-modal-close {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    background: #ececec !important;
    border: none !important;
    width: 24px !important;
    height: 24px !important;
    border-radius: 50% !important;
    font-size: 16px !important;
    font-weight: bold !important;
    color: #555555 !important;
    line-height: 22px !important;
    text-align: center !important;
    cursor: pointer !important;
    padding: 0 !important;
    outline: none !important;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

.pcme-country-modal-close:hover {
    background: #dfdfdf !important;
    transform: scale(1.05);
}

/* Header */
.pcme-modal-header {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
    margin-bottom: 16px;
    padding-right: 20px;
}

.pcme-modal-title {
    margin: 0 0 4px 0 !important;
    font-family: 'Poppins', sans-serif;
    font-size: 17px !important;
    font-weight: 700 !important;
    color: #003755 !important;
    line-height: 1.3 !important;
}

.pcme-modal-subtitle {
    margin: 0 !important;
    font-size: 12px !important;
    color: #666666 !important;
    line-height: 1.4 !important;
}

/* Detected-country notice — reassurance block look (dashed border) */
.pcme-modal-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #f4f8fa;
    border: 1px dashed #a5c8dc;
    border-radius: 6px;
    padding: 12px 14px;
    margin-bottom: 16px;
    font-size: 12px;
    color: #555555;
    line-height: 1.4;
    box-sizing: border-box;
}

.pcme-modal-notice:empty {
    display: none;
}

.pcme-modal-notice strong {
    font-weight: 600;
    color: #003755;
}

/* Section label */
.pcme-country-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
}

/* Country list */
.pcme-country-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 18px;
    max-height: 300px;
    overflow-y: auto;
    /* Breathing room so the first/last card border, hover lift and shadow
       are not clipped by the scroll container. */
    padding: 4px 4px 6px;
    margin-left: -4px;
    margin-right: -4px;
}

.pcme-country-grid::-webkit-scrollbar {
    width: 6px;
}

.pcme-country-grid::-webkit-scrollbar-thumb {
    background-color: #dfe7ec;
    border-radius: 4px;
}

/* Country card — identical to .mtr-modal-card */
.pcme-country-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background-color: #f4f8fa;
    border: 1px solid #e5eff5;
    border-radius: 8px;
    text-decoration: none !important;
    color: inherit !important;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
}

.pcme-country-item:hover {
    background-color: #ffffff;
    border-color: #e21a22;
    box-shadow: 0 4px 15px rgba(0, 55, 85, 0.06);
    transform: translateY(-1px);
}

.pcme-country-item.is-recommended {
    background-color: #ffffff;
    border-color: #a5c8dc;
}

/* Flag inside the same white icon box used by .mtr-card-icon-col */
.pcme-flag-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background-color: #ffffff;
    border: 1px solid #e2eff5;
    box-sizing: border-box;
    overflow: hidden;
}

.pcme-country-item:hover .pcme-flag-icon {
    border-color: #ffd2d4;
    background-color: #fff9f9;
}

.pcme-flag-icon svg {
    width: 20px;
    height: 14px;
    border-radius: 2px;
    display: block;
    transition: transform 0.2s ease-in-out;
}

.pcme-country-item:hover .pcme-flag-icon svg {
    transform: scale(1.08);
}

.pcme-country-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.pcme-country-name-text {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: #003755 !important;
    line-height: 1.3 !important;
    margin-bottom: 2px !important;
    transition: color 0.2s ease;
}

.pcme-country-item:hover .pcme-country-name-text {
    color: #e21a22 !important;
}

.pcme-country-meta {
    font-size: 11px !important;
    color: #555555 !important;
    line-height: 1.4 !important;
}

/* Badges */
.pcme-badge-recommended {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    background: #e8f2f7;
    color: #003755;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.pcme-badge-current {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    background: #f0f0f0;
    color: #666666;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

/* Actions */
.pcme-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pcme-btn-primary {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #003755;
    color: #ffffff !important;
    border: 1px solid #003755;
    border-radius: 8px;
    padding: 12px 18px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.pcme-btn-primary:hover {
    background: #002a41;
    border-color: #002a41;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(0, 55, 85, 0.18);
}

.pcme-btn-secondary {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    color: #666666 !important;
    border: 1px solid #dfdfdf;
    border-radius: 8px;
    padding: 10px 18px;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
}

.pcme-btn-secondary:hover {
    background: #f4f8fa;
    border-color: #a5c8dc;
    color: #003755 !important;
}

@media (max-width: 480px) {
    .pcme-country-modal-card {
        padding: 20px 16px;
    }
    .pcme-modal-title {
        font-size: 15px !important;
    }
    .pcme-country-item {
        padding: 10px 12px;
        gap: 10px;
    }
    .pcme-flag-icon {
        width: 28px;
        height: 28px;
    }
    .pcme-country-name-text {
        font-size: 12px !important;
    }
    .pcme-country-meta {
        font-size: 10.5px !important;
    }
}

/* ---------------------------------------------------------------------
   MODAL FOOTER — privacy policy link
   --------------------------------------------------------------------- */
.pcme-modal-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.pcme-modal-footer:empty {
    display: none;
}

.pcme-privacy-link {
    font-family: 'Poppins', sans-serif;
    font-size: 11px;
    color: #666666 !important;
    text-decoration: underline !important;
    transition: color 0.2s ease;
}

.pcme-privacy-link:hover {
    color: #e21a22 !important;
}

/* ---------------------------------------------------------------------
   HEADER — the theme's own selector markup is kept (button.tv-language-btn
   + ul.tv-language-dropdown); only its presentation is refined here.
   Font: Poppins 400 — the lightest weight the theme actually loads
   (Poppins 300 is not in poppins.css, so it would be faux-synthesised).
   Hover keeps the theme's own accent #c80436.
   --------------------------------------------------------------------- */

/* Keep the caption on the SAME line as the selector: the theme's button
   wrapper is a block element, which pushed the caption onto its own row. */
#tvcmsdesktop-language-selector,
#tvcmsmobile-language-selector,
.tvcms-header-language.tvheader-language-wrapper {
    white-space: nowrap;
}

#tvcmsdesktop-language-selector > .tvheader-language-btn-wrapper,
#tvcmsmobile-language-selector > .tvheader-language-btn-wrapper,
.tvcms-header-language.tvheader-language-wrapper > .tvheader-language-btn-wrapper {
    display: inline-block !important;
    vertical-align: middle !important;
}

/* "Select your country:" caption */
.pcme-lang-label {
    display: inline-block;
    margin: 0 9px 0 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0.2px;
    color: #333333;
    white-space: nowrap;
    vertical-align: middle;
    line-height: 40px;
}

/* Trigger: keep the theme colour/size, just tighten the wide tracking so
   longer country names (Magyarország, Česká republika) stay readable */
#tvcmsdesktop-language-selector .tv-language-btn .tv-language-span,
#tvcmsmobile-language-selector .tv-language-btn .tv-language-span {
    font-family: 'Poppins', sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: 0.3px !important;
}

#tvcmsdesktop-language-selector .tv-language-btn img.lang-flag,
#tvcmsmobile-language-selector .tv-language-btn img.lang-flag {
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

/* Hard size guard for the swapped SVG flags: an SVG with only a viewBox has no
   intrinsic size, so without this it stretches to the container. */
img[data-pcme-flag] {
    width: 18px !important;
    height: 12px !important;
    min-width: 0 !important;
    max-width: 18px !important;
    max-height: 12px !important;
    object-fit: cover;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    vertical-align: middle !important;
    display: inline-block !important;
}

/* Dropdown panel */
.tvcms-header-language .tv-language-dropdown,
#tvcmsdesktop-language-selector .tv-language-dropdown,
#tvcmsmobile-language-selector .tv-language-dropdown {
    /* Width follows the longest country name instead of a fixed min-width,
       so there is no dead space on the right. */
    min-width: 0 !important;
    width: -moz-max-content;
    width: max-content;
    max-width: 320px;
    padding: 8px !important;
    border: 1px solid #ececec !important;
    border-radius: 10px;
    background-color: #ffffff !important;
    box-shadow: 0 10px 30px rgba(0, 55, 85, 0.10) !important;
    overflow: hidden;
}

/* Options */
.tvcms-header-language .tv-language-dropdown li,
#tvcmsdesktop-language-selector .tv-language-dropdown li,
#tvcmsmobile-language-selector .tv-language-dropdown li {
    list-style: none;
    margin: 0;
}

.tvcms-header-language .tv-language-dropdown li a,
#tvcmsdesktop-language-selector .tv-language-dropdown li a,
#tvcmsmobile-language-selector .tv-language-dropdown li a {
    display: flex !important;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: 6px;
    font-family: 'Poppins', sans-serif;
    font-size: 13px !important;
    font-weight: 400;
    letter-spacing: 0.2px;
    line-height: 1.4 !important;
    color: #003755 !important;
    text-decoration: none !important;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.tvcms-header-language .tv-language-dropdown li a:hover,
#tvcmsdesktop-language-selector .tv-language-dropdown li a:hover,
#tvcmsmobile-language-selector .tv-language-dropdown li a:hover {
    background-color: #f6f9fb;
    color: #c80436 !important;
}

.tvcms-header-language .tv-language-dropdown li.current a,
#tvcmsdesktop-language-selector .tv-language-dropdown li.current a,
#tvcmsmobile-language-selector .tv-language-dropdown li.current a {
    background-color: #f4f8fa;
    font-weight: 600;
}

.tvcms-header-language .tv-language-dropdown li a img,
#tvcmsdesktop-language-selector .tv-language-dropdown li a img,
#tvcmsmobile-language-selector .tv-language-dropdown li a img {
    margin: 0 !important;
    flex-shrink: 0;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    vertical-align: middle !important;
}

@media (max-width: 991px) {
    .pcme-lang-label {
        display: none;
    }
}
