/* =========================================================
   LRI COMPARISON SYSTEM
   lri-compare.css
   ========================================================= */

/* ---- Shared wrapper ---- */
.lri-compare-wrap {
  font-family: var(--sd-font-family, 'Overpass', sans-serif);
  max-width: 900px;
  margin: 0 auto;
}

.lri-compare-hint {
  font-size: 15px;
  color: #444;
  margin-bottom: 18px;
}

/* =========================================================
   COMPARE BUTTON (shared)
   ========================================================= */
.lri-compare-btn {
  display: inline-block;
  margin-top: 20px;
  padding: 12px 28px;
  background: #11355b;
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
  letter-spacing: 0.02em;
}

.lri-compare-btn:hover:not(:disabled) {
  background: #1a4f88;
}

.lri-compare-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* =========================================================
   STICKY COMPARE BAR
   Fixed at bottom of viewport once 2+ countries selected.
   Visible across all 3 UI variants (checkbox, pills, continent_grid).
   ========================================================= */
.lri-sticky-bar {
  display: none;              /* hidden until 2+ selected */
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #11355b;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.22);
  padding: 14px 20px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.lri-sticky-bar.visible {
  display: flex;
}

.lri-sticky-bar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.lri-sticky-bar-count {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

/* Selected country pills inside sticky bar */
.lri-sticky-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lri-sticky-pill {
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.lri-sticky-bar-btn {
  flex-shrink: 0;
  padding: 11px 28px;
  background: #fff;
  color: #11355b;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.lri-sticky-bar-btn:hover:not(:disabled) {
  background: #e8f0f7;
}

.lri-sticky-bar-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Push page content up so sticky bar doesn't cover the bottom */
.lri-compare-wrap {
  padding-bottom: 80px;
}

@media (max-width: 600px) {
  .lri-sticky-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
  }
  .lri-sticky-bar-btn {
    text-align: center;
    padding: 11px 16px;
  }
  .lri-sticky-pills {
    display: none; /* too cramped on mobile — just show count */
  }
}

/* =========================================================
   CHECKBOX TABLE UI
   ========================================================= */
.lri-cb-wrap {
  display: flex;
  flex-direction: column;
}

.lri-cb-search-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.lri-cb-search {
  flex: 1;
  max-width: 340px;
  padding: 9px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.lri-cb-search:focus {
  border-color: #11355b;
}

.lri-cb-counter {
  font-size: 13px;
  font-weight: 600;
  color: #11355b;
  background: #e8f0f7;
  padding: 5px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

.lri-cb-table-wrap {
  max-height: 460px;
  overflow-y: auto;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
}

.lri-cb-table {
  width: 100%;
  border-collapse: collapse;
}

.lri-cb-row {
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}

.lri-cb-row:last-child {
  border-bottom: none;
}

.lri-cb-row:hover:not(.lri-cb-disabled) {
  background: #f5f9ff;
}

.lri-cb-disabled {
  opacity: 0.45;
}

.lri-cb-check-cell {
  width: 48px;
  text-align: center;
  padding: 10px 6px;
}

.lri-cb-flag {
  width: 36px;
  font-size: 22px;
  padding: 8px 4px;
  text-align: center;
}

.lri-cb-name {
  font-size: 14px;
  color: #222;
  padding: 10px 10px 10px 4px;
  cursor: default;
}

/* Custom checkbox */
.lri-cb-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.lri-cb-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.lri-cb-custom {
  width: 18px;
  height: 18px;
  border: 2px solid #9ab;
  border-radius: 4px;
  display: inline-block;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.lri-cb-label input:checked + .lri-cb-custom {
  background: #11355b;
  border-color: #11355b;
}

.lri-cb-label input:checked + .lri-cb-custom::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 6px;
  height: 10px;
  border: 2px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

.lri-cb-label input:disabled + .lri-cb-custom {
  background: #e0e0e0;
  border-color: #ccc;
}

/* =========================================================
   PILLS / TAGS UI
   ========================================================= */
.lri-pills-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  max-width: 600px;
}

.lri-pills-box {
  min-height: 48px;
  border: 2px solid #d9d9d9;
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  cursor: text;
  background: #fff;
  transition: border-color 0.2s;
}

.lri-pills-box:focus-within {
  border-color: #11355b;
}

.lri-pills-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.lri-pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #11355b;
  color: #fff;
  padding: 4px 10px 4px 8px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  animation: lriTagIn 0.15s ease;
}

@keyframes lriTagIn {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.lri-pill-tag button {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: color 0.15s;
}

.lri-pill-tag button:hover {
  color: #fff;
}

.lri-pills-input {
  border: none;
  outline: none;
  font-size: 14px;
  flex: 1;
  min-width: 140px;
  background: transparent;
  padding: 2px 0;
}

.lri-pills-dropdown {
  display: none;
  position: relative;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #fff;
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  z-index: 100;
}

.lri-pills-dropdown.lri-drop-open {
  display: block;
}

.lri-pills-option {
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.12s;
}

.lri-pills-option:last-child {
  border-bottom: none;
}

.lri-pills-option:hover {
  background: #f0f6ff;
}

.lri-pills-option.lri-opt-selected {
  background: #e8f0f7;
  font-weight: 600;
  color: #11355b;
}

.lri-pills-option.lri-opt-selected::after {
  content: '✓';
  margin-left: auto;
  color: #11355b;
  font-weight: 700;
}

.lri-opt-flag {
  font-size: 20px;
  line-height: 1;
}

.lri-pills-counter {
  font-size: 13px;
  font-weight: 600;
  color: #11355b;
  margin: 0;
}

/* =========================================================
   RESULT TABLE
   ========================================================= */
.lri-result-wrap {
  font-family: var(--sd-font-family, 'Overpass', sans-serif);
  max-width: 100%;
}

.lri-result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;       /* keep everything on one line */
  gap: 12px;
  margin-bottom: 18px;
}

/* Left side: year badge + count — shrinks if needed but never wraps */
.lri-meta-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Right side: buttons — shrinks if needed, never wraps to a new line */
.lri-meta-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

/* Top buttons: compact, same height as the year badge */
.lri-meta-actions .lri-action-btn {
  padding: 5px 14px;
  font-size: 13px;
  white-space: nowrap;
}

/* Mobile: allow wrapping only below 480px where one-line is impossible */
@media (max-width: 480px) {
  .lri-result-meta {
    flex-wrap: wrap;
  }
}

.lri-result-year-badge {
  background: #11355b;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

.lri-result-count {
  font-size: 13px;
  color: #666;
}

/* Horizontal scroll wrapper */
.lri-result-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
}

.lri-result-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 560px;
  font-size: 14px;
}

/* ---- Column widths ---- */
.lri-result-table .lri-col-question {
  width: 38%;
  min-width: 220px;
}

.lri-result-table .lri-col-answer {
  min-width: 110px;
  text-align: center;
}

/* ---- Header row ---- */
.lri-result-table thead tr {
  background: #11355b;
  color: #fff;
}

.lri-result-table thead th {
  padding: 12px 10px;
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  border-right: 1px solid rgba(255,255,255,0.15);
  vertical-align: bottom;
}

.lri-result-table thead th.lri-col-country {
  text-align: center;
}

.lri-result-table thead th:last-child {
  border-right: none;
}

.lri-th-flag {
  display: block;
  font-size: 24px;
  line-height: 1;
  margin-bottom: 4px;
}

.lri-th-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}

/* ---- Meta rows (Score, Rating) ---- */
.lri-row-meta {
  background: #f5f8fc;
}

.lri-row-meta td {
  padding: 10px 10px;
  border-bottom: 1px solid #e4eaf2;
  border-right: 1px solid #e4eaf2;
}

.lri-row-meta td:last-child {
  border-right: none;
}

.lri-label-score,
.lri-label-rating {
  font-weight: 700;
  color: #11355b;
  font-size: 13px;
}

.lri-cell-score {
  font-weight: 700;
  font-size: 16px;
  color: #11355b;
}

/* Rating badge */
.lri-rating-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  background: #888;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ---- Section header rows ---- */
.lri-row-section {
  background: #eef3f9;
}

.lri-row-section td {
  padding: 9px 10px;
  border-bottom: 1px solid #d4dfe9;
  border-right: 1px solid #d4dfe9;
}

.lri-row-section td:last-child {
  border-right: none;
}

.lri-section-label {
  font-weight: 700;
  font-size: 13px;
  color: #11355b;
  letter-spacing: 0.01em;
}

.lri-cell-section-score {
  font-weight: 700;
  font-size: 14px;
  color: #333;
}

/* ---- Question rows ---- */
.lri-row-question {
  background: #fff;
}

.lri-row-question:nth-child(even) {
  background: #fafbfd;
}

.lri-row-question td {
  padding: 8px 10px;
  border-bottom: 1px solid #eeeff2;
  border-right: 1px solid #eeeff2;
  vertical-align: middle;
}

.lri-row-question td:last-child {
  border-right: none;
}

.lri-q-label {
  font-size: 13px;
  color: #333;
  line-height: 1.45;
}

/* ---- Answer pills ---- */
.lri-ans {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
}

.lri-ans-yes {
  background: #d4edda;
  color: #1a7530;
}

.lri-ans-no {
  background: #fde8e8;
  color: #b91c1c;
}

.lri-ans-partial {
  background: #fff3cd;
  color: #856404;
}

.lri-ans-na {
  color: #aaa;
  font-weight: 400;
  font-size: 14px;
}

/* ---- Actions bar ---- */
.lri-result-actions {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.lri-action-btn {
  padding: 10px 22px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.lri-btn-print {
  background: #11355b;
  color: #fff;
}

.lri-btn-print:hover {
  background: #1a4f88;
}

.lri-btn-back {
  background: #f0f0f0;
  color: #333;
}

.lri-btn-back:hover {
  background: #e0e0e0;
}

/* =========================================================
   COUNTRY TIMELINE — year label under flag in header
   ========================================================= */
.lri-th-year-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.06em;
  margin-top: 2px;
}

/* Legal Basis column — wider, left-aligned, muted header */
.lri-col-legal-basis {
  min-width: 200px;
  text-align: left !important;
  background: #f0f4f9;
}

.lri-result-table thead th.lri-col-legal-basis {
  background: #2a4a6b;
}

.lri-cell-legal {
  font-size: 12px;
  color: #444;
  line-height: 1.4;
  text-align: left !important;
}

/* =========================================================
   PRINT STYLES
   ========================================================= */
@media print {
  /* Hide both button rows and the count when printing */
  .lri-result-actions,
  .lri-meta-actions {
    display: none !important;
  }

  .lri-result-scroll {
    overflow: visible;
    border: none;
  }

  .lri-result-table {
    font-size: 11px;
  }

  .lri-result-table thead tr {
    background: #11355b !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .lri-row-section {
    background: #eef3f9 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .lri-ans-yes {
    background: #d4edda !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .lri-ans-no {
    background: #fde8e8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 767px) {
  .lri-compare-wrap {
    max-width: 100%;
  }

  .lri-cb-search-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .lri-cb-search {
    max-width: 100%;
    width: 100%;
  }

  .lri-pills-wrap {
    max-width: 100%;
  }

  .lri-result-table .lri-col-question {
    width: 50%;
    min-width: 160px;
  }

  .lri-result-table .lri-col-answer {
    min-width: 90px;
  }
}

/* =========================================================
   CONTINENT GRID UI
   ========================================================= */

.lri-cg-wrap {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ---- Top bar: search + counter ---- */
.lri-cg-topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.lri-cg-search {
  flex: 1;
  max-width: 340px;
  padding: 9px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.lri-cg-search:focus {
  border-color: #11355b;
}

.lri-cg-counter {
  font-size: 13px;
  font-weight: 600;
  color: #11355b;
  background: #e8f0f7;
  padding: 5px 14px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ---- Selected pills bar ---- */
.lri-cg-selected-bar {
  display: none;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 14px;
  background: #f0f6ff;
  border: 1px solid #c5d9ef;
  border-radius: 8px;
  margin-bottom: 16px;
}

.lri-cg-sel-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #11355b;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 8px 4px 10px;
  border-radius: 20px;
  animation: lriTagIn 0.15s ease;
}

.lri-cg-pill-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,0.75);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 0 0 2px;
  transition: color 0.15s;
}

.lri-cg-pill-remove:hover {
  color: #fff;
}

/* ---- Continent section ---- */
.lri-cg-continent {
  margin-bottom: 22px;
}

.lri-cg-continent-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #888;
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid #e8e8e8;
}

/* ---- Country cards grid ---- */
.lri-cg-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- Individual country card ---- */
.lri-cg-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 12px 8px;
  min-width: 72px;
  max-width: 96px;
  background: #fff;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s, transform 0.1s;
  font-family: inherit;
  text-align: center;
}

.lri-cg-card:hover:not(:disabled) {
  border-color: #11355b;
  background: #f5f9ff;
  transform: translateY(-2px);
}

.lri-cg-card--selected {
  border-color: #11355b !important;
  background: #11355b !important;
}

.lri-cg-card--selected .lri-cg-name {
  color: #fff !important;
}

.lri-cg-card--disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.lri-cg-flag {
  font-size: 28px;
  line-height: 1;
  display: block;
}

.lri-cg-name {
  font-size: 11px;
  font-weight: 500;
  color: #333;
  line-height: 1.2;
  word-break: break-word;
  hyphens: auto;
}

/* ---- Submit button ---- */
.lri-cg-submit {
  margin-top: 8px;
  align-self: flex-start;
}

/* ---- Responsive ---- */
@media (max-width: 767px) {
  .lri-cg-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .lri-cg-search {
    max-width: 100%;
    width: 100%;
  }

  .lri-cg-flag {
    font-size: 24px;
  }

  .lri-cg-card {
    min-width: 64px;
    padding: 8px 8px 6px;
  }
}