/**
 * Country risk scores — /app/country-risks
 *
 * Enqueued by sr_country_risks_styles() in theme-custom-functions.php.
 * custom.css is not used: theme-styles.php, which links it, is commented out
 * in functions.php.
 */

.country-risks-wrapper {
  display: none;
  flex: 1;
  margin: 0px;
  min-width: 0;
}

#main.country-risks-mode .left-sidebar,
#main.country-risks-mode .middle-content-wrapper {
  display: none;
}

/* The dashboard runs edge to edge, flush under the header, as in the mockup.
   #header carries a global 32px bottom margin (style.css); this pulls #main
   back up over it for this mode only. */
#main.country-risks-mode {
  margin-top: -32px;
}

/* Header entry point. Deliberately not .search-button: that class is given a
   fixed 82px width below 576px, which would break this longer label. */
.cr-nav-button {
  cursor: pointer;
  display: inline-block;
  padding: 4px 24px;
  margin-top: 5px;
  position: relative;
  right: -6px;
}

@media (max-width: 575.98px) {
  .cr-nav-button {
    white-space: nowrap;
    padding: 4px 10px;
    font-size: 0.82em;
    right: 0px;
  }
}

.cr-loading {
  padding: 60px 0px;
  text-align: center;
  color: #A8AAAB;
}

.cr-stage {
  position: relative;
  /* Fill what is left below the 85px header rather than sitting in a card. */
  height: calc(100vh - 85px);
  min-height: 700px;
  background: #2f2c2b;
  overflow: hidden;
}

/* panels ----------------------------------------------------------------- */

.cr-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0px 2px 8px 1px rgba(0, 0, 0, 0.28);
  padding: 20px 22px;
}

.cr-nav {
  position: absolute;
  left: 26px;
  top: 24px;
  width: 306px;
  z-index: 30;
}

.cr-scale {
  position: absolute;
  left: 26px;
  bottom: 24px;
  width: 306px;
  z-index: 20;
}

.cr-title {
  margin: 0px;
  padding: 0px;
  font-size: 1.14em;
  color: #2A2728;
}

.cr-subtitle {
  margin: 5px 0px 16px 0px;
  font-size: 0.72em;
  color: #A8AAAB;
}

.cr-field-label {
  font-size: 0.66em;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #A8AAAB;
  margin-bottom: 7px;
}

.cr-pills .cr-field-label,
.cr-card .cr-field-label + .cr-pills {
  margin-top: 0px;
}

.cr-card .cr-select + .cr-field-label {
  margin-top: 17px;
}

/* country select --------------------------------------------------------- */

.cr-select {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  background: #fff;
}

.cr-select.is-open {
  border-color: #FF4E35;
}

.cr-select-value {
  font-size: 0.84em;
  color: #A8AAAB;
}

.cr-select-value.is-set {
  color: #2A2728;
  font-weight: 600;
}

.cr-select-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cr-caret {
  font-size: 0.6em;
  color: #A8AAAB;
}

.cr-clear {
  border: 0;
  background: none;
  padding: 0px 2px;
  font-size: 0.72em;
  color: #A8AAAB;
  cursor: pointer;
}

.cr-clear:hover {
  color: #cc3535;
}

.cr-dropdown {
  margin-top: 6px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0px 6px 18px rgba(0, 0, 0, 0.32);
  overflow: hidden;
}

.cr-dropdown-search {
  padding: 9px 12px;
  border-bottom: 1px solid #f0f0f0;
}

.cr-filter {
  width: 100%;
  box-sizing: border-box;
  border: 0;
  outline: none;
  font-family: inherit;
  font-size: 0.82em;
  color: #444;
}

.cr-options {
  margin: 0px;
  padding: 0px;
  list-style: none;
  max-height: 300px;
  overflow-y: auto;
}

.cr-option {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  background: none;
  text-align: left;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.8em;
  color: #444;
  cursor: pointer;
}

.cr-option:hover {
  background: #faf7f6;
}

.cr-option.is-active {
  background: #fff4f4;
}

.cr-option.is-unrated {
  color: #b9b5b3;
  cursor: default;
}

.cr-option-name {
  flex: 1;
}

.cr-option-value {
  font-size: 0.86em;
  color: #A8AAAB;
}

.cr-option-empty {
  padding: 10px 14px;
  font-size: 0.8em;
  color: #A8AAAB;
}

.cr-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 10px;
  flex: 0 0 auto;
}

/* category pills --------------------------------------------------------- */

.cr-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cr-pill {
  border: 0;
  border-radius: 23px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.76em;
  font-weight: 600;
  background: #f4f4f4;
  color: #8b8b8b;
  cursor: pointer;
}

.cr-pill:hover {
  color: #2A2728;
}

.cr-pill.is-active {
  background: #FF4E35;
  color: #fff;
}

/* risk rating scale ------------------------------------------------------ */

.cr-scale-title {
  margin: 0px;
  padding: 0px;
  font-size: 0.78em;
  color: #2A2728;
}

.cr-scale-subtitle {
  margin: 4px 0px 16px 0px;
  font-size: 0.68em;
  color: #A8AAAB;
}

.cr-scale-bar {
  position: relative;
  height: 32px;
  margin: 0px 26px;
}

.cr-scale-gradient {
  position: absolute;
  top: 0px;
  left: 0px;
  width: 100%;
  height: 10px;
  border-radius: 4px;
  background: linear-gradient(90deg, #4ebc4a 0%, #a9cd4c 25%, #eeda5f 50%, #ffa869 62.5%, #f36854 80%, #b3281f 100%);
}

.cr-tick {
  position: absolute;
  top: 11px;
  width: 1px;
  height: 5px;
  background: #ccc;
}

.cr-tick-label {
  position: absolute;
  top: 18px;
  width: 62px;
  margin-left: -31px;
  text-align: center;
  font-size: 10px;
  color: #888;
}

.cr-pin {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 18px;
  margin-left: -2px;
  border-radius: 2px;
  background: #2A2728;
  box-shadow: 0px 0px 0px 2px #fff;
}

.cr-scale-key {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
  font-size: 0.66em;
  color: #999;
}

.cr-key-swatch {
  width: 12px;
  height: 12px;
  display: inline-block;
  flex: 0 0 auto;
}

.cr-key-unrated {
  border-radius: 3px;
  background: #4a4543;
}

.cr-key-island {
  border-radius: 50%;
  border: 1.5px solid #A8AAAB;
  margin-left: 10px;
}

/* map -------------------------------------------------------------------- */

.cr-map {
  position: absolute;
  left: 344px;
  right: 448px;
  top: 22px;
  bottom: 22px;
}

.cr-map-inner,
.cr-map-inner svg {
  width: 100%;
  height: 100%;
  display: block;
}

.cr-country {
  stroke: rgba(47, 44, 43, 0.85);
  stroke-width: 0.7;
  cursor: pointer;
  transition: fill 0.12s ease, opacity 0.12s ease;
}

.cr-country.cr-country-unrated {
  fill: #4a4543;
  cursor: default;
}

.cr-country.is-dimmed {
  opacity: 0.78;
}

.cr-country.is-hovered {
  stroke: #ffffff;
  stroke-width: 1.8;
  opacity: 1;
}

.cr-country.is-selected {
  stroke: #ffffff;
  stroke-width: 2.4;
  opacity: 1;
}

.cr-country:focus,
.cr-island:focus {
  outline: none;
  stroke: #FF4E35;
  stroke-width: 2.4;
}

.cr-ground {
  fill: #4a4543;
  stroke: #2f2c2b;
  stroke-width: 0.8;
}

.cr-island {
  fill: none;
  stroke: #ffffff;
  stroke-width: 1.2;
  opacity: 0.5;
  cursor: pointer;
}

.cr-label {
  font-family: 'Poppins', sans-serif;
  font-size: 9px;
  font-weight: 600;
  fill: rgba(47, 44, 43, 0.62);
  letter-spacing: 0.6px;
  text-anchor: middle;
  pointer-events: none;
}

/* shared score track ----------------------------------------------------- */

.cr-track {
  position: relative;
  flex: 1;
  height: 3px;
  background: #e8e8e8;
  border-radius: 3px;
}

.cr-dot {
  position: absolute;
  top: -3.5px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0px 0px 3px rgba(0, 0, 0, 0.18);
}

.cr-dot-sub {
  top: -2.5px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  border-width: 0px;
}

/* right panel ------------------------------------------------------------ */

.cr-panel {
  position: absolute;
  right: 0px;
  top: 0px;
  bottom: 0px;
  width: 430px;
  background: #fff;
  box-shadow: -4px 0px 18px rgba(0, 0, 0, 0.30);
  padding: 26px 28px;
  box-sizing: border-box;
  overflow-y: auto;
  z-index: 15;
}

.cr-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cr-country-name {
  margin: 0px;
  padding: 0px;
  font-size: 1.3em;
  color: #2A2728;
}

.cr-country-band {
  margin: 3px 0px 0px 0px;
  font-size: 0.72em;
  color: #A8AAAB;
}

.cr-overall {
  text-align: right;
}

.cr-overall-value {
  display: block;
  font-size: 2em;
  font-weight: 600;
  line-height: 1;
}

.cr-overall-label {
  display: block;
  font-size: 0.6em;
  color: #A8AAAB;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.cr-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 18px 0px 6px 0px;
  padding-top: 4px;
}

.cr-section-title {
  font-size: 0.66em;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #A8AAAB;
}

.cr-section-hint {
  font-size: 0.66em;
  color: #bdbdbd;
}

.cr-cascade {
  border-top: 1px solid #f0f0f0;
  padding-top: 4px;
}

.cr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  background: none;
  text-align: left;
  font-family: inherit;
}

.cr-row-pillar {
  padding: 7px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.cr-row-pillar:hover {
  background: #faf7f6;
}

.cr-row-pillar.is-open {
  background: #faf7f6;
}

.cr-row-sub {
  padding: 4px 10px 4px 26px;
  background: #faf7f6;
}

.cr-chevron {
  width: 16px;
  flex: 0 0 auto;
  text-align: center;
  font-size: 0.9em;
  color: #A8AAAB;
}

.cr-row-label {
  flex: 1;
  min-width: 0;
  font-size: 0.84em;
  font-weight: 600;
  color: #2A2728;
}

.cr-row-sub .cr-row-label {
  font-size: 0.76em;
  font-weight: 400;
  color: #666;
}

.cr-row .cr-track {
  flex: 0 0 92px;
}

.cr-row-value {
  width: 34px;
  flex: 0 0 auto;
  text-align: right;
  font-size: 0.84em;
  font-weight: 600;
  color: #2A2728;
}

.cr-row-sub .cr-row-value {
  font-size: 0.76em;
  font-weight: 400;
  color: #666;
}

/* score changes — placeholder until the data model exists ---------------- */

.cr-changes {
  min-height: 190px;
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
}

.cr-changes-empty {
  margin: 0px;
  font-size: 0.76em;
  line-height: 1.6;
  color: #A8AAAB;
}

.cr-profile-link {
  display: block;
  margin-top: 12px;
  padding: 11px 20px;
  border-radius: 23px;
  background: #FF4E35;
  color: #fff;
  font-size: 0.84em;
  text-align: center;
}

.cr-profile-link:hover {
  background: #e6462f;
  color: #fff;
}

/* ranking ---------------------------------------------------------------- */

.cr-invert {
  border: 0;
  border-radius: 8px;
  background: #fff4f4;
  color: #cc3535;
  padding: 7px 13px;
  font-family: inherit;
  font-size: 0.72em;
  cursor: pointer;
  white-space: nowrap;
}

.cr-rank-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0px 6px 0px;
  padding: 0px 10px 6px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 0.62em;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #A8AAAB;
}

.cr-rank-list {
  margin: 4px 0px 0px 0px;
  padding: 0px;
  list-style: none;
}

.cr-rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  border: 0;
  background: none;
  text-align: left;
  font-family: inherit;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.cr-rank-row:hover {
  background: #faf7f6;
}

.cr-rank-number {
  width: 20px;
  flex: 0 0 auto;
  font-size: 0.72em;
  color: #A8AAAB;
}

.cr-rank-name {
  flex: 1;
  min-width: 0;
  font-size: 0.8em;
  color: #444;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cr-rank-bar {
  width: 108px;
  flex: 0 0 auto;
  height: 6px;
  background: #f2f2f2;
  border-radius: 3px;
  overflow: hidden;
}

.cr-rank-header .cr-rank-bar {
  background: none;
  height: auto;
}

.cr-rank-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
}

.cr-rank-value {
  width: 34px;
  flex: 0 0 auto;
  text-align: right;
  font-size: 0.78em;
  font-weight: 600;
  color: #2A2728;
}

.cr-rank-foot {
  margin: 10px 0px 0px 0px;
  font-size: 0.66em;
  color: #A8AAAB;
}

.cr-rank-row.is-unrated {
  color: #b9b5b3;
  cursor: default;
}

.cr-rank-row.is-unrated .cr-rank-name,
.cr-rank-row.is-unrated .cr-rank-value {
  color: #b9b5b3;
  font-weight: 400;
}

.cr-rank-row.is-unrated .cr-rank-value {
  width: auto;
  white-space: nowrap;
  font-size: 0.72em;
}

.cr-rank-row.is-unrated .cr-rank-bar {
  background: #f5f5f5;
}

.cr-rank-row.is-unrated:hover {
  background: none;
}

/* responsive ------------------------------------------------------------- */

@media only screen and (max-width: 1100px) {
  .cr-stage {
    height: auto;
    min-height: 0;
    background: none;
    overflow: visible;
    padding: 0px 20px 24px 20px;
  }

  .cr-nav,
  .cr-scale,
  .cr-map,
  .cr-panel {
    position: static;
    width: auto;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
  }

  .cr-map {
    background: #2f2c2b;
    border-radius: 12px;
    margin: 12px 0px;
    padding: 12px;
  }

  .cr-map-inner,
  .cr-map-inner svg {
    height: auto;
  }

  .cr-panel {
    box-shadow: 0px 2px 8px 1px rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    overflow: visible;
  }
}

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