/* SP Country Risk — Public CSS v1.0.0 */
:root {
    --cr-navy:      #1a1f5e;
    --cr-cobalt:    #3d4aaa;
    --cr-lavender:  #9ca8e8;
    --cr-sage:      #2d7a4f;
    --cr-gold:      #c8960c;
    --cr-crimson:   #c0394f;
    --cr-sand:      #d8c9b0;
    --cr-border:    #e2e8f0;
    --cr-bg:        #f8fafc;
    --cr-r:         12px;
    --cr-font:      -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ── Formulaire de recherche ─────────────────────────────── */
.sp-cr-search-form {
    background: linear-gradient(135deg, #1a1f5e 0%, #3d4aaa 100%);
    border-radius: 14px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
    color: #fff;
}
.sp-cr-search-inner { max-width: 720px; margin: 0 auto; }
.sp-cr-search-icon  { font-size: 22px; margin-right: 8px; display: inline; vertical-align: middle; }
.sp-cr-search-title {
    font-size: 17px; font-weight: 700; margin: 0 0 .25rem; color: #fff;
    display: inline; vertical-align: middle;
}
.sp-cr-search-sub   { font-size: 12px; color: #9ca8e8; margin: .25rem 0 1rem; display: block; }

/* Ligne unique : select + bouton parfaitement alignés */
.sp-cr-search-fields {
    display: flex; gap: 10px; align-items: stretch; flex-wrap: nowrap;
}
.sp-cr-field-group   { flex: 1; text-align: left; }
.sp-cr-field-group label { display: none; } /* Masqué — placeholder suffit */

.sp-cr-select {
    width: 100%; height: 42px; padding: 0 12px; border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,.25);
    background: rgba(255,255,255,.13); color: #fff;
    font-size: 14px; font-family: var(--cr-font);
    cursor: pointer; outline: none; box-sizing: border-box;
}
.sp-cr-select:focus { border-color: rgba(255,255,255,.6); }
.sp-cr-select option { color: #1a1f5e; background: #fff; }

/* ── Boutons ─────────────────────────────────────────────── */
.sp-cr-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 0 20px; height: 42px; border-radius: 8px; font-size: 14px;
    font-weight: 700; cursor: pointer; border: 2px solid transparent;
    text-decoration: none; font-family: var(--cr-font); transition: all .15s;
    white-space: nowrap; box-sizing: border-box; line-height: 1;
}
.sp-cr-btn--primary {
    background: #fff; color: var(--cr-cobalt); border-color: #fff;
}
.sp-cr-btn--primary:hover { background: #eef0fc; color: var(--cr-navy); }
.sp-cr-btn--outline {
    background: transparent; color: #fff; border-color: rgba(255,255,255,.4);
}
.sp-cr-btn--outline:hover { border-color: #fff; background: rgba(255,255,255,.1); }
.sp-cr-btn--dark {
    background: var(--cr-cobalt); color: #fff; border-color: var(--cr-cobalt);
}
.sp-cr-btn--dark:hover { background: var(--cr-navy); }

/* ── Card commune ────────────────────────────────────────── */
.sp-cr-card {
    background: #fff; border: 1.5px solid var(--cr-border);
    border-radius: var(--cr-r); overflow: hidden;
    font-family: var(--cr-font); margin-bottom: 1.5rem;
    box-shadow: 0 4px 16px rgba(26,31,94,.06);
}

.sp-cr-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--cr-border);
    background: linear-gradient(135deg, #f8f9ff 0%, #eef0fc 100%);
}
.sp-cr-card-header--full { background: linear-gradient(135deg, #1a1f5e 0%, #3d4aaa 100%); }
.sp-cr-card-header--full .sp-cr-country-name { color: #fff; }
.sp-cr-card-header--full .sp-cr-country-code  { color: #9ca8e8; }

.sp-cr-flag-name { display: flex; flex-direction: column; gap: 2px; }
.sp-cr-country-name { font-size: 18px; font-weight: 800; color: var(--cr-navy); }
.sp-cr-country-code { font-size: 12px; color: #64748b; font-weight: 600; letter-spacing: .5px; }

.sp-cr-premium-badge {
    background: rgba(255,255,255,.2); color: #fff;
    font-size: 11px; font-weight: 700; padding: 4px 12px;
    border-radius: 20px; border: 1px solid rgba(255,255,255,.3);
}

.sp-cr-badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 700; padding: 5px 12px;
    border-radius: 20px; white-space: nowrap;
}
.sp-cr-badge-icon { font-size: 14px; }

/* ── Score ring ──────────────────────────────────────────── */
.sp-cr-score-ring-wrap {
    display: flex; flex-direction: column; align-items: center;
    padding: 1.5rem;
}
.sp-cr-score-section {
    display: grid; grid-template-columns: 160px 1fr; gap: 1.5rem;
    align-items: start; padding: 1.5rem;
}
@media (max-width: 600px) { .sp-cr-score-section { grid-template-columns: 1fr; } }

.sp-cr-score-ring {
    position: relative; width: 120px; height: 120px;
    display: flex; align-items: center; justify-content: center;
}
.sp-cr-ring-svg { position: absolute; width: 100%; height: 100%; }
.sp-cr-ring-bg   { fill: none; stroke: #e2e8f0; stroke-width: 10; }
.sp-cr-ring-fill { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.sp-cr-ring-text {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center;
}
.sp-cr-ring-score { font-size: 26px; font-weight: 800; line-height: 1; }
.sp-cr-ring-max   { font-size: 12px; color: #94a3b8; }
.sp-cr-score-desc { font-size: 13px; color: #64748b; text-align: center; margin-top: 8px; }

/* ── Recommandation ──────────────────────────────────────── */
.sp-cr-reco-panel {
    border-radius: 10px; border: 1.5px solid; padding: 1rem;
    display: flex; flex-direction: column; gap: 10px;
}
.sp-cr-reco-header { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 800; }
.sp-cr-reco-icon   { font-size: 20px; }
.sp-cr-reco-desc   { font-size: 13px; color: #374151; margin: 0; line-height: 1.5; }
.sp-cr-reco-actions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.sp-cr-reco-actions li { font-size: 12px; color: #374151; line-height: 1.4; }

/* ── Sections ────────────────────────────────────────────── */
.sp-cr-section { padding: 1.25rem 1.5rem; border-top: 1px solid var(--cr-border); }
.sp-cr-section-title { font-size: 14px; font-weight: 700; color: var(--cr-navy); margin: 0 0 1rem; }

/* ── Axes — mode full ─────────────────────────────────────── */
.sp-cr-axes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .sp-cr-axes-grid { grid-template-columns: 1fr; } }

.sp-cr-axe-card {
    background: var(--cr-bg); border: 1px solid var(--cr-border);
    border-radius: 10px; padding: 12px;
}
.sp-cr-axe-card-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.sp-cr-axe-icon  { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.sp-cr-axe-name  { font-size: 13px; font-weight: 700; color: var(--cr-navy); }
.sp-cr-axe-weight{ font-size: 11px; color: #94a3b8; }
.sp-cr-axe-score { margin-left: auto; font-size: 20px; font-weight: 800; flex-shrink: 0; }
.sp-cr-axe-bar   { height: 8px; background: var(--cr-border); border-radius: 99px; overflow: hidden; margin-bottom: 8px; }
.sp-cr-axe-bar-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }
.sp-cr-axe-meta  { display: flex; justify-content: space-between; font-size: 11px; }
.sp-cr-axe-level { font-weight: 700; }
.sp-cr-axe-source{ color: #94a3b8; text-align: right; }

/* ── Axes — mode free (floutés) ──────────────────────────── */
.sp-cr-axes-preview { padding: 1rem 1.5rem; }
.sp-cr-axe-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 0; border-bottom: 1px solid #f1f5f9;
}
.sp-cr-axe-row:last-child { border-bottom: none; }
.sp-cr-axe-row .sp-cr-axe-label { min-width: 160px; font-size: 13px; color: #374151; font-weight: 600; }
.sp-cr-axe-bar-wrap { flex: 1; display: flex; align-items: center; gap: 8px; }
.sp-cr-axe-note { font-size: 13px; font-weight: 700; min-width: 30px; text-align: right; }
.sp-cr-lock-icon { font-size: 14px; }
.sp-cr-axe-row--locked .sp-cr-axe-bar-wrap { position: relative; }
.sp-cr-blurred { filter: blur(4px); user-select: none; pointer-events: none; }

/* ── CTA Upgrade ─────────────────────────────────────────── */
.sp-cr-upgrade-cta {
    margin: 0; padding: 1.75rem 1.5rem;
    background: linear-gradient(135deg, #eef0fc 0%, #e8f5ee 100%);
    border-top: 1px solid var(--cr-border);
    text-align: center;
}
.sp-cr-upgrade-icon  { font-size: 32px; margin-bottom: .5rem; }
.sp-cr-upgrade-title { font-size: 16px; font-weight: 800; color: var(--cr-navy); margin: 0 0 .4rem; }
.sp-cr-upgrade-desc  { font-size: 13px; color: #64748b; margin: 0 0 1.25rem; }
.sp-cr-upgrade-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.sp-cr-upgrade-actions .sp-cr-btn--primary  { background: var(--cr-cobalt); color: #fff; border-color: var(--cr-cobalt); }
.sp-cr-upgrade-actions .sp-cr-btn--primary:hover { background: var(--cr-navy); }
.sp-cr-upgrade-actions .sp-cr-btn--outline  { border-color: var(--cr-cobalt); color: var(--cr-cobalt); background: transparent; }

/* ── Données sources ─────────────────────────────────────── */
.sp-cr-sources-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .sp-cr-sources-grid { grid-template-columns: 1fr; } }

.sp-cr-source-block { background: var(--cr-bg); border-radius: 10px; padding: 14px; border: 1px solid var(--cr-border); }
.sp-cr-source-title { font-size: 13px; font-weight: 700; color: var(--cr-navy); margin-bottom: 10px; }

.sp-cr-data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sp-cr-data-table th { background: #eef0fc; color: var(--cr-cobalt); font-weight: 700; padding: 6px 8px; text-align: left; }
.sp-cr-data-table td { padding: 5px 8px; border-bottom: 1px solid #f1f5f9; color: #374151; }
.sp-cr-data-table tr:last-child td { border-bottom: none; }

.sp-cr-coface-block { display: flex; align-items: center; gap: 1rem; margin-bottom: 12px; }
.sp-cr-coface-note  { font-size: 42px; font-weight: 900; line-height: 1; }
.sp-cr-coface-meta  { font-size: 12px; color: #374151; line-height: 1.7; }
.sp-cr-coface-scale { display: flex; gap: 4px; flex-wrap: wrap; }
.sp-cr-coface-chip  {
    font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px;
    border: 1.5px solid transparent; cursor: default;
}
.sp-cr-coface-chip.active { font-size: 13px; }

/* ── Formulaire axes manuels ─────────────────────────────── */
.sp-cr-manual-form { display: flex; flex-direction: column; gap: 14px; }
.sp-cr-manual-field { display: flex; align-items: center; gap: 12px; }
.sp-cr-manual-field label { min-width: 220px; font-size: 13px; font-weight: 600; color: #374151; }
.sp-cr-range { flex: 1; height: 4px; cursor: pointer; accent-color: var(--cr-cobalt); }
.sp-cr-range-val { min-width: 30px; font-size: 14px; font-weight: 700; color: var(--cr-cobalt); }

/* ── Notes ───────────────────────────────────────────────── */
.sp-cr-notes-box { background: #fdf6dc; border: 1px solid #f5d060; border-radius: 8px; padding: 12px; font-size: 13px; line-height: 1.6; color: #374151; }

/* ── Pied de carte ───────────────────────────────────────── */
.sp-cr-card-footer {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
    padding: .75rem 1.5rem;
    background: var(--cr-bg); border-top: 1px solid var(--cr-border);
    font-size: 11px; color: #94a3b8;
}

/* ── Alertes ─────────────────────────────────────────────── */
.sp-cr-alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; }
.sp-cr-alert--error { background: #f9edf0; color: #c0394f; border: 1px solid #ebb0bc; }

/* ── Loader AJAX ─────────────────────────────────────────── */
.sp-cr-loader {
    display: inline-block; width: 20px; height: 20px;
    border: 3px solid #eef0fc; border-top-color: var(--cr-cobalt);
    border-radius: 50%; animation: sp-cr-spin .7s linear infinite;
    vertical-align: middle; margin-right: 6px;
}
@keyframes sp-cr-spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
    .sp-cr-search-form { padding: 1rem 1.25rem; }
    .sp-cr-search-fields { flex-wrap: wrap; }
    .sp-cr-search-fields .sp-cr-btn { width: 100%; }
    .sp-cr-hero { flex-direction: column; align-items: flex-start; padding: 1rem 1.25rem; }
    .sp-cr-hero-kpi + .sp-cr-hero-kpi { border-left: none; padding-left: 0; }
    .sp-cr-hero-kpis { gap: 1rem; }
    .sp-cr-upgrade-actions { flex-direction: column; }
    .sp-cr-manual-field { flex-wrap: wrap; }
    .sp-cr-manual-field label { min-width: auto; }
    .sp-cr-card-footer { flex-direction: column; }
    .sp-cr-search-box-wrap { flex-wrap: wrap; }
    .sp-cr-search-box-wrap .sp-cr-btn { width: 100%; }
}

/* ── Page Country Map ────────────────────────────────────── */
.sp-cr-map-wrap { font-family: var(--cr-font); }

/* Hero */
.sp-cr-hero {
    background: linear-gradient(135deg, #1a1f5e 0%, #3d4aaa 100%);
    border-radius: 14px; padding: 1.25rem 2rem;
    color: #fff; margin-bottom: 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 1rem;
}
/* Côté gauche : titre + sous-titre */
.sp-cr-hero-left { display: flex; flex-direction: column; gap: 3px; }
.sp-cr-hero-title { font-size: 18px; font-weight: 800; margin: 0; color: #fff; }
.sp-cr-hero-sub   { font-size: 12px; color: #9ca8e8; margin: 0; }
/* Côté droit : KPIs en ligne */
.sp-cr-hero-kpis  {
    display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center;
}
.sp-cr-hero-kpi   {
    display: flex; flex-direction: column; align-items: center;
    gap: 2px; min-width: 48px;
}
.sp-cr-hero-kpi-val { font-size: 22px; font-weight: 900; color: #fff; line-height: 1; }
.sp-cr-hero-kpi-lab { font-size: 11px; color: #9ca8e8; font-weight: 600; white-space: nowrap; }
.sp-cr-hero-kpi--go   .sp-cr-hero-kpi-val { color: #7ec89a; }
.sp-cr-hero-kpi--cond .sp-cr-hero-kpi-val { color: #f5d060; }
.sp-cr-hero-kpi--nogo .sp-cr-hero-kpi-val { color: #ebb0bc; }
/* Séparateur entre KPIs */
.sp-cr-hero-kpi + .sp-cr-hero-kpi {
    border-left: 1px solid rgba(255,255,255,.15); padding-left: 1.5rem;
}

/* Search bar */
.sp-cr-search-bar { margin-bottom: 1.5rem; }
.sp-cr-search-box-wrap {
    display: flex; gap: 10px; align-items: stretch; flex-wrap: nowrap;
}
.sp-cr-search-ico { font-size: 18px; line-height: 42px; flex-shrink: 0; }
.sp-cr-map-select {
    flex: 1; min-width: 220px; height: 42px; padding: 0 12px;
    border: 1.5px solid var(--cr-border); border-radius: 8px;
    font-size: 14px; font-family: var(--cr-font); background: #fff;
    outline: none; cursor: pointer; color: #374151; box-sizing: border-box;
}
.sp-cr-map-select:focus { border-color: var(--cr-cobalt); }

/* Filtres */
.sp-cr-map-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 1.25rem; }
.sp-cr-filter-tab {
    padding: 7px 16px; border-radius: 20px; font-size: 13px; font-weight: 700;
    cursor: pointer; border: 1.5px solid var(--cr-border);
    background: #f8fafc; color: #64748b; transition: all .15s;
    font-family: var(--cr-font);
}
.sp-cr-filter-tab.active,
.sp-cr-filter-tab:hover { background: var(--cr-navy); color: #fff; border-color: var(--cr-navy); }
.sp-cr-filter-go.active  { background: var(--cr-sage);    border-color: var(--cr-sage); }
.sp-cr-filter-cond.active{ background: var(--cr-gold);    border-color: var(--cr-gold); }
.sp-cr-filter-nogo.active{ background: var(--cr-crimson); border-color: var(--cr-crimson); }

/* Grille pays */
.sp-cr-countries-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 2rem;
}

/* Card pays */
.sp-cr-country-card {
    background: #fff; border: 1.5px solid var(--cr-border);
    border-radius: 12px; padding: 14px 14px 10px;
    display: flex; flex-direction: column; gap: 8px;
    transition: box-shadow .15s, transform .15s;
}
.sp-cr-country-card:hover {
    box-shadow: 0 6px 20px rgba(26,31,94,.1);
    transform: translateY(-2px);
}

/* Mini ring SVG */
.sp-cr-mini-ring-wrap { display: flex; align-items: center; gap: 10px; }
.sp-cr-mini-ring { width: 48px; height: 48px; flex-shrink: 0; }
.sp-cr-mini-ring-val { font-size: 20px; font-weight: 900; line-height: 1; }

/* Infos pays */
.sp-cr-country-info { display: flex; flex-direction: column; gap: 5px; }
.sp-cr-country-header { display: flex; align-items: center; gap: 6px; }
.sp-cr-country-name-sm { font-size: 13px; font-weight: 700; color: var(--cr-navy); }
.sp-cr-country-iso { font-size: 10px; background: var(--cr-lavender-bg, #eef0fc); color: var(--cr-cobalt); padding: 1px 5px; border-radius: 4px; font-weight: 700; }

/* Pill recommandation */
.sp-cr-reco-pill {
    display: inline-block; font-size: 11px; font-weight: 700;
    padding: 2px 9px; border-radius: 20px; border: 1px solid;
    width: fit-content;
}

/* Barre score */
.sp-cr-country-bar { height: 4px; background: var(--cr-border); border-radius: 99px; overflow: hidden; }
.sp-cr-country-bar-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }

/* Footer card */
.sp-cr-country-footer { display: flex; justify-content: space-between; align-items: center; }
.sp-cr-country-date { font-size: 10px; color: #94a3b8; }
.sp-cr-country-detail-link { font-size: 11px; font-weight: 700; color: var(--cr-cobalt); text-decoration: none; }
.sp-cr-country-detail-link:hover { text-decoration: underline; }
.sp-cr-country-detail-link.sp-cr-lock { color: #94a3b8; }

/* Empty state */
.sp-cr-empty-state { text-align: center; padding: 4rem 1rem; }
.sp-cr-empty-icon { font-size: 56px; margin-bottom: 1rem; }
.sp-cr-empty-state h3 { color: var(--cr-navy); font-size: 18px; margin-bottom: .5rem; }
.sp-cr-empty-state p  { color: #64748b; font-size: 14px; margin-bottom: 1.5rem; }

/* Upgrade CTA map */
.sp-cr-map-upgrade { margin-top: 1.5rem; }
.sp-cr-map-upgrade-inner {
    background: linear-gradient(135deg, #eef0fc 0%, #e8f5ee 100%);
    border: 1px solid var(--cr-border); border-radius: 12px;
    padding: 1.25rem 1.5rem;
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.sp-cr-map-upgrade-icon { font-size: 28px; flex-shrink: 0; }
.sp-cr-map-upgrade-inner > div { flex: 1; min-width: 200px; }
.sp-cr-map-upgrade-inner strong { color: var(--cr-navy); font-size: 14px; }
.sp-cr-map-upgrade-inner p { color: #64748b; font-size: 13px; margin: 4px 0 0; }

@media (max-width: 480px) {
    .sp-cr-countries-grid { grid-template-columns: 1fr 1fr; }
    .sp-cr-hero-kpis { gap: 1rem; }
    .sp-cr-map-upgrade-inner { flex-direction: column; text-align: center; }
    .sp-cr-search-box-wrap { flex-direction: column; }
    .sp-cr-map-select { min-width: auto; width: 100%; }
}
