* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  justify-content: center;
  align-items: center;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Noto Sans",
    "Helvetica Neue",
    Arial,
    sans-serif;
}

.app {
  width: 100%;
  padding: 20px;
}

.card {
  max-width: 380px;
  margin: auto;
  background: #ffffff;
  border-radius: 16px;
  content-visibility: auto;
  contain-intrinsic-size: 600px;
  box-shadow: 0 18px 32px rgba(0,0,0,0.22);
  overflow: hidden;
}

.header {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;
  padding: 20px;
  text-align: center;
}

.header h1 {
  margin: 0;
}

.header p {
  font-size: 14px;
  opacity: 0.9;
}

.section {
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

input, select {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 15px;
}

select {
  font-family:
    "Segoe UI Emoji",
    "Apple Color Emoji",
    "Noto Color Emoji",
    system-ui,
    sans-serif;
}

select option {
  font-size: 15px;
}

input:focus,
select:focus,
#swapBtn:focus {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.currency-section.from {
  background: #f0f4ff;
}

.currency-section.to {
  background: #fef3c7;
}

.input-section {
  background: #ecfeff;
}

.swap-inline {
  display: flex;
  justify-content: center;
  margin: -5px 0;
}

#swapBtn {
  background: #22c55e;
  color: white;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 6px 15px rgba(0,0,0,0.2);
  transition: transform 0.4s ease;
  will-change: transform;
}

#swapBtn.rotate {
  transform: rotate(180deg);
}

.result-section {
  background: #fdf2f8;
  text-align: center;
}

#result {
  font-size: 22px;
  font-weight: bold;
  color: #1f2937;
}

.rate-info {
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
}

/* Fullscreen real loader */
#loader {
  position: fixed;
  inset: 0;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 9999;
}

#loader.active {
  opacity: 1;
  pointer-events: all;
}

/* Loader content */
.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  color: #374151;
  font-size: 14px;
}

/* Spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid #e5e7eb;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Fade-in result (used ONLY after converting) */
.result-fade {
  animation: fadeInResult 0.32s ease-out;
}

@keyframes fadeInResult {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Remove number input arrows (Chrome, Edge, Safari) */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Remove number input arrows (Firefox) */
input[type="number"] {
  -moz-appearance: textfield;
}

.app-title {
  font-weight: 700;
  letter-spacing: 0.4px;
}

.app-subtitle {
  opacity: 0.85;
  font-size: 0.95rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
