/* =========================================================
   ORION SWAP - SILVER COSMIC (OPTIMIZED & LIGHTWEIGHT)
   ========================================================= */

:root {
  /* Silver & Space Color Palette */
  --bg-body: #02050d;         
  --bg-card: rgba(10, 16, 30, 0.85); /* Solid & ringan di GPU */
  --bg-input: rgba(0, 0, 0, 0.5);    
  
  --primary: #c0c0c0;         
  --primary-glow: rgba(192, 192, 192, 0.4);
  
  --text-main: #e2e8f0;       
  --text-sub: #94a3b8;        
  --border-color: rgba(192, 192, 192, 0.15); 
  
  --danger: #ef4444;
  --success: #10b981;
  
  /* Border Radius */
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

/* =========================
   BASE & BACKGROUND (RINGAN)
========================= */
* { box-sizing: border-box; font-family: 'Inter', sans-serif; }

html {
  overflow: hidden; /* Mencegah scroll di tingkat paling dasar */
}

body {
  /* Bintang Statis di Background langsung (Super Ringan) */
  background-color: var(--bg-body);
  background-image: 
      radial-gradient(1px 1px at 10% 20%, rgba(226, 232, 240, 0.4), transparent),
      radial-gradient(1px 1px at 30% 40%, rgba(192, 192, 192, 0.4), transparent),
      radial-gradient(1.5px 1.5px at 50% 10%, rgba(255, 255, 255, 0.4), transparent),
      radial-gradient(1px 1px at 70% 60%, rgba(148, 163, 184, 0.4), transparent),
      radial-gradient(1.5px 1.5px at 90% 80%, rgba(255, 255, 255, 0.4), transparent);
  background-size: 150px 150px;
  color: var(--text-main);
  margin: 0;
  
  /* KUNCI: Membuat layar FIX dan tidak bisa di-scroll */
  height: 100vh;
  height: 100dvh; /* Mendukung browser mobile modern */
  overflow: hidden;
  
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Layer Bintang Berkelap-kelip (Animasi Opacity ringan) */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: -1;
  pointer-events: none;
  background-image: 
      radial-gradient(2px 2px at 15% 70%, #ffffff, transparent),
      radial-gradient(1.5px 1.5px at 45% 85%, #cbd5e1, transparent),
      radial-gradient(2px 2px at 65% 25%, #e2e8f0, transparent),
      radial-gradient(1px 1px at 85% 55%, #c0c0c0, transparent);
  background-size: 250px 250px;
  animation: twinkleLight 4s infinite alternate;
  will-change: opacity; /* Hardware acceleration */
}

@keyframes twinkleLight {
  0% { opacity: 0.1; }
  100% { opacity: 0.7; }
}

/* =========================
   SWAP BOX
========================= */
.swap-box {
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 24px;
  width: 100%;
  max-width: 460px;
  margin: 20px auto 0 auto; /* Margin disesuaikan agar pas di layar fix */
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  z-index: 10;
}

.swap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.swap-header h2 { font-size: 22px; font-weight: 700; margin: 0; color: #fff; text-shadow: 0 0 10px rgba(255,255,255,0.2); }

/* Tombol Wallet */
.btn-connect-wallet {
  background: rgba(192, 192, 192, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}
.btn-connect-wallet:hover {
  background: rgba(192, 192, 192, 0.15);
  border-color: var(--primary);
}

/* =========================
   FORM FIELDS
========================= */
.field-group {
  background: var(--bg-input);
  padding: 18px;
  border-radius: var(--radius-lg);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.field-group:hover, .field-group:focus-within {
  border-color: rgba(192, 192, 192, 0.3);
}

.field-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 12px;
}
.balance-text {
  color: var(--primary);
  cursor: pointer;
  transition: 0.2s;
  font-weight: 500;
}
.balance-text:hover { color: #fff; }

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.field-row input {
  background: transparent;
  border: none;
  outline: none;
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  width: 100%;
}
.field-row input::placeholder { color: rgba(255, 255, 255, 0.15); }
.field-row input:disabled { color: var(--text-sub); }

/* Switcher Button (Arrow Tengah) */
.flip-container {
  display: flex;
  justify-content: center;
  margin: -16px 0;
  position: relative;
  z-index: 5;
}
.flip-btn {
  background: #0a101e;
  border: 2px solid var(--border-color);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}
.flip-btn:hover {
  transform: rotate(180deg);
  border-color: var(--primary);
  color: #fff;
}

/* =========================
   INFO PANEL
========================= */
.swap-info {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-top: 20px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 8px;
}
.info-row:last-child { margin-bottom: 0; }

/* =========================
   CTA BUTTON (METALLIC SILVER)
========================= */
.cta {
  width: 100%;
  margin-top: 24px;
  padding: 18px;
  font-size: 18px;
  font-weight: 800;
  color: #000; 
  background: linear-gradient(135deg, #f8fafc 0%, #cbd5e1 50%, #94a3b8 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.1s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cta:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.cta:disabled {
  background: rgba(192, 192, 192, 0.1);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
}

/* =========================
   MODALS (TATA LETAK DIPERBAIKI)
========================= */
.modal-overlay {
  position: fixed; 
  top: 0; 
  left: 0; 
  width: 100%; 
  height: 100%;
  background: rgba(2, 5, 13, 0.85);
  display: none; 
  align-items: center; 
  justify-content: center; 
  z-index: 100;
}
.modal-overlay.show { 
  display: flex; 
  animation: modalPop 0.2s ease-out; 
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  width: 90%; 
  max-width: 420px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.9);
  display: flex;
  flex-direction: column; 
  max-height: 85vh; 
}

/* HEADER MODAL */
.modal-top { 
  padding: 24px 24px 16px 24px; 
  border-bottom: 1px solid rgba(255,255,255,0.05); 
}

.modal-title-row { 
  display: flex; 
  justify-content: space-between; 
  align-items: center; 
  margin-bottom: 20px; 
}

.modal-title-row h3 { 
  margin: 0; 
  color: #fff; 
  font-size: 18px; 
  font-weight: 700; 
}

.close-modal-btn { 
  background: none; 
  border: none; 
  color: var(--text-sub); 
  font-size: 28px; 
  line-height: 1;
  cursor: pointer; 
  transition: 0.2s; 
  padding: 0; 
}

.close-modal-btn:hover { color: #fff; }

.search-input {
  width: 100%; 
  padding: 14px 16px; 
  background: var(--bg-input); 
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md); 
  color: var(--text-main); 
  font-size: 15px; 
  outline: none; 
  transition: 0.2s;
  box-sizing: border-box; 
}

.search-input:focus { border-color: var(--primary); }

/* TOKEN LIST INSIDE MODAL (Bisa scroll HANYA di dalam list ini) */
.token-list-container { 
  overflow-y: auto; 
  padding: 12px; 
  flex-grow: 1; 
}

.token-item {
  display: flex; justify-content: space-between; align-items: center; padding: 12px 16px;
  border-radius: var(--radius-md); cursor: pointer; transition: 0.1s;
  border-bottom: 1px solid rgba(255,255,255,0.02);
}
.token-item:hover { background: rgba(192, 192, 192, 0.05); }
.token-item-left { display: flex; align-items: center; }
.token-item-info { display: flex; flex-direction: column; margin-left: 12px; }
.token-symbol { font-weight: 700; font-size: 15px; color: #fff; display: flex; align-items: center; }
.token-name { font-size: 12px; color: var(--text-sub); margin-top: 2px; }

/* =========================
   TOKEN BADGE & PAXI LOGO
========================= */
.token-select-btn {
  background: rgba(192, 192, 192, 0.1);
  border: 1px solid rgba(192, 192, 192, 0.2);
  color: #fff;
  padding: 6px 14px 6px 8px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: 15px;
}
.token-select-btn:hover {
  background: rgba(192, 192, 192, 0.2);
  border-color: var(--primary);
}

.token-static-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #fff;
  padding: 6px 12px;
  font-size: 15px;
}

.paxi-logo-img {
  width: 28px; 
  height: 28px; 
  object-fit: contain; 
}

/* Loading Spinner Modal */
.spinner {
  border: 3px solid rgba(255,255,255,0.05); 
  border-top-color: var(--primary);
  border-radius: 50%; width: 24px; height: 24px; 
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }