/* ── Glass Card — từ template: rgba(16,18,27,0.4), blur(20px), radius 14px ── */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); /* 14px như template */
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition:
    box-shadow var(--transition-base),
    border-color var(--transition-base),
    background var(--transition-base),
    transform var(--transition-base);
}
/* Template: hover scale(1.02) cho cards */
.glass-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--border-glow);
  transform: scale(1.01);
}

/* ── Theme Toggle — dark-light2 glassmorphism slider ───────────── */
.theme-toggle-label {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 23px;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

/* Slider track */
.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 34px;
  overflow: hidden;
  transition: all 1.0s ease;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 0 12px rgba(255, 255, 255, 0.18),
    0 0 25px rgba(200, 220, 255, 0.4);
  z-index: 1;
}

/* Hover / focus glow */
.slider:hover,
.theme-toggle-input:focus-visible + .slider {
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.35),
    inset 0 0 16px rgba(255, 255, 255, 0.25),
    0 0 40px rgba(200, 220, 255, 0.6);
  transform: scale(1.03);
  transition: all 0.3s ease;
}

/* Dark (night) mode track — checked = dark */
[data-theme="dark"] .slider {
  background: rgba(20, 20, 60, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    inset 0 0 16px rgba(200, 220, 255, 0.18),
    0 0 35px rgba(100, 150, 255, 0.7);
}

/* Light (day) mode track — unchecked = light */
[data-theme="light"] .slider {
  background: linear-gradient(135deg, rgba(135, 206, 235, 0.22), rgba(70, 130, 180, 0.15));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.15),
    inset 0 0 12px rgba(255, 255, 255, 0.3),
    0 0 25px rgba(135, 206, 235, 0.4);
}

/* Sun/Moon knob */
.slider::before {
  position: absolute;
  content: "";
  height: 17px;
  width: 17px;
  left: 3px;
  bottom: 3px;
  background-color: rgba(255, 215, 0, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transition: all 1.0s ease;
  border-radius: 50%;
  box-shadow:
    inset 0 -3px 8px rgba(150, 100, 0, 0.5),
    0 6px 20px rgba(0, 0, 0, 0.4),
    0 0 30px rgba(255, 215, 0, 0.9),
    0 0 50px rgba(255, 215, 0, 0.5);
}

/* Moon knob — checked = dark mode, knob moves right */
.theme-toggle-input:checked + .slider::before {
  transform: translateX(calc(100% + 12px));
  background: rgba(220, 220, 230, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow:
    inset 0 -3px 8px rgba(80, 80, 120, 0.6),
    0 6px 20px rgba(0, 0, 0, 0.5),
    0 0 35px rgba(200, 220, 255, 0.9),
    0 0 55px rgba(200, 220, 255, 0.6);
}

/* Moon craters — visible in dark (checked) mode */
.slider::after {
  content: "";
  position: absolute;
  background: #535370;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  bottom: 65%;
  right: 16%;
  box-shadow: -5px 5px 0 2px #535370, 1px 7px 0 #535370;
  transition: all 1.0s ease;
  transform: scale(0) rotate(360deg);
  filter: saturate(0.75);
}
.theme-toggle-input:checked + .slider::after {
  transform: scale(1) rotate(-24deg);
}

/* Cloud (day) */
.slider .bg-cloud {
  position: absolute;
  width: 7px;
  height: 7px;
  background: #fff;
  border-radius: 50%;
  bottom: 0;
  right: 0;
  box-shadow:
    0 -7px 0 5px #fff,
    -7px 0 0 5px #fff,
    -30px 3px 0 3px #fff,
    -40px 0 0 2px #fff,
    -20px 1px 0 5px #fff;
  transition: all 1.0s ease;
}
.theme-toggle-input:checked + .slider .bg-cloud {
  transform: translateY(180%);
  opacity: 0;
}

/* Stars (night) */
.slider .star {
  position: absolute;
  transform: scale(0);
  transition: all 1.0s ease;
}
.theme-toggle-input:checked + .slider .star {
  width: 0;
  height: 0;
  border: 7px solid transparent;
  border-bottom: 5px solid #fff;
  border-top: none;
  margin: 3px 0;
  transform: scale(0.3) translate(50%);
}
.theme-toggle-input:checked + .slider .star:last-child {
  transform: scale(0.4) translate(225%, 300%);
}
.theme-toggle-input:checked + .slider .star::before,
.theme-toggle-input:checked + .slider .star::after {
  content: "";
  position: absolute;
  width: 0;
  height: 0;
  border-top: none;
}
.theme-toggle-input:checked + .slider .star::before {
  border: 2px solid transparent;
  border-bottom: 6px solid #fff;
  transform: rotate(35deg);
  top: -5px;
  left: 1px;
}
.theme-toggle-input:checked + .slider .star::after {
  border: 7px solid transparent;
  border-bottom: 5px solid #fff;
  transform: rotate(70deg);
  top: -5px;
  left: -3px;
}

/* Accessibility ring */
.theme-toggle-input:focus-visible + .slider {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(255, 215, 0, 0.6),
    0 0 0 6px rgba(255, 215, 0, 0.3);
}

/* ── Wallet Input ──────────────────────────────────────────────── */
.wallet-form { width: 100%; }

.input-group {
  display: flex;
  gap: var(--space-2);
  align-items: stretch;
}

.input-wrap {
  position: relative;
  flex: 1;
}
.input-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--inactive-color);
  pointer-events: none;
  display: block;
}
.wallet-input {
  width: 100%;
  height: 42px;
  padding: 0 var(--space-4) 0 44px;
  /* Template: search-bar style */
  background: var(--bg-input);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 0 0 2px rgba(134, 140, 160, 0.02);
  outline: none;
  transition: all var(--transition-fast);
}
.wallet-input::placeholder {
  color: var(--inactive-color);
  font-family: var(--font-sans);
  font-weight: 500;
}
.wallet-input:focus {
  background: var(--bg-input-focus);
  box-shadow: 0 0 0 1px var(--border-color);
}

/* Search button — pill shape như template: border-radius 20px */
.search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-6);
  height: 42px;
  background: #3a6df0; /* Màu accent từ template */
  color: #fff;
  border: none;
  border-radius: var(--radius-xl); /* 20px pill như template */
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-width: 110px;
}
.search-btn:hover:not(:disabled) {
  background: #1e59f1; /* Template hover color */
  transform: translateY(-1px);
}
.search-btn:active:not(:disabled) { transform: translateY(0); }
.search-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-text {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.input-error {
  color: var(--accent-red);
  font-size: var(--text-xs);
  margin-top: var(--space-2);
  text-align: left;
  padding-left: 44px;
}

/* ── Total USD Badge ───────────────────────────────────────────── */
.total-badge {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

/* ── Badge ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all var(--transition-fast);
}
.badge-neutral   { background: var(--badge-neutral-bg);   color: var(--accent-blue); }
.badge-in-range  { background: var(--badge-in-range-bg);  color: var(--accent-green); }
.badge-out-range { background: var(--badge-out-range-bg); color: var(--accent-red); }

.badge-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ── Token Chip ────────────────────────────────────────────────── */
.token-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--badge-neutral-bg);
  color: var(--accent-blue);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ── Data Table — template list style: padding 10px 18px, hover với radius ── */
.data-table {
  width: 100%;
  font-size: 15px;
  border-spacing: 0;
}
.data-table th {
  color: var(--inactive-color);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-2) var(--space-3) 0;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}
.data-table th.num,
.data-table td.num { text-align: right; }
.data-table td {
  padding: 10px 18px; /* Template: li padding 10px 18px */
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}
.data-table tbody tr:last-child td { border-bottom: none; }

/* Template: hover background, border-radius trên first/last child */
.data-table tbody tr:hover td {
  background: var(--table-hover);
}
.data-table tbody tr:hover td:first-child {
  border-radius: 6px 0 0 6px;
}
.data-table tbody tr:hover td:last-child {
  border-radius: 0 6px 6px 0;
}
.data-table tbody tr:last-child:hover td:first-child {
  border-radius: 0 0 0 6px;
}
.data-table tbody tr:last-child:hover td:last-child {
  border-radius: 0 0 6px 0;
}

/* Overview table token column */
.overview-table td:first-child { font-family: var(--font-sans); font-weight: 600; }

/* ── Position Card ─────────────────────────────────────────────── */
.position-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  cursor: default;
}

.position-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.pool-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.bundle-tag {
  font-size: var(--text-xs);
  color: var(--accent-purple);
  background: rgba(199, 93, 235, 0.1);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-weight: 600;
}

.tick-range {
  font-size: var(--text-xs);
  color: var(--inactive-color);
  font-family: var(--font-mono);
}
.tick-current {
  color: var(--accent-blue);
  margin-left: var(--space-2);
}

.token-amounts {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--content-bg); /* Template: content-bg */
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}
.amount-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 14px;
  padding: 4px 0;
  transition: background var(--transition-fast);
}
.amount-row .token-chip { flex-shrink: 0; }
.amount-row span:nth-child(2) {
  flex: 1;
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.amount-row .muted { color: var(--inactive-color); font-size: var(--text-xs); }

.fees-row {
  padding: var(--space-2) var(--space-3);
  background: rgba(248, 206, 82, 0.06);
  border: 1px solid rgba(248, 206, 82, 0.15);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  color: var(--text-secondary);
}
.fees-row .label {
  font-weight: 700;
  color: var(--accent-yellow);
  display: block;
  margin-bottom: var(--space-1);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.fees-row span { display: block; font-family: var(--font-mono); }

/* ── Health Indicator ──────────────────────────────────────────── */
.health-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-family: var(--font-mono);
}
.health-good    { background: rgba(59, 240, 131, 0.12);  color: var(--health-good); }
.health-warning { background: rgba(248, 206, 82, 0.12);  color: var(--health-warning); }
.health-danger  { background: rgba(249, 96, 87, 0.12);   color: var(--health-danger); }
.health-infinity { background: var(--badge-neutral-bg); color: var(--accent-blue); }

.health-summary {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--inactive-color);
  font-family: var(--font-mono);
}
.health-bar {
  height: 4px;
  background: var(--health-bar-bg);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.health-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.health-bar-fill.health-good    { background: var(--health-good); }
.health-bar-fill.health-warning { background: var(--health-warning); }
.health-bar-fill.health-danger  { background: var(--health-danger); }
.health-bar-fill.health-infinity { background: var(--accent-blue); }

.account-addr {
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--inactive-color);
}

.sub-table-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--inactive-color);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-2) var(--space-3) 2px;
}
.sub-table { margin-bottom: var(--space-2); }

/* ── DApp Card ─────────────────────────────────────────────────── */
.dapp-card { gap: var(--space-4); }
.dapp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.dapp-name {
  display: block;
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.dapp-subtitle {
  display: block;
  font-size: var(--text-xs);
  color: var(--inactive-color);
  margin-top: 2px;
  font-weight: 400;
}
.dapp-total {
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-primary);
  text-align: right;
}
.dapp-breakdown-rows {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--content-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  overflow: hidden;
}
.dapp-row {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  gap: var(--space-2);
  align-items: center;
  font-size: 14px;
  padding: 10px 18px; /* Template: li padding */
  border-bottom: 1px solid var(--border-color);
  transition: background var(--transition-fast);
}
.dapp-row:last-child { border-bottom: none; }
/* Template: hover dengan border-radius untuk first/last */
.dapp-row:hover { background: var(--hover-menu-bg); }
.dapp-row:first-child:hover { border-radius: var(--radius-md) var(--radius-md) 0 0; }
.dapp-row:last-child:hover  { border-radius: 0 0 var(--radius-md) var(--radius-md); }
.dapp-row span:first-child {
  color: var(--inactive-color);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dapp-row span:nth-child(2) { font-family: var(--font-mono); color: var(--text-primary); }
.dapp-row span:nth-child(3) { font-family: var(--font-mono); color: var(--inactive-color); text-align: right; }

/* ── Prices Grid ───────────────────────────────────────────────── */
.prices-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px; /* Template: li padding */
  background: var(--content-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: default;
  transition: all var(--transition-fast);
}
.price-row:hover {
  background: var(--hover-menu-bg);
}
.price-value {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-green);
}

/* ── Empty state ───────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  color: var(--inactive-color);
  font-size: 15px;
  padding: var(--space-8);
  font-weight: 400;
}

/* ── Muted text ────────────────────────────────────────────────── */
.muted { color: var(--inactive-color); }

/* ── Skeleton loader — shimmer ─────────────────────────────────── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--content-bg) 25%,
    var(--bg-card-hover) 50%,
    var(--content-bg) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius-md);
}

/* ── Spinner ───────────────────────────────────────────────────── */
.btn-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
.btn-spinner[hidden] { display: none; }

/* ── Section content padding ───────────────────────────────────── */
.section-content { padding: var(--space-4); }

/* ── Status circle (from template) ────────────────────────────── */
.status-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-blue);
}
.status-dot.green { background: var(--accent-green); }
