/* ==========================================================
   SidraDex Swap Page — Mobile-First Responsive CSS
   ========================================================== */

/* ---- Reset & base ---- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden; /* stops sideways scroll from any overflowing element */
  -webkit-text-size-adjust: 100%; /* stops iOS auto-zooming text */
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #0a0a0a;
  color: #fff;
  min-height: 100vh;
  min-height: 100dvh; /* handles mobile browser UI bars correctly */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---- Page container ---- */
.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  width: 100%;
}

/* ---- Swap card ---- */
.swap-card {
  width: 100%;
  max-width: 420px;       /* desktop cap */
  background: #151515;
  border-radius: 20px;
  padding: 20px;
  margin: 0 auto;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
}

.swap-card h1,
.swap-card h2 {
  font-size: clamp(1.1rem, 4vw, 1.4rem);
  margin: 0 0 16px;
  text-align: center;
}

/* ---- Token input rows ---- */
.token-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #1e1e1e;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

/* Amount input — 16px font is REQUIRED to stop iOS Safari auto-zoom on focus */
.token-row input[type="number"],
.token-row input[type="text"] {
  flex: 1 1 auto;
  min-width: 0;           /* allows input to shrink instead of overflowing */
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 16px;
  width: 100%;
  padding: 4px 0;
}

.token-row input::-webkit-outer-spin-button,
.token-row input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Token selector button */
.token-select {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #2a2a2a;
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  min-height: 40px;       /* touch target */
  color: #fff;
  font-size: 14px;
  white-space: nowrap;
  flex-shrink: 0;
}

.token-select img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

/* ---- Swap direction icon (between the two token rows) ---- */
.swap-direction {
  display: flex;
  justify-content: center;
  margin: -6px 0;
  z-index: 2;
  position: relative;
}

.swap-direction button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #2a2a2a;
  border: 3px solid #151515;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---- Rate / fee info ---- */
.swap-info {
  font-size: 13px;
  color: #999;
  display: flex;
  justify-content: space-between;
  padding: 10px 2px;
  flex-wrap: wrap;
  gap: 4px;
}

/* ---- Primary action button ---- */
.swap-btn {
  width: 100%;
  min-height: 52px;       /* comfortably above the 44px min touch target */
  border: none;
  border-radius: 14px;
  background: #4f46e5;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin-top: 12px;
  cursor: pointer;
}

.swap-btn:disabled {
  background: #333;
  color: #777;
}

.swap-btn:active {
  transform: scale(0.98);
}

/* ---- Wallet connect button (usually in header) ---- */
.wallet-btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 14px;
  white-space: nowrap;
}

/* ---- Header ---- */
.site-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.site-header .logo {
  height: 28px;
}

/* ---- FAQ / HowTo text sections below the swap card ---- */
.info-section {
  width: 100%;
  max-width: 420px;
  margin: 24px auto 0;
  font-size: 14px;
  line-height: 1.6;
  color: #ccc;
}

.info-section h2,
.info-section h3 {
  font-size: 16px;
  color: #fff;
}

/* ==========================================================
   Breakpoints
   ========================================================== */

/* Small phones */
@media (max-width: 380px) {
  .swap-card { padding: 14px; border-radius: 16px; }
  .token-select span { display: none; } /* show icon only, hide token name text if too tight */
}

/* Tablets and up */
@media (min-width: 640px) {
  .page { padding: 32px; }
  .swap-card { padding: 28px; }
}

/* Desktop */
@media (min-width: 1024px) {
  .swap-card { max-width: 460px; }
}

/* Landscape phones — keep card from being too tall / cramped */
@media (max-height: 480px) and (orientation: landscape) {
  .page { padding: 8px; }
  .swap-card { padding: 12px; }
}