/* =============================================================================
   Know.Travel — Country Single Page (KT Redesign)
   Source: country-final-design.html
   ============================================================================= */

/* ── HERO ──────────────────────────────────────────────────────────────────── */
.country-hero {
    position: relative;
    height: 520px;
    overflow: hidden;
    /* No margin-top here — KT header system handles offset via body or wrapper */
}
.hero-bg { position: absolute; inset: 0; }

/* Layer 1: gradient — shows instantly, animates */
.hero-placeholder {
    position: absolute; inset: 0;
    animation: drift 12s ease-in-out infinite;
    z-index: 1;
}
/* Layer 2: full image — fades in when loaded (over gradient) */
.hero-img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 1.8s ease-out;
    z-index: 2;
}
.hero-img.loaded { opacity: 1; }

.hero-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(0,0,0,.15) 0%, rgba(0,0,0,0) 40%, rgba(0,0,0,.6) 100%);
    z-index: 3;
}

.hero-breadcrumbs {
    position: absolute; top: 16px; left: 24px; z-index: 10;
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: rgba(255,255,255,.75);
}
.hero-breadcrumbs a { color: rgba(255,255,255,.85); transition: color .15s; }
.hero-breadcrumbs a:hover { color: #fff; }
.hero-breadcrumbs .sep { opacity: .6; }

.hero-content {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 32px 48px 36px;
    display: flex; align-items: flex-end; gap: 20px;
    z-index: 10;
}
.country-flag {
    font-size: 64px; line-height: 1; flex-shrink: 0;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
}
.country-flag img { width: 64px; height: 64px; border-radius: 4px; }
/* Twemoji flag — keep at 64px */
.cs-flag-emoji { font-size: 64px; display: inline-block; line-height: 1; }
.cs-flag-emoji img,
.cs-flag-emoji img.emoji {
    width: 64px !important; height: 64px !important;
    display: inline !important; max-width: none !important;
    vertical-align: middle;
}

.country-hero-info { flex: 1; }
.country-hero-info h1 {
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 800;
    color: #fff;
    letter-spacing: -1px;
    line-height: 1.1;
    text-shadow: 0 2px 12px rgba(0,0,0,.4);
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    margin: 0;
}
.hero-iso {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px; font-weight: 600;
    background: rgba(255,255,255,.2); color: #fff;
    padding: 3px 10px; border-radius: 6px;
    letter-spacing: 1px; border: 1px solid rgba(255,255,255,.3);
}
.alt-name { font-size: 14px; color: rgba(255,255,255,.7); margin-top: 4px; }
.hero-desc { font-size: 14px; color: rgba(255,255,255,.8); margin-top: 8px; max-width: 600px; line-height: 1.5; }

/* Gradient classes */
.gradient-sunset  { background: linear-gradient(135deg, #c0392b 0%, #e74c3c 30%, #f39c12 70%, #f1c40f 100%); }
.gradient-sunrise { background: linear-gradient(135deg, #ff6b35 0%, #f7931e 40%, #ffd700 100%); }
.gradient-summer  { background: linear-gradient(135deg, #0099cc 0%, #00bfff 40%, #20e8b4 100%); }
.gradient-tropical { background: linear-gradient(135deg, #00b09b 0%, #96c93d 100%); }

@keyframes drift {
    0%,100% { transform: scale(1.04) translate(0,0); }
    33%     { transform: scale(1.06) translate(-6px,-4px); }
    66%     { transform: scale(1.05) translate(4px,-6px); }
}

/* ── PAGE BODY ─────────────────────────────────────────────────────────────── */
.page-body {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 80px;
}
.page-body::after { content: ''; display: table; clear: both; }

/* ── INFO CARDS ────────────────────────────────────────────────────────────── */
.country-info-grid {
    display: flex; gap: 8px;
    padding: 20px 24px;
    margin: 0 -24px;
    overflow-x: auto; scrollbar-width: none;
    justify-content: flex-start;
}
.country-info-grid::-webkit-scrollbar { display: none; }

.ci-card {
    flex: 0 0 auto; min-width: 200px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    display: flex; flex-direction: column; gap: 4px;
    transition: border-color .15s, background .15s;
}
.ci-card:hover {
    border-color: var(--accent-blue);
    background: var(--accent-blue-muted);
}
.ci-icon  { font-size: 18px; margin-bottom: 2px; line-height: 1; }
/* Twemoji converts emoji to <img> — must constrain size explicitly */
.ci-icon img,
.ci-icon img.emoji {
    width: 18px !important; height: 18px !important;
    vertical-align: middle; display: inline !important;
    max-width: none !important;
}
/* SVG icons (continent globes) */
.ci-icon-globe svg { display: block; }
/* Phone emoji — tint to blue */
.ci-icon-phone img.emoji {
    filter: invert(45%) sepia(90%) saturate(500%) hue-rotate(185deg) brightness(1.05) !important;
}
.ci-label { font-size: 11px; color: var(--text-tertiary); font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
.ci-value { font-size: 14px; font-weight: 600; color: var(--text-primary); }

/* ── SECTION HEADER ────────────────────────────────────────────────────────── */
.section-sep { height: 1px; background: var(--border-subtle); margin: 8px 0; }

.section-hdr {
    display: flex; align-items: center; justify-content: space-between;
    padding: 36px 0 16px; gap: 12px; flex-wrap: wrap;
}
.section-hdr h2 {
    font-size: 20px; font-weight: 700; color: var(--text-primary);
    display: flex; align-items: center; gap: 8px; margin: 0;
}
/* Twemoji in section h2 */
.section-hdr h2 img,
.section-hdr h2 img.emoji {
    width: 20px !important; height: 20px !important;
    vertical-align: middle; display: inline !important;
    max-width: none !important;
}
.section-hdr-right { display: flex; align-items: center; gap: 14px; }

.section-count {
    font-size: 13px; font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: var(--accent-blue-muted);
    color: var(--accent-blue);
    padding: 2px 9px; border-radius: 20px;
    border: 1px solid var(--tint-blue-border, rgba(2,132,199,.25));
}
.section-link { font-size: 13px; color: var(--accent-blue); font-weight: 500; text-decoration: none; }
.section-link:hover { text-decoration: underline; }
.mch-meta { font-size: 11px; color: var(--text-tertiary); font-family: 'JetBrains Mono', monospace; }

/* ── COST OF LIVING ────────────────────────────────────────────────────────── */
/* Wrapper we add in template */
.col-card-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-top: 3px solid var(--accent-blue);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
/* Reset .container added by function */
.col-card-wrap .container { max-width: none; margin: 0; padding: 0; }
/* Main section */
.col-compact { display: block; }

/* Hide function's own h2 (we have section-hdr above) */
.col-compact .col-title { display: none !important; }
/* col-link = "1 USD = 0.86 EUR →" — currency converter link */
.col-compact .col-link {
    font-size: 12px;
    color: var(--accent-blue); text-decoration: none; white-space: nowrap;
}
.col-compact .col-link:hover { text-decoration: underline; }
/* Ссылка курса — подчёркнута по умолчанию (выше специфичность чем .col-compact .col-link) */
.col-compact .col-link.col-link-rate { text-decoration: underline; text-underline-offset: 2px; }
.col-compact .col-link.col-link-rate:hover { text-decoration: none; }
.col-rate-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.col-rate-row  { display: flex; justify-content: flex-end; padding: 0 20px 10px; }
.col-rate-date { font-size: 10px; color: var(--text-tertiary); white-space: nowrap; }
/* 1 USD = X EUR → — подчёркнута по умолчанию, убирается при hover */
.col-link-rate { text-decoration: underline; text-underline-offset: 2px; }
.col-link-rate:hover { text-decoration: none; }
/* "exchange rate" — только эти 2 слова ссылка с пунктиром, убирается при hover */
.col-rate-date-link {
    text-decoration: underline;
    text-decoration-style: dashed;
    text-underline-offset: 2px;
    color: var(--text-tertiary);
}
.col-rate-date-link:hover { text-decoration: none; color: var(--accent-blue); }

.col-footer-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 20px 14px;
    border-top: 1px solid var(--border-default);
}
.col-updated { font-size: 11px; color: var(--text-tertiary); }
.col-link-full {
    font-size: 12px; font-weight: 600;
    color: var(--accent-blue); text-decoration: none;
}
.col-link-full:hover { text-decoration: underline; }

.col-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 20px 8px; flex-wrap: wrap; gap: 8px;
}
.col-title-row  { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 6px; gap: 8px; flex-wrap: wrap; }
.col-title-left { display: flex; flex-direction: column; gap: 2px; }
.col-title-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.col-subtitle   { font-size: 12px; color: var(--text-secondary); }

.col-badge { font-size: 12px; font-weight: 700; padding: 3px 11px; border-radius: 20px; white-space: nowrap; }
.col-badge-budget         { background: rgba(34,197,94,.1);  color: #16a34a; border: 1px solid rgba(34,197,94,.2); }
.col-badge-moderate       { background: rgba(234,179,8,.1);  color: #d97706; border: 1px solid rgba(234,179,8,.2); }
.col-badge-expensive      { background: rgba(249,115,22,.1); color: #ea580c; border: 1px solid rgba(249,115,22,.2); }
.col-badge-very_expensive { background: rgba(239,68,68,.1);  color: #ef4444; border: 1px solid rgba(239,68,68,.2); }

.col-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 8px;
    padding: 8px 20px 16px;
}
/* col-item: 2-col grid — icon spans both rows, label row 1, price row 2 */
.col-item {
    display: grid;
    grid-template-columns: 24px 1fr;
    grid-template-rows: auto auto;
    gap: 0 10px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-default);
    background: var(--bg-elevated);
    transition: all .15s;
    align-items: center;
}
.col-item:hover { border-color: var(--accent-blue); background: var(--accent-blue-muted); }

.col-icon  { grid-column: 1; grid-row: 1 / 3; align-self: center; font-size: 18px; line-height: 1; }
/* Twemoji turns emoji into <img> */
.col-icon img,
.col-icon img.emoji {
    width: 18px !important; height: 18px !important;
    display: inline !important; max-width: none !important;
    vertical-align: middle;
}
.col-label { grid-column: 2; grid-row: 1; font-size: 11px; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-price { grid-column: 2; grid-row: 2; display: block; }
.col-usd   { display: block; font-size: 13px; font-weight: 700; color: var(--text-primary); line-height: 1.3; }
.col-local { display: block; font-size: 11px; color: var(--text-tertiary); font-family: 'JetBrains Mono', monospace; }
.col-na    { font-size: 13px; color: var(--text-tertiary); }

.col-footer { display: none; }
.col-source { display: none; }

/* ── MAP CARD (shared wrapper for Airports + Visa) ─────────────────────────── */
.map-card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* ── Annotation strip above the map (info note) ─────────────────────── */
.crm-annotation {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 14px;
    background: rgba(34, 197, 94, .08);
    border: 1px solid rgba(34, 197, 94, .22);
    border-left: 3px solid #22c55e;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.crm-annotation-icon {
    flex-shrink: 0;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(34, 197, 94, .2);
    color: #22c55e;
    font-family: Georgia, serif;
    font-style: italic;
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
    line-height: 1;
}
.crm-annotation-text {
    flex: 1;
}
@media (max-width: 480px) {
    .crm-annotation {
        font-size: 12px;
        padding: 10px 12px;
        gap: 10px;
    }
    .crm-annotation-icon {
        width: 18px; height: 18px;
        font-size: 12px;
    }
}

/* ── Footer links below the map (catalog navigation) ────────────────── */
.crm-footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.5;
}
.crm-footer-label {
    font-weight: 600;
    color: var(--text-secondary);
}
.crm-footer-link {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color .15s;
}
.crm-footer-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}
.crm-footer-sep {
    color: var(--text-tertiary);
    opacity: .6;
    user-select: none;
}
@media (max-width: 480px) {
    .crm-footer-links {
        font-size: 11px;
        padding: 8px 12px;
        gap: 6px;
    }
}

/* ════════════════════════════════════════════════════════════════════════
   AIRPORTS MAP — country page Routes block
   Markup from kt_render_airports_map() in functions.php
   Behavior from country-routes-map.js
   Mirrors the Routes mini-map UX from /airports/{slug}/ single page.
   ════════════════════════════════════════════════════════════════════════ */

/* Hide the h2 that the function outputs — we have our own section-hdr */
.map-card .airports-map-section > h2 { display: none !important; }
.map-card .airports-map-section { background: none; border: none; border-radius: 0; box-shadow: none; }

/* ── Wrapper: sidebar + map area (flex row) ─────────────────────────── */
.crm-wrapper {
    display: flex;
    height: 480px;
}

/* ── Sidebar: country airports list ─────────────────────────────────── */
.crm-sidebar {
    width: 240px; min-width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-default);
    display: flex; flex-direction: column;
    overflow: hidden;
}
#crm-sidebar-content { flex: 1; overflow-y: auto; overflow-x: hidden; }
#crm-sidebar-content::-webkit-scrollbar { width: 3px; }
#crm-sidebar-content::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

/* Empty-state fallback (no IATA airports in country) */
.crm-sb-empty {
    padding: 24px 16px;
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* List + items */
.crm-sb-list { display: flex; flex-direction: column; }
.crm-sb-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11px;
    transition: background .12s;
}
.crm-sb-item.crm-sb-clickable { cursor: pointer; }
.crm-sb-item:hover { background: var(--bg-hover); }
.crm-sb-item.highlighted {
    background: var(--accent-blue-muted);
    border-left: 2px solid var(--accent-blue);
    padding-left: 12px;
}

.crm-sb-dot   { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.crm-sb-iata  { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; color: var(--text-tertiary); width: 32px; flex-shrink: 0; }
.crm-sb-name  { flex: 1; color: var(--text-secondary); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crm-sb-routes { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; color: var(--text-primary); flex-shrink: 0; }

/* ── Map area + wrapper for floating controls/overlay ───────────────── */
.crm-map-area    { flex: 1; position: relative; overflow: hidden; }
.crm-map-wrapper { position: relative; height: 100%; width: 100%; }
#country-routes-map.crm-container { width: 100%; height: 100%; }

/* Floating fullscreen toggle (top-right) */
.crm-map-fullscreen-btn {
    position: absolute; top: 10px; right: 10px; z-index: 1000;
    width: 30px; height: 30px;
    background: var(--bg-card); border: 1px solid var(--border-default);
    border-radius: 6px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    box-shadow: var(--shadow-sm);
    transition: color .15s, background .15s;
}
.crm-map-fullscreen-btn:hover { color: var(--accent-blue); background: var(--bg-hover); }
.crm-map-fullscreen-btn svg { width: 16px; height: 16px; }

/* Floating zoom +/− stack (bottom-right) */
.crm-map-zoom {
    position: absolute; bottom: 10px; right: 10px; z-index: 1000;
    display: flex; flex-direction: column; gap: 0;
    box-shadow: var(--shadow-sm);
}
.crm-map-zoom button {
    width: 30px; height: 30px;
    border: 1px solid var(--border-default);
    background: var(--bg-card); color: var(--text-primary);
    font-size: 16px; font-weight: 600; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s, color .15s;
}
.crm-map-zoom button:first-child { border-radius: 6px 6px 0 0; }
.crm-map-zoom button:last-child  { border-radius: 0 0 6px 6px; border-top: none; }
.crm-map-zoom button:hover { background: var(--bg-hover); color: var(--accent-blue); }

/* ── Centered overlay popup (small map mode only) ───────────────────── */
.crm-map-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0,0,0,.18);
    width: 280px; max-width: calc(100% - 40px);
    flex-direction: column;
    animation: crmOverlayIn .15s ease;
}
@keyframes crmOverlayIn {
    from { opacity: 0; transform: translate(-50%, -48%); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}
.crm-map-overlay-close {
    position: absolute; top: 8px; right: 10px;
    background: none; border: none;
    font-size: 18px; line-height: 1;
    color: var(--text-tertiary); cursor: pointer;
    padding: 0; z-index: 1;
}
.crm-map-overlay-close:hover { color: var(--text-primary); }
.crm-map-overlay-content { padding: 4px 0 0; }

/* Hide overlay in fullscreen — native Leaflet popup is used there */
.crm-fullscreen .crm-map-overlay { display: none !important; }

/* ── Fullscreen mode ────────────────────────────────────────────────── */
.crm-map-area.crm-fullscreen {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 10000;
    background: var(--bg-card);
}
.crm-fs-backdrop {
    position: fixed; inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,.5);
}

/* ── Origin pulsing marker (red dot + 2 expanding rings) ────────────── */
/* Marker is now interactive (clickable). Pulse rings must NOT block clicks
   on the dot — they cover up to 50×50px at peak — so pointer-events on rings
   is disabled and the dot itself is enlarged for a comfortable click target. */
.crm-origin-icon {
    position: relative;
    cursor: pointer;
}
.crm-origin-dot {
    width: 12px; height: 12px; border-radius: 50%;
    background: #d4546a; border: 2px solid #fff;
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 6px rgba(212,84,106,.5);
    z-index: 2;
    pointer-events: auto;
    transition: transform .12s;
}
.crm-origin-icon:hover .crm-origin-dot {
    transform: translate(-50%, -50%) scale(1.25);
}
.crm-pulse-ring {
    position: absolute; top: 50%; left: 50%;
    width: 14px; height: 14px; border-radius: 50%;
    border: 1.5px solid #d4546a;
    transform: translate(-50%, -50%);
    animation: crmPulse 3s ease-out infinite;
    z-index: 1;
    pointer-events: none; /* never block clicks on the dot */
}
.crm-pulse-2 { animation-delay: 1.5s; }
@keyframes crmPulse {
    0%   { width: 14px; height: 14px; opacity: .6; }
    100% { width: 50px; height: 50px; opacity: 0; }
}

/* ── Animated airplane along locked route ───────────────────────────── */
.crm-plane-icon {
    font-size: 16px; line-height: 20px;
    text-align: center; color: #ffffff;
    filter: drop-shadow(0 0 2px rgba(0,0,0,1)) drop-shadow(0 1px 4px rgba(0,0,0,.9));
    transform-origin: center center;
    display: block;
}

/* ── Destination popup (used in centered overlay AND native Leaflet popup) ─ */
.crm-popup { padding: 12px 14px; }
.crm-popup-header { font-size: 14px; line-height: 1.3; }
.crm-popup-iata {
    font-family: 'JetBrains Mono', monospace; font-weight: 600;
    color: var(--accent-blue); letter-spacing: 1px; margin-right: 4px;
}
.crm-popup-name { font-weight: 500; color: var(--text-primary); }
.crm-popup-city { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.crm-popup-stats {
    display: flex; gap: 16px; margin-top: 8px;
    padding-top: 8px; border-top: 1px solid var(--border-subtle);
}
.crm-popup-label {
    font-size: 9px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .8px; color: var(--text-tertiary);
}
.crm-popup-value { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.crm-popup-carriers {
    display: flex; flex-wrap: wrap; gap: 4px;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}
.crm-popup-links {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-top: 8px; padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}
.crm-popup-links a {
    font-size: 11px; font-weight: 500;
    color: var(--accent-blue); text-decoration: none;
}
.crm-popup-links a:hover { text-decoration: underline; }

/* Origin-popup-only: continents breakdown row */
.crm-popup-continents {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
    font-size: 11px;
}
.crm-popup-continent {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    color: var(--text-secondary);
}
.crm-popup-continent strong {
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}
.crm-popup-continent-name {
    text-transform: capitalize;
    color: var(--text-tertiary);
    font-size: 10px;
    letter-spacing: .3px;
}

.crm-carrier-chip {
    display: inline-block; padding: 2px 6px; border-radius: 4px;
    font-size: 10px; font-weight: 500;
    background: var(--accent-blue-muted); color: var(--accent-blue);
}

/* Native Leaflet popup styling (only used in fullscreen mode) */
.crm-mini-popup .leaflet-popup-content-wrapper {
    border-radius: 10px; padding: 0;
    background: var(--bg-card); color: var(--text-primary);
    border: 1px solid var(--border-default);
    box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.crm-mini-popup .leaflet-popup-content { margin: 0; }
.crm-mini-popup .leaflet-popup-tip { background: var(--bg-card); border: 1px solid var(--border-default); }

/* ── Leaflet tile + attribution fixes ───────────────────────────────── */
.crm-container img,
.leaflet-tile { max-width: none !important; outline: 1px solid transparent; }

.leaflet-control-attribution {
    background: transparent !important; color: rgba(255,255,255,.15) !important;
    font-size: 9px !important; line-height: 1 !important; padding: 1px 4px !important;
}
.leaflet-control-attribution a { color: rgba(255,255,255,.2) !important; text-decoration: none !important; }
.leaflet-control-attribution a[href*="leafletjs.com"] { display: none !important; }
[data-theme="light"] .leaflet-control-attribution { color: rgba(0,0,0,.12) !important; }
[data-theme="light"] .leaflet-control-attribution a { color: rgba(0,0,0,.15) !important; }

/* ── VISA MAP (vdm-* classes from visa-dest-map.js) ────────────────────────── */
/* Destination-country marker: ring + flag overlay, visually distinct from
   passport markers. Rendered by visa-dest-map.js initMap(). */
.vdm-dest-marker-icon {
    position: relative;
    pointer-events: none; /* rings & flag don't block; host Leaflet element handles hover */
}
.vdm-dest-ring {
    position: absolute;
    top: 50%; left: 50%;
    width: 30px; height: 30px;
    margin: -15px 0 0 -15px;
    border: 2px dashed rgba(100, 116, 139, .65);
    border-radius: 50%;
    background: rgba(148, 163, 184, .12);
    box-shadow: 0 0 0 2px rgba(255,255,255,.7);
    pointer-events: auto;
}
.vdm-dest-flag {
    position: absolute;
    top: 50%; left: 50%;
    width: 20px; height: 20px;
    margin: -10px 0 0 -10px;
    line-height: 20px;
    font-size: 16px;
    text-align: center;
    pointer-events: none;
}
.vdm-dest-flag img,
.vdm-dest-flag img.emoji {
    width: 20px !important;
    height: 20px !important;
    max-width: none !important;
    display: block !important;
    margin: 0 !important;
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}

/* Tooltip attached to the destination marker */
.vdm-dest-tooltip {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-default) !important;
    color: var(--text-primary) !important;
    font-size: 11px !important;
    padding: 4px 8px !important;
    box-shadow: var(--shadow-sm) !important;
}
.vdm-dest-tooltip::before {
    border-top-color: var(--border-default) !important;
}

.visa-map-card .visa-requirements-section > h2 { display: none !important; }
.vdm-section {
    display: flex; height: 340px;
    overflow: hidden;
}
.vdm-sidebar {
    width: 230px; min-width: 230px;
    border-right: 1px solid var(--border-default);
    display: flex; flex-direction: column;
    background: var(--bg-card);
    overflow: hidden;
}
.vdm-filters {
    display: flex; flex-wrap: wrap; gap: 5px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-elevated);
    flex-shrink: 0;
}
.vdm-filter-btn {
    padding: 3px 9px; border-radius: 20px;
    font-size: 10px; font-weight: 700;
    border: 1.5px solid var(--c, #22c55e);
    color: var(--c, #22c55e);
    background: transparent;
    cursor: pointer; transition: all .15s;
    white-space: nowrap;
}
.vdm-filter-btn:hover,
.vdm-filter-btn.active {
    background: var(--c, #22c55e);
    color: #fff;
}
.vdm-list {
    flex: 1; overflow-y: auto; overflow-x: hidden;
}
.vdm-list::-webkit-scrollbar { width: 3px; }
.vdm-list::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }
.vdm-item {
    display: flex; align-items: center; gap: 5px;
    padding: 5px 10px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer; transition: background .1s;
}
.vdm-item:hover { background: var(--bg-elevated); }
.vdm-iso {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px; color: var(--text-tertiary);
    width: 22px; flex-shrink: 0;
}
.vdm-flag { font-size: 13px; flex-shrink: 0; line-height: 1; }
.vdm-flag img.emoji { width: 16px !important; height: 12px !important; }
.vdm-name { flex: 1; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vdm-dot {
    width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
    cursor: default;
}
.vdm-map-area { flex: 1; position: relative; }
.vdm-container { width: 100%; height: 100%; }
.vdm-error { padding: 16px; font-size: 12px; color: var(--text-tertiary); }

/* ── VISA MODAL ─────────────────────────────────────────────────────────────── */
.vdm-modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 9999;
    align-items: center; justify-content: center;
    padding: 20px;
}
.vdm-modal-overlay.active { display: flex; }
.vdm-modal-box {
    background: var(--bg-card); border: 1px solid var(--border-default);
    border-radius: 16px; width: 100%; max-width: 420px;
    max-height: 90vh; overflow-y: auto;
    position: relative; padding: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.vdm-modal-close {
    position: absolute; top: 14px; right: 16px;
    background: none; border: none; cursor: pointer;
    font-size: 20px; color: var(--text-tertiary);
    line-height: 1; padding: 4px 8px; border-radius: 6px;
    transition: background .12s;
}
.vdm-modal-close:hover { background: var(--bg-elevated); }
.vdm-modal-loading { padding: 32px; text-align: center; color: var(--text-tertiary); font-size: 13px; }
.vdm-modal-err { color: var(--text-tertiary); font-size: 13px; }

/* Modal content */
.vdm-mc-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 14px; font-size: 13px; flex-wrap: wrap;
}
.vdm-mc-passport { font-weight: 700; display: flex; align-items: center; gap: 5px; }
.vdm-mc-passport img.emoji { width: 18px !important; height: 14px !important; }
.vdm-mc-arrow { color: var(--text-tertiary); }
.vdm-mc-dest { color: var(--text-secondary); }
.vdm-mc-status {
    display: inline-block; padding: 5px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 700; color: #fff;
    margin-bottom: 10px;
}
.vdm-mc-rulename {
    font-size: 14px; font-weight: 600; color: var(--text-primary);
    margin-bottom: 16px;
}
.vdm-mc-rulename a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.vdm-mc-grid { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.vdm-mc-row {
    display: grid; grid-template-columns: 22px 120px 1fr;
    align-items: start; gap: 6px; font-size: 12px;
}
.vdm-mc-icon { font-size: 14px; }
.vdm-mc-label { color: var(--text-tertiary); }
.vdm-mc-val { color: var(--text-primary); font-weight: 500; }
.vdm-mc-val a { color: var(--accent-blue); text-decoration: none; }
.vdm-mc-val a:hover { text-decoration: underline; }
.vdm-mc-affiliate {
    display: block; text-align: center;
    padding: 10px; border-radius: 10px;
    background: var(--accent-blue); color: #fff;
    font-size: 13px; font-weight: 700;
    text-decoration: none; margin-bottom: 10px;
    transition: opacity .15s;
}
.vdm-mc-affiliate:hover { opacity: .88; }
.vdm-mc-checklink {
    display: block; text-align: center;
    font-size: 12px; color: var(--accent-blue);
    text-decoration: none; padding: 6px;
}
.vdm-mc-checklink:hover { text-decoration: underline; }

/* Block any WP link-preview / autoembed plugins from injecting cards inside modal */
.vdm-modal-box .wp-block-embed,
.vdm-modal-box .link-preview,
.vdm-modal-box iframe,
.vdm-modal-box img:not(.emoji) { display: none !important; }
/* Keep twemoji flag images */
.vdm-modal-box img.emoji {
    display: inline !important;
    width: 18px !important; height: 14px !important;
    vertical-align: middle; max-width: none !important;
}
    background: none; border: none; border-radius: 0; box-shadow: none;
    padding: 0; margin: 0;
}

/* ── ABOUT / CONTENT TABS ──────────────────────────────────────────────────── */
.country-content {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-top: 3px solid var(--accent-teal);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
/* ── ABOUT / KT TABS (HTML from WYSIWYG editor) ─────────────────────────────── */
/* Tab strip — .kt-tabs wraps all .kt-tab-btn buttons */
.kt-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-default);
    padding: 0 20px;
    overflow-x: auto; scrollbar-width: none;
}
.kt-tabs::-webkit-scrollbar { display: none; }
.kt-tab-btn {
    padding: 14px 16px;
    font-size: 13px; font-weight: 600; color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    white-space: nowrap; cursor: pointer; transition: all .15s;
    background: none; border-top: none; border-left: none; border-right: none;
    font-family: inherit;
    user-select: none;
}
.kt-tab-btn.active { color: var(--accent-blue); border-bottom-color: var(--accent-blue); }
.kt-tab-btn:hover  { color: var(--text-primary); }

/* Tab content panels */
.kt-tab { padding: 24px; }
.kt-tab p  { font-size: 15px; color: var(--text-secondary); line-height: 1.75; margin-bottom: 16px; }
.kt-tab h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 28px 0 12px; }
.kt-tab h3 { font-size: 17px; font-weight: 700; color: var(--text-primary); margin: 24px 0 10px; }
.kt-tab h4 { font-size: 15px; font-weight: 700; color: var(--text-primary); margin: 20px 0 8px; }
.kt-tab ul, .kt-tab ol { padding-left: 20px; color: var(--text-secondary); font-size: 15px; line-height: 1.75; margin-bottom: 16px; }
.kt-tab a  { color: var(--accent-blue); text-decoration: none; }
.kt-tab a:hover { text-decoration: underline; }

.kt-info-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-default);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    transition: border-color .15s;
}
.kt-info-card:last-child { margin-bottom: 0; }
.kt-info-card:hover { border-color: var(--border-hover, var(--accent-blue)); }
.kt-ic-icon {
    font-size: 26px;
    line-height: 1;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 5px;
}
.kt-ic-icon img.emoji {
    width: 26px !important; height: 26px !important;
    max-width: none !important; display: block !important;
    margin: 0 !important;
}
.kt-ic-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.kt-ic-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.65;
}

/* ── TAGS (General tab) ────────────────────────────────────────────────────── */
.kt-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 20px;
}
.kt-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}
.kt-tag img.emoji {
    width: 14px !important; height: 14px !important;
    max-width: none !important; display: inline !important;
    vertical-align: middle; margin: 0 !important;
}
.kt-tag-blue   { background: rgba(59,130,246,.15); color: #60a5fa; border-color: rgba(59,130,246,.3); }
.kt-tag-green  { background: rgba(34,197,94,.15);  color: #4ade80; border-color: rgba(34,197,94,.3); }
.kt-tag-orange { background: rgba(251,146,60,.15); color: #fb923c; border-color: rgba(251,146,60,.3); }
.kt-tag-red    { background: rgba(239,68,68,.15);  color: #f87171; border-color: rgba(239,68,68,.3); }
.kt-tag-purple { background: rgba(168,85,247,.15); color: #c084fc; border-color: rgba(168,85,247,.3); }

/* ── TWO-COLUMN GRID: Cost of Living + About ────────────────────────────────── */
.cs-twin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 24px;
    align-items: start;
}
.cs-twin-col { min-width: 0; }

/* Одна колонка — CoL на всю ширину (нет About) */
.cs-twin-grid--full { grid-template-columns: 1fr; }
.cs-twin-grid--full .cs-twin-col .col-card-wrap { height: auto; }
.cs-twin-grid--full .cs-twin-col .col-card-wrap .col-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

/* Фиксированная высота блока CoL — карточки заполняют всё пространство */
.cs-twin-col .col-card-wrap {
    height: 520px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.cs-twin-col .col-card-wrap .col-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.cs-twin-col .col-card-wrap .col-grid {
    flex: 1;
    align-content: stretch;  /* карточки растягиваются равномерно */
    padding-bottom: 12px;
}
.cs-twin-col .col-card-wrap .col-item {
    height: 100%;  /* каждая карточка на всю высоту строки */
}

/* Фиксированная высота About Spain */
.cs-twin-col .kt-content {
    height: 520px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-top: 3px solid var(--accent-teal);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}
/* Табы — прибиты к верху */
.cs-twin-col .kt-content .kt-tabs { flex-shrink: 0; }
/* Панели вкладок — занимают остаток и скроллятся */
.cs-twin-col .kt-content .kt-tab {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-default) transparent;
}
.cs-twin-col .kt-content .kt-tab::-webkit-scrollbar { width: 4px; }
.cs-twin-col .kt-content .kt-tab::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

/* ── RESPONSIVE ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .country-hero { height: 420px; }
    .hero-content { padding: 20px 20px 24px; gap: 12px; }
    .country-flag, .cs-flag-emoji { font-size: 44px; }
    .page-body { padding: 0 16px 60px; }
    .col-grid { grid-template-columns: repeat(2, 1fr); padding: 12px 14px; }
    /* Fixed total height = sidebar (200) + map (220). Avoids `flex: 1` collapsing
       to 0 inside an auto-sized column flex parent (matches the visa map pattern). */
    .crm-wrapper { height: 420px; flex-direction: column; }
    .crm-sidebar { width: 100%; min-width: 0; height: 200px; border-right: none; border-bottom: 1px solid var(--border-default); }
    .crm-map-area { height: 220px; }
    .section-hdr { flex-direction: column; align-items: flex-start; gap: 8px; padding: 20px 0 12px; }
    .section-hdr h2 { font-size: 17px; }
    .cs-twin-grid { grid-template-columns: 1fr; }
    .cs-twin-col .col-card-wrap { height: auto; flex-direction: column; }
    .cs-twin-col .col-card-wrap .col-item { height: auto; }
    .cs-twin-col .kt-content { height: auto; }
    .cs-twin-col .kt-content .kt-tab { overflow-y: visible; }
}
@media (max-width: 480px) {
    /* Sidebar hidden → wrapper shrinks to just the map height */
    .crm-wrapper { height: 220px; }
    .crm-sidebar { display: none; }
    .vdm-sidebar  { display: none; }
    .country-info-grid { gap: 6px; }
    .ci-card { min-width: 110px; padding: 12px; }
}