.rates-widget {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1050;
  font-family: Manrope, system-ui, -apple-system, Segoe UI, sans-serif;
  color: #111;
}

.rates-widget--header {
  right: 16px;
  bottom: auto;
  top: var(--rates-widget-top, 72px);
}

.rates-widget--header .rates-widget__fab,
.rates-widget--header .rates-widget__mini {
  display: none !important;
}

.rates-widget--header .rates-widget__panel {
  display: block;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.rates-widget--header.is-panel-open .rates-widget__panel {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.rates-widget__panel {
  width: 380px;
  max-width: calc(100vw - 24px);
  max-height: min(76vh, 720px);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  display: none;
}
@keyframes rates-widget-gradient-move {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.rates-widget.is-panel-open .rates-widget__panel { display: block; }

.rates-widget__panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 0 14px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
}
.rates-widget__panel-title-text { font-weight: 900; }
.rates-widget__panel-updated { margin-left: 8px; font-size: 12px; color: #666; }

.rates-widget__panel-actions { display: flex; gap: 6px; }
.rates-widget__icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  color: #333;
  padding: 0;
  line-height: 1;
}
.rates-widget__icon-btn:hover { background: rgba(0,0,0,0.05); }
.rates-widget__icon-btn i,
.rates-widget__icon-btn svg {
  display: block;
  line-height: 1;
}
.rates-widget__icon-btn i { font-size: 16px; }

.rates-widget__nav-btn.is-active {
  background: rgba(13,110,253,0.10);
  color: #0d6efd;
}

/* Tooltips: main site style (black bg, white text) */
.rates-widget [data-tooltip] {
  position: relative;
}
.rates-widget [data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 6px;
  padding: 6px 10px;
  background: #000;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1100;
}
.rates-widget [data-tooltip]:hover::after,
.rates-widget [data-tooltip]:focus-visible::after {
  opacity: 1;
}

.rates-widget__content {
  padding: 12px;
  overflow: auto;
  max-height: calc(min(76vh, 720px) - 58px);
}

.rates-widget__section { display: none; }
.rates-widget__section.is-active { display: block; }

.rates-widget__section-title {
  font-size: 14px;
  font-weight: 800;
  color: #666;
  margin: 0 0 10px 0;
  padding-left: 2px; /* align with panel title "Rates" (header padding-left 14px, content 12px) */
}

.rates-widget__row { display: grid; grid-template-columns: 1fr; gap: 6px; margin-bottom: 10px; }
.rates-widget__row--actions { margin-top: 6px; }
.rates-widget__amount-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.rates-widget__amount-wrap .rates-widget__input--inline-label {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  padding: 10px 12px;
  padding-right: 8px;
}
.rates-widget__amount-wrap .rates-widget__input--inline-label:focus {
  outline: none;
  box-shadow: none;
}
.rates-widget__amount-inline-label {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border-left: 1px solid rgba(0, 0, 0, 0.12);
  font-weight: 700;
  font-size: 14px;
  color: #444;
  background: transparent;
  white-space: nowrap;
}
/* Add section: same width for Base and Target dropdown area */
.rates-widget__section[data-section="add"] .rates-widget__amount-inline-label {
  min-width: 5rem;
}

.rates-widget__amount-wrap .rates-widget__select--inline-label {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  padding-right: 36px;
}
.rates-widget__amount-wrap .rates-widget__select--inline-label:focus {
  outline: none;
  box-shadow: none;
}

.rates-widget__label { font-weight: 800; font-size: 12px; color: #444; }
.rates-widget__input, .rates-widget__select {
  width: 100%;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
}

/* Stylish selects (native, but consistent) */
.rates-widget__select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  padding-right: 44px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 16 16'%3E%3Cpath fill='%23666' d='M3.2 5.9a.8.8 0 0 1 1.1 0L8 9.6l3.7-3.7a.8.8 0 1 1 1.1 1.1l-4.25 4.25a.8.8 0 0 1-1.1 0L3.2 7a.8.8 0 0 1 0-1.1z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px 18px;
}
.rates-widget__select:hover {
  border-color: rgba(0,0,0,0.18);
  background-color: rgba(0,0,0,0.01);
}
.rates-widget__select:focus {
  outline: none;
  border-color: rgba(13,110,253,0.55);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.18);
}
.rates-widget__select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background-color: rgba(0,0,0,0.03);
}

/* Hide native number spinners (they clash with inline action button) */
.rates-widget__input[type="number"]::-webkit-outer-spin-button,
.rates-widget__input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.rates-widget__input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.rates-widget__btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  background: #0d6efd;
  color: #fff;
  font-weight: 900;
}
.rates-widget__btn:disabled { opacity: 0.55; }

.rates-widget__hint { font-size: 12px; color: #666; margin-top: 8px; }
.rates-widget__empty { font-size: 13px; color: #666; padding: 10px 0; }

.rates-widget__footer {
  padding-top: 10px;
  font-size: 12px;
  color: #666;
}

.rates-widget__list { display: grid; gap: 10px; }
.rates-widget__card {
  background: linear-gradient(135deg, #f6f9fd 0%, #fff 100%);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 14px;
  padding: 8px 10px 10px 12px;
}
.rates-widget__card--flash {
  animation: ratesWidgetFlash 1200ms ease-out;
  border-color: rgba(13,110,253,0.55);
  box-shadow: 0 0 0 3px rgba(13,110,253,0.12);
}
@keyframes ratesWidgetFlash {
  0% { background: rgba(13,110,253,0.10); }
  100% { background: #fff; }
}
.rates-widget__card-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}
.rates-widget__card-left { min-width: 0; }
.rates-widget__card-right { display: grid; justify-items: end; gap: 6px; }
.rates-widget__pairline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 1000;
  letter-spacing: 0.2px;
}
.rates-widget__pairline code { font-weight: 1000; }
.rates-widget__pairline .rates-widget__flip-inline {
  appearance: none;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: #111;
  border-radius: 10px;
  padding: 2px 6px;
  font-weight: 1000;
  font-size: 13px;
  line-height: 1;
}
.rates-widget__pairline .rates-widget__flip-inline:hover { color: #0d6efd; background: rgba(13,110,253,0.08); }
.rates-widget__pairline .rates-widget__flip-inline:active { transform: translateY(1px); }
.rates-widget__pair {
  font-weight: 1000;
  letter-spacing: 0.2px;
}
.rates-widget__pair code { font-weight: 1000; }
.rates-widget__card-meta { font-size: 12px; color: #666; margin-top: 6px; line-height: 1.35; }
.rates-widget__result {
  margin-top: 2px;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 1000;
  letter-spacing: 0.2px;
}
.rates-widget__result small {
  font-size: 14px;
  font-weight: 900;
  color: #444;
}

.rates-widget__loading-line {
  font-size: 12px;
  color: #666;
}

.rates-widget__skeleton {
  height: 28px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(0,0,0,0.06), rgba(0,0,0,0.10), rgba(0,0,0,0.06));
  background-size: 240% 100%;
  animation: ratesWidgetShimmer 1100ms ease-in-out infinite;
}
@keyframes ratesWidgetShimmer {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 0%; }
}
.rates-widget__remove-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #111;
  border-radius: 10px;
  width: 18px;
  height: 18px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  line-height: 1;
  margin-top: -2px;
  margin-right: -2px;
}
.rates-widget__remove-btn i {
  display: block;
  font-size: 14px;
  line-height: 1;
}
.rates-widget__remove-btn:hover { color: #0d6efd; background: rgba(13,110,253,0.08); }
.rates-widget__remove-btn:active { transform: translateY(1px); }

.rates-widget__card-body { margin-top: 2px; display: grid; grid-template-columns: 1fr; gap: 6px; }
.rates-widget__kv { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.rates-widget__kv b { font-weight: 1000; }
.rates-widget__convert-results { display: none; }

.rates-widget__row--toggle { margin-top: 4px; }
.rates-widget__toggle { display: flex; align-items: center; gap: 10px; user-select: none; }
.rates-widget__toggle input { display: none; }
.rates-widget__toggle-ui {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(0,0,0,0.12);
  position: relative;
  flex: 0 0 auto;
}
.rates-widget__toggle-ui::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: transform 180ms ease;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}
.rates-widget__toggle input:checked + .rates-widget__toggle-ui {
  background: rgba(13,110,253,0.75);
}
.rates-widget__toggle input:checked + .rates-widget__toggle-ui::after {
  transform: translateX(18px);
}
.rates-widget__toggle-text { font-weight: 900; }

@media (max-width: 420px) {
  .rates-widget { right: 10px; bottom: 10px; }
  .rates-widget__mini { width: 260px; }
}

