/* ============================================================
   Currency Switcher Widget — Styles
   ============================================================ */

/* --- Trigger button --- */
.currency-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #1a1a2e;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1;
}

.currency-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.currency-trigger:focus-visible {
  outline: 2px solid #4a6cf7;
  outline-offset: 2px;
}

.currency-trigger .trigger-flag {
  font-size: 18px;
  line-height: 1;
}

.currency-trigger .trigger-code {
  letter-spacing: 0.02em;
}

.currency-trigger .trigger-arrow {
  margin-left: 4px;
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.25s ease;
}

.currency-trigger[aria-expanded="true"] .trigger-arrow {
  transform: rotate(180deg);
}

/* --- Dropdown panel --- */
.currency-dropdown {
  position: fixed;
  bottom: 76px;
  right: 24px;
  z-index: 9998;
  width: 320px;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom right;
  transition: opacity 0.2s ease, transform 0.25s ease, visibility 0.2s ease;
}

.currency-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.currency-dropdown::-webkit-scrollbar {
  width: 6px;
}

.currency-dropdown::-webkit-scrollbar-track {
  background: transparent;
}

.currency-dropdown::-webkit-scrollbar-thumb {
  background: #d0d5dd;
  border-radius: 3px;
}

/* --- Currency row --- */
.currency-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-align: left;
  transition: background 0.15s ease;
}

.currency-option:hover,
.currency-option:focus-visible {
  background: #f5f7ff;
  outline: none;
}

.currency-option:not(:last-child) {
  border-bottom: 1px solid #f0f2f5;
}

.currency-option .opt-flag {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}

.currency-option .opt-code {
  font-weight: 600;
  color: #1a1a2e;
  min-width: 36px;
}

.currency-option .opt-name {
  color: #8c8fa3;
  font-size: 13px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.currency-option .opt-check {
  color: #22c55e;
  font-size: 16px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.currency-option.active .opt-check {
  opacity: 1;
}

.currency-option.active {
  background: #f0f4ff;
}

/* --- Toast notification --- */
.currency-toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  z-index: 99999;
  padding: 10px 24px;
  background: #22c55e;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  border-radius: 50px;
  box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.currency-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Overlay for closing on outside click --- */
.currency-overlay {
  position: fixed;
  inset: 0;
  z-index: 9997;
  background: transparent;
}

/* --- Standalone converter widget --- */
.currency-converter {
  max-width: 420px;
  padding: 24px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.currency-converter h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
}

.currency-converter .conv-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  align-items: flex-end;
}

.currency-converter .conv-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.currency-converter .conv-group label {
  font-size: 12px;
  font-weight: 600;
  color: #8c8fa3;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.currency-converter .conv-group input,
.currency-converter .conv-group select {
  width: 100%;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  background: #fff;
  color: #1a1a2e;
  font-family: inherit;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.currency-converter .conv-group input:focus,
.currency-converter .conv-group select:focus {
  outline: none;
  border-color: #4a6cf7;
  box-shadow: 0 0 0 3px rgba(74, 108, 247, 0.1);
}

.currency-converter .conv-btn {
  padding: 8px 20px;
  background: #1a1a2e;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s ease;
  white-space: nowrap;
  height: 40px;
  align-self: flex-end;
}

.currency-converter .conv-btn:hover {
  background: #2d2d5e;
}

.currency-converter .conv-result {
  margin-top: 12px;
  padding: 12px 16px;
  background: #f5f7ff;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #1a1a2e;
  text-align: center;
  display: none;
}

.currency-converter .conv-result.show {
  display: block;
}

/* --- Mobile responsive --- */
@media (max-width: 640px) {
  .currency-trigger {
    bottom: 16px;
    right: 16px;
    padding: 8px 16px;
    font-size: 13px;
  }

  .currency-dropdown {
    bottom: 64px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: 260px;
  }

  .currency-dropdown.open {
    transform-origin: bottom center;
  }

  .currency-converter {
    max-width: 100%;
  }

  .currency-converter .conv-row {
    flex-direction: column;
    gap: 8px;
  }
}
