/* =========================
   VicDex · style.css
   Theme: Dark minimal, clean
   ========================= */

/* ====== CSS Reset (lite) ====== */
* { box-sizing: border-box; }
html, body { height: 100%; }
body,h1,h2,h3,h4,p,ul,ol { margin: 0; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
input, button { outline: none; }

/* ====== Theme ====== */
:root{
  --bg: #0B1020;
  --bg-elev: #10182E;
  --panel: #121A33;
  --panel-2: #0E1630;
  --text: #E6EEFF;
  --text-dim: #AAB4CE;
  --muted: #7E8AAF;
  --primary: #5B8CFF;
  --primary-2: #7CA4FF;
  --accent: #5BFFDA;
  --danger: #FF6B6B;
  --ok: #00D084;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 24px;
}

html, body {
  background: radial-gradient(1200px 800px at 0% -10%, rgba(91,140,255,.15), transparent 60%) no-repeat,
              radial-gradient(1000px 600px at 100% 0%, rgba(91,255,218,.10), transparent 60%) no-repeat,
              var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  line-height: 1.5;
}

/* Links */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Utilities */
.muted { color: var(--text-dim); }
.mini { font-size: 12px; }

/* Container */
.vx-container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

/* ================= Header ================= */
.vx-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(11,16,32, .7);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.header-grid {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  padding: 14px 0;
}

/* Brand */
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-text { display: grid; }
.brand-name { font-weight: 700; letter-spacing: .2px; }
.tagline { font-size: 12px; color: var(--muted); }

/* Nav */
.top-nav { display: flex; gap: 16px; justify-content: center; }
.tab-link {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--text-dim);
  transition: color .15s ease, background .15s ease;
}
.tab-link:hover { color: var(--text); background: rgba(255,255,255,.06); }

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 10px; }
.badge {
  padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--text-dim);
  font-size: 12px; border: 1px solid rgba(255,255,255,.06);
}
.btn {
  padding: 10px 14px; border-radius: 12px; border: 1px solid transparent;
  color: var(--text); background: var(--panel); transition: transform .06s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.btn:hover { background: #172246; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
  border-color: rgba(255,255,255,.08);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.10);
}
#connectBtn.connected { background: rgba(91,255,218,.12); border-color: rgba(91,255,218,.35); color: #CFFFF3; }

/* Burger (mobile) */
.nav-toggle { display:none; }
.burger { display:none; width:36px; height:28px; flex-direction:column; justify-content:space-between; cursor:pointer; }
.burger span{ height:3px; background: #c9d6ff; border-radius: 6px; display:block; }

/* ================= Main ================= */
.vx-main { padding: 32px 0 48px; display: grid; gap: 22px; }

/* Cards/sections */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.view-section { display: none; }
.view-section.visible-by-default { display: block; }
.card-header { margin-bottom: 16px; }
.card-header h2 { font-size: 22px; letter-spacing: .2px; }
.card-header .sub { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

/* Swap layout */
.swap-grid {
  display: grid; grid-template-columns: 1fr 56px 1fr; gap: 12px; align-items: end;
}
.swap-box {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 14px;
}
.token-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.token-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  padding: 8px 12px; border-radius: 999px; color: var(--text);
}
.token-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(91,255,218,.15); }
.chev { width: 16px; height: 16px; opacity: .7; }
.chev path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.amount-input{
  width: 100%; background: #0E1630; border: 1px solid rgba(255,255,255,.10);
  border-radius: 12px; padding: 14px; color: var(--text); font-size: 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.amount-input::placeholder { color: #7c87a8; }
.amount-input:focus { border-color: rgba(91,140,255,.5); box-shadow: 0 0 0 4px rgba(91,140,255,.15); }

/* Remove arrows on number */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
input[type=number]{ -moz-appearance: textfield; }

/* Flip button */
.flip-btn{
  align-self: center;
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(180deg, rgba(91,140,255,.45), rgba(91,140,255,.25));
  border: 1px solid rgba(255,255,255,.12);
  display: grid; place-items: center;
}
.flip-btn svg{ width: 22px; height: 22px; fill:none; stroke:#fff; stroke-width:2; opacity:.9; }

.actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.status { color: var(--text-dim); font-size: 13px; }

/* ================= Picker (token search) ================= */
.picker.hide { display: none; }
.picker{
  position: fixed; inset: 0; z-index: 40; background: rgba(3,6,15,.55);
  backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 16px;
}
.picker-card{
  width: min(520px, 92vw);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.picker-head{ display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.picker-head h3{ font-size: 18px; }
.picker-close{
  width: 32px; height: 32px; border-radius: 8px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); color: #cfd8ff;
}
.picker-search{
  width: 100%; padding: 12px 14px; border-radius: 12px; color: var(--text);
  background: #0E1630; border: 1px solid rgba(255,255,255,.10);
  margin-bottom: 10px;
}
.picker-list{
  list-style: none; padding: 0; margin: 0; max-height: 52vh; overflow: auto;
  border-radius: 12px; border: 1px solid rgba(255,255,255,.08);
}
.picker-item{
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 14px; background: rgba(255,255,255,.02);
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.picker-item:hover{ background: rgba(91,140,255,.08); }
.picker-item .left{ display: flex; align-items: center; gap: 12px; }
.picker-item .dot{ width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.picker-item .info{ display:grid; line-height:1.15; }
.picker-item .muted{ font-size: 12px; }

/* ================= Liquidity ================= */
.subcard{
  background: var(--panel-2);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 12px;
}
.subcard h3{ font-size: 18px; margin-bottom: 10px; }
.two-cols{ display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.liq-box{
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 14px;
}

/* ================= Pools & Positions ================= */
.pool-list{ display: grid; gap: 10px; }
.pool-row, .position-row{
  display: grid; grid-template-columns: 1.2fr 1fr auto; gap: 10px; align-items: center;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.pool-row .left, .position-row .left{ display: flex; align-items: center; gap: 8px; }
.pool-row .mid, .position-row .mid{ color: var(--text-dim); font-size: 14px; }
.pool-row .right, .position-row .right{ text-align: right; }
.position-row .btns{ display: inline-flex; gap: 8px; }
.btn.ghost.rm25, .btn.ghost.rm50, .btn.ghost.rm100 { padding: 8px 10px; font-size: 13px; }

/* ================= Misc ================= */
.note{
  color: var(--text-dim);
  font-size: 13px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius);
  padding: 12px 14px;
}

/* Footer */
.vx-footer{
  border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(11,16,32,.8);
  backdrop-filter: blur(8px);
}
.vx-footer .vx-container{
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding: 16px 0; color: var(--text-dim); font-size: 14px;
}
.vx-footer a { color: var(--text-dim); }
.vx-footer a:hover { color: var(--text); text-decoration: none; }

/* Toast */
.toast{
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: #0E1630; color: #eaf1ff;
  border: 1px solid rgba(255,255,255,.12); border-radius: 12px;
  padding: 10px 14px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease;
  z-index: 60; font-size: 14px;
}
.toast.show{ opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0); }
.toast.ok { border-color: rgba(0,208,132,.4); }
.toast.warn { border-color: rgba(255,214,102,.4); }
.toast.err { border-color: rgba(255,107,107,.45); }

/* ================= Responsive ================= */
@media (max-width: 960px){
  .header-grid{ grid-template-columns: auto auto 1fr; }
  .top-nav{ display: none; }
  .burger{ display:flex; }
  .header-actions{ justify-self: end; }
}

@media (max-width: 780px){
  .swap-grid{ grid-template-columns: 1fr; }
  .flip-btn{ width: 44px; height: 44px; margin: -2px auto; }
  .two-cols{ grid-template-columns: 1fr; }
  .pool-row, .position-row{ grid-template-columns: 1fr; gap: 8px; }
  .pool-row .right, .position-row .right{ text-align: left; }
}

@media (max-width: 420px){
  .btn{ padding: 9px 12px; }
  .amount-input{ padding: 12px; font-size: 16px; }
  .badge{ display: none; }
}

/* ================= Minor polish ================= */
button:disabled, .btn:disabled {
  opacity: .6; cursor: not-allowed; filter: grayscale(.1);
}
input:disabled { opacity: .7; }
.token-btn[disabled]{ opacity: .8; }

/* Focus ring (keyboard) */
:focus-visible {
  outline: 2px solid rgba(91,140,255,.65);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ===== Footer centered + stay at bottom ===== */

/* Biến body thành layout cột để footer đẩy xuống đáy khi nội dung ít */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Phần nội dung chính chiếm hết khoảng trống dọc */
.vx-main {
  flex: 1 0 auto;
}

/* Footer luôn ở cuối trang (không che nội dung) */
.vx-footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* Căn giữa các link trong footer */
.vx-footer .vx-container {
  justify-content: center;   /* căn giữa theo trục ngang */
  text-align: center;
  gap: 16px;                 /* khoảng cách giữa các mục */
}

/* Giữ các item cân hàng đẹp */
.vx-footer .vx-container > a,
.vx-footer .vx-container > span {
  display: inline-flex;
  align-items: center;
}

/* Tối ưu trên mobile */
@media (max-width: 600px){
  .vx-footer .vx-container { gap: 12px; }
}

/* === Mobile nav (hamburger) — fallback cho MetaMask Mobile === */
@media (max-width: 900px){
  .vx-header .vx-container{ position: relative; }
  .burger{ display: flex; }              /* hiện nút 3 gạch */
  .top-nav{
    display: none;                       /* ẩn mặc định */
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    background: var(--panel);
    border-top: 1px solid var(--border);
    padding: 12px;
    gap: 8px;
    flex-direction: column;              /* menu dọc */
    z-index: 30;
  }
  .top-nav a{ padding: 10px 6px; }
  body.nav-open .top-nav{ display: flex; }  /* bật khi bấm 3 gạch */
}

/* Link mở explorer cạnh địa chỉ pool */
.extlink{ margin-left: 6px; font-weight: 600; text-decoration: none; }
.extlink:hover{ text-decoration: underline; }

@media (max-width: 900px){
  #navToggle:checked ~ .top-nav{ display: flex; }
}
