/* World prices widget */
.cps-world-prices {
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --muted: #64748b;
  --text: #0f172a;
  --accent: #16a34a;
  --danger: #dc2626;
  --shadow: 0 18px 38px rgba(15, 23, 42, 0.08);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.cps-world-prices * {
  box-sizing: border-box;
}

.cps-world-prices .wp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.cps-world-prices .wp-group-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.cps-world-prices .wp-group-unit-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  font-weight: 400;
  margin-top: 2px;
}

.cps-world-prices .group-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cps-world-prices .wp-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.cps-world-prices .wp-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--text);
}

.cps-world-prices .wp-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.cps-world-prices .wp-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cps-world-prices .badge-live {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 600;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.cps-world-prices .badge-live::before {
  content: "";
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.15);
  position: relative;
}

.cps-world-prices .badge-live::after {
  content: "";
  position: absolute;
  left: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(34, 197, 94, 0.5);
  animation: cpsLivePulse 1.6s ease-out infinite;
}

.cps-world-prices .badge-value {
  padding: 4px 8px;
  background: #f1f5f9;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  min-width: 88px;
  text-align: center;
  color: var(--text);
  font-weight: 600;
}

.cps-world-prices .badge-value.is-ice {
  background: #eef2ff;
  border-color: #e0e7ff;
  color: #4338ca;
}

.cps-world-prices .badge-change {
  padding: 4px 8px;
  background: #f1f5f9;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.cps-world-prices .badge-change.is-ice {
  background: #e0f2fe;
  border-color: #bae6fd;
  color: #0ea5e9;
}

.cps-world-prices .badge-change.is-positive {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #15803d;
}

.cps-world-prices .badge-change.is-negative {
  background: #fee2e2;
  border-color: #fecdd3;
  color: #b91c1c;
}

.cps-world-prices .badge-change .arrow-up {
  color: #16a34a;
}

.cps-world-prices .badge-change .arrow-down {
  color: #dc2626;
}

.cps-world-prices .wp-updated {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.cps-world-prices .wp-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.cps-world-prices .chip-select {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.cps-world-prices .chip-select select {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.cps-world-prices .chip-select-display {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  min-width: 120px;
}

.cps-world-prices .chip-select-caret {
  font-size: 12px;
  color: #6b7280;
}

.cps-world-prices .chip-select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 150px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.15);
  padding: 4px 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 20;
}

.cps-world-prices .chip-select.is-open .chip-select-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.cps-world-prices .chip-select-options {
  display: flex;
  flex-direction: column;
}

.cps-world-prices .chip-select-option {
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.cps-world-prices .chip-select-option:hover {
  background: #f3f4f6;
}

.cps-world-prices .chip-select-option.is-selected {
  font-weight: 700;
  color: var(--text);
}

.cps-world-prices .date-pill-wrapper {
  position: relative;
}

.cps-world-prices .date-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  min-width: 140px;
}

.cps-world-prices .date-pill-icon {
  font-size: 14px;
}

.cps-world-prices .date-picker {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 30;
  min-width: 220px;
  border-radius: 12px;
  background-color: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.12);
  padding: 6px 12px 8px;
  font-size: 11px;
  color: #111827;
}

.cps-world-prices .date-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.cps-world-prices .date-picker-title {
  font-weight: 600;
  font-size: 11px;
}

.cps-world-prices .date-picker-nav {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background-color: #ffffff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.cps-world-prices .date-picker-nav:hover {
  background-color: #f3f4f6;
  border-color: #d1d5db;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.12);
}

.cps-world-prices .date-picker-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 4px;
  font-size: 10px;
  color: #c4c7cf;
}

.cps-world-prices .date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.cps-world-prices .date-picker-day {
  border: none !important;
  background: transparent !important;
  border-radius: 4px !important;
  width: 28px !important;
  height: 28px !important;
  min-width: 0;
  min-height: 0;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  color: #111827;
  transition:
    background-color 0.12s ease,
    color 0.12s ease,
    box-shadow 0.12s ease;
}

.cps-world-prices .date-picker-day:hover:not(.is-disabled) {
  background-color: #f3f4f6;
}

.cps-world-prices .date-picker-day.is-active {
  background-color: #111827 !important;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.3);
}

.cps-world-prices .date-picker-day.is-other {
  color: #d1d5db;
}

.cps-world-prices .date-picker-day.is-disabled,
.cps-world-prices .date-picker-day.is-disabled:hover {
  cursor: default;
  color: #d1d5db;
  background: transparent !important;
  box-shadow: none;
}

.cps-world-prices .wp-btn {
  white-space: nowrap;
}

.cps-world-prices .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.cps-world-prices button.wp-btn {
  padding: 9px 12px;
  border: none;
  background: #0ea5e9;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(14, 165, 233, 0.35);
}

.cps-world-prices .wp-loading {
  font-size: 13px;
  color: var(--muted);
  padding: 8px 0;
}

.cps-world-prices .wp-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 12px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  background: #fff;
}

.cps-world-prices .wp-cards {
  display: none;
  margin-top: 10px;
  gap: 10px;
  flex-direction: column;
}

.cps-world-prices .wp-card-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.cps-world-prices .wp-card-item .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.cps-world-prices .wp-card-item .title {
  font-weight: 700;
  font-size: 15px;
}

.cps-world-prices .wp-card-item .month {
  font-size: 12px;
  color: var(--muted);
}

.cps-world-prices .wp-card-item .price {
  font-size: 18px;
  font-weight: 700;
}

.cps-world-prices .wp-card-item .meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  font-size: 12px;
  color: var(--muted);
}

.cps-world-prices .wp-card-item .change {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 600;
}

.cps-world-prices .wp-card-item .change.is-positive {
  color: #16a34a;
}

.cps-world-prices .wp-card-item .change.is-negative {
  color: #dc2626;
}

.cps-world-prices .wp-card-item .badge-change {
  margin-left: 6px;
}

.cps-world-prices .wp-table thead {
  background: linear-gradient(90deg, #f8fafc 0%, #eef2ff 100%);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cps-world-prices .wp-table th,
.cps-world-prices .wp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.cps-world-prices .wp-table th {
  font-weight: 700;
  color: #0f172a;
  font-size: 11px;
  text-align: center;
}

.cps-world-prices .wp-table td {
  color: #111827;
  font-size: 14px;
  text-align: center;
	font-weight: 500;
}

.cps-world-prices .wp-table tbody tr:nth-child(even) {
  background: #f9fafb;
}

.cps-world-prices .wp-table tbody tr:hover {
  background: #eef2ff;
}

.cps-world-prices .wp-table tbody tr:last-child td {
  border-bottom: none;
}

.cps-world-prices .wp-table td:nth-child(3),
.cps-world-prices .wp-table td:nth-child(6),
.cps-world-prices .wp-table td:nth-child(7) {
  font-weight: 600;
}

.cps-world-prices .change-chip {
  text-align: center;
}

.cps-world-prices .change-chip .chip-body {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 10px;
  min-width: 44px;
  font-weight: 600;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.12);
}

.cps-world-prices .change-chip.is-positive .chip-body {
  background: #22c55e;
}

.cps-world-prices .change-chip.is-negative .chip-body {
  background: #ef4444;
}

.cps-world-prices .change-chip .chip-arrow,
.cps-world-prices .change-chip .chip-value {
  font-size: 11px;
  line-height: 1;
}


.cps-world-prices .wp-table .is-negative {
  color: var(--danger);
}

.cps-world-prices .wp-table .is-positive {
  color: var(--accent);
}

.cps-world-prices .wp-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}

.cps-world-prices .wp-group-title h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
}

.cps-world-prices .wp-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 720px) {
  .cps-world-prices .wp-header {
    flex-direction: column;
  }

  .cps-world-prices .wp-group-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .cps-world-prices .group-badges {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .cps-world-prices .wp-table {
    display: none;
  }

  .cps-world-prices .wp-cards {
    display: flex;
  }
}
@keyframes cpsLivePulse {
  0% {
    opacity: 0.8;
    transform: scale(1);
  }
  70% {
    opacity: 0;
    transform: scale(2.2);
  }
  100% {
    opacity: 0;
    transform: scale(2.2);
  }
}
