:host {
  display: block;
  --fincode-color-primary: #22c55e;
  --fincode-color-primary-dark: #16a34a;
  --fincode-color-accent-soft: #e0f2fe;
  --fincode-color-accent-mid: #bfdbfe;
  --fincode-color-accent-strong: #60a5fa;
  --fincode-color-border: #e5e7eb;
  --fincode-color-text: #111827;
  --fincode-color-muted: #4b5563;
  --fincode-color-bg: #ffffff;
  --fincode-color-soft: #f9fafb;
  --fincode-color-error-bg: #fef2f2;
  --fincode-color-error-text: #b91c1c;
  --fincode-color-error-border: #fecaca;
}

.fincode-widget-container {
  background: var(--fincode-color-bg);
  border-radius: 24px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 560px;
  padding: 32px;
  font-family: Arial, sans-serif;
  box-sizing: border-box;
}

.fincode-widget-container * { box-sizing: border-box; }
.fincode-widget-header { margin-bottom: 28px; }
.fincode-widget-header h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--fincode-color-text);
  margin: 0;
}
.fincode-form-group { margin-bottom: 24px; }
.fincode-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--fincode-color-muted);
  margin-bottom: 8px;
}
.fincode-input-group,
.fincode-amount-currency-group {
  border: 1px solid var(--fincode-color-border);
  border-radius: 12px;
  background: var(--fincode-color-soft);
  display: flex;
  align-items: center;
  overflow: hidden;
}
.fincode-input-group {
  position: relative;
}
.fincode-custom-select {
  overflow: visible;
}
.fincode-input-group:focus-within,
.fincode-amount-currency-group:focus-within {
  border-color: var(--fincode-color-accent-strong);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.14), 0 10px 24px rgba(191, 219, 254, 0.35);
}
.fincode-native-select {
  display: none;
}
.fincode-amount-input-wrapper { flex: 1; }
.fincode-amount-input-wrapper input::placeholder {
  color: #c0c7d2;
}
.fincode-amount-input-wrapper input {
  width: 100%;
  height: 60px;
  border: none;
  padding: 0 20px;
  font-size: 22px;
  font-weight: 700;
  color: var(--fincode-color-text);
  outline: none;
  background: transparent;
}
.fincode-currency-separator { width: 1px; height: 40px; background: #f3f4f6; }
.fincode-currency-select-wrapper {
  width: 136px;
  flex-shrink: 0;
  background: #fafafa;
  position: relative;
}
.fincode-select-trigger {
  width: 100%;
  min-height: 56px;
  border: none;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 0 0;
  font-size: 16px;
  color: #1f2937;
  cursor: pointer;
  text-align: left;
  outline: none;
  box-shadow: none;
}
.fincode-select-trigger:focus,
.fincode-select-trigger:focus-visible {
  outline: none;
  box-shadow: none;
}
.fincode-select-trigger:-moz-focusring {
  outline: none;
  box-shadow: none;
}
.fincode-select-trigger::-moz-focus-inner {
  border: 0;
}
.fincode-currency-select-wrapper .fincode-select-trigger {
  padding-left: 16px;
}
.fincode-select-trigger:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}
.fincode-select-trigger-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fincode-select-chevron {
  color: #94a3b8;
  pointer-events: none;
  font-size: 14px;
  transition: transform 0.2s ease;
}
.fincode-custom-select.is-open .fincode-select-chevron {
  transform: rotate(180deg);
}
.fincode-custom-select.is-open {
  border-color: var(--fincode-color-accent-strong);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.14), 0 12px 28px rgba(191, 219, 254, 0.34);
}
.fincode-custom-select.is-disabled {
  background: #f3f4f6;
  opacity: 0.82;
}
.fincode-select-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 20;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(96, 165, 250, 0.16), 0 10px 24px rgba(15, 23, 42, 0.08);
  padding: 8px;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}
.fincode-currency-select-wrapper .fincode-select-menu {
  right: 0;
  left: auto;
  width: 180px;
}
.fincode-custom-select.is-open .fincode-select-menu {
  display: block;
}
.fincode-select-option {
  width: 100%;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 12px 14px;
  color: #1f2937;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
}
.fincode-select-option:hover,
.fincode-select-option:focus-visible {
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  outline: none;
}
.fincode-select-option.is-selected {
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
  color: #1d4ed8;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(96, 165, 250, 0.22);
}
.fincode-select-option:disabled {
  color: #9ca3af;
  cursor: not-allowed;
}
.fincode-select-option-flag {
  width: 20px;
  height: 20px;
  object-fit: cover;
  border-radius: 9999px;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.08);
  flex-shrink: 0;
}
.fincode-stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0;
}
.fincode-rate-display {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: #1f2937;
  background: #f0fdf4;
  padding: 10px 16px;
  border-radius: 9999px;
  font-weight: 600;
  border: 1px solid #dcfce7;
}
.fincode-live-badge {
  width: 8px;
  height: 8px;
  background: var(--fincode-color-primary);
  border-radius: 50%;
  display: inline-block;
}
.fincode-submit-btn {
  width: 100%;
  height: 60px;
  background: var(--fincode-button-color, linear-gradient(135deg, var(--fincode-color-primary) 0%, var(--fincode-color-primary-dark) 100%));
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}
.fincode-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; }
.fincode-error-msg {
  background: var(--fincode-color-error-bg);
  color: var(--fincode-color-error-text);
  font-size: 13px;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: none;
  border: 1px solid var(--fincode-color-error-border);
}
.fincode-loader {
  border: 2px solid #e5e7eb;
  border-top: 2px solid var(--fincode-color-primary);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  animation: fincode-spin 0.8s linear infinite;
  display: inline-block;
}
.fincode-icon-wrapper {
  min-width: 56px;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
}
.fincode-flag-image {
  width: 24px;
  height: 24px;
  object-fit: cover;
  border-radius: 9999px;
  box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.08);
}
.fincode-summary {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid var(--fincode-color-border);
  border-radius: 12px;
  background: #fff;
}
.fincode-label + .fincode-amount-currency-group {
  margin-bottom: 24px;
}
.fincode-summary-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
}
.fincode-summary-grid dt {
  margin: 0;
  color: var(--fincode-color-muted);
  font-size: 14px;
}
.fincode-summary-grid dd {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--fincode-color-text);
  text-align: right;
}
@keyframes fincode-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@media (max-width: 640px) {
  .fincode-widget-container { padding: 20px; }
  .fincode-currency-select-wrapper {
    width: 128px;
  }
  .fincode-currency-select-wrapper .fincode-select-menu {
    width: 156px;
  }
}
