/* ============================================================
 * My Wallet — modern My Account styling (CSS only, no HTML changes)
 * Covers: balance hero, transactions table, pagination,
 * wallet navigation, add-fund card.
 * ============================================================ */

/* Design tokens scoped to My Account so other pages stay untouched */
.woocommerce-account .woocommerce-MyAccount-content {
  --w-bg: #ffffff;
  --w-ink: #0f172a;
  --w-muted: #64748b;
  --w-line: #e6eaf2;
  --w-soft: #f4f6fb;
  --w-brand-1: #4f46e5;
  --w-brand-2: #7c3aed;
  --w-green: #067647;
  --w-green-bg: #dcfae6;
  --w-red: #b42318;
  --w-red-bg: #fee4e2;
  --w-amber: #b45309;
  --w-amber-bg: #fef3c7;
  --w-blue: #1d4ed8;
  --w-blue-bg: #dbeafe;
  --w-radius: 16px;
  --w-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 12px 32px -12px rgba(79, 70, 229, 0.22);
  --w-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-family: var(--w-font);
  color: var(--w-ink);
}

/* ---------- Headings (scoped, CSS-only) ---------- */
.woocommerce-account .woocommerce-MyAccount-content h2:has(+ .wallet-balance) {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--w-ink);
}
.woocommerce-account .woocommerce-MyAccount-content .wallet-balance + h3 {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--w-muted);
  margin: 26px 0 12px;
}

/* ---------- Balance hero card ---------- */
.woocommerce-account .woocommerce-MyAccount-content p.wallet-balance {
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 22px 22px 20px;
  border-radius: var(--w-radius);
  color: #fff;
  background: linear-gradient(120deg, var(--w-brand-1) 0%, var(--w-brand-2) 60%, #a855f7 100%);
  box-shadow: var(--w-shadow);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  display: inline-block;
}
.woocommerce-account .woocommerce-MyAccount-content p.wallet-balance::before,
.woocommerce-account .woocommerce-MyAccount-content p.wallet-balance::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.woocommerce-account .woocommerce-MyAccount-content p.wallet-balance::before {
  width: 220px;
  height: 220px;
  right: -70px;
  top: -110px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0) 65%);
}
.woocommerce-account .woocommerce-MyAccount-content p.wallet-balance::after {
  width: 160px;
  height: 160px;
  right: 70px;
  bottom: -110px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0) 65%);
}
.woocommerce-account .woocommerce-MyAccount-content p.wallet-balance .woocommerce-Price-amount,
.woocommerce-account .woocommerce-MyAccount-content p.wallet-balance bdi {
  display: block;
  margin-top: 6px;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* ---------- Transactions table ---------- */
.woocommerce-account .woocommerce-MyAccount-content table.wallet-transactions {
  width: 100%;
  margin: 0 0 22px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--w-bg);
  border: 1px solid var(--w-line);
  border-radius: var(--w-radius);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  font-size: 14px;
}
.wallet-transactions thead th {
  background: var(--w-soft);
  color: var(--w-muted);
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  padding: 13px 16px;
  border-bottom: 1px solid var(--w-line);
  white-space: nowrap;
}
.wallet-transactions tbody td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--w-line);
  color: #1e293b;
  line-height: 1.5;
}
.wallet-transactions tbody tr:last-child td {
  border-bottom: none;
}
.wallet-transactions tbody tr {
  transition: background-color 0.15s ease;
}
.wallet-transactions tbody tr:hover {
  background-color: #f8faff;
}
/* Row accent edge (keeps old .credit/.debit/.cashback classes, modernizes them) */
.wallet-transactions tbody tr.credit td:first-child {
  box-shadow: inset 3px 0 0 #12b76a;
}
.wallet-transactions tbody tr.debit td:first-child {
  box-shadow: inset 3px 0 0 #f04438;
}
.wallet-transactions tbody tr.cashback td:first-child {
  box-shadow: inset 3px 0 0 var(--w-brand-1);
}
.wallet-transactions .credit {
  background-color: rgba(18, 183, 106, 0.05);
}
.wallet-transactions .debit {
  background-color: rgba(240, 68, 56, 0.04);
}
.wallet-transactions .cashback {
  background-color: rgba(79, 70, 229, 0.05);
}

/* Type column: dot + strong label, no HTML change */
.wallet-transactions tbody td:nth-child(2) {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
}
.wallet-transactions tbody td:nth-child(2)::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: 1px;
  background: currentColor;
}
.wallet-transactions tr.credit td:nth-child(2) {
  color: var(--w-green);
}
.wallet-transactions tr.debit td:nth-child(2) {
  color: var(--w-red);
}
.wallet-transactions tr.cashback td:nth-child(2) {
  color: var(--w-brand-1);
}

/* Amount column: tabular numerals, sign prefix, tone per type */
.wallet-transactions tbody td:nth-child(3) {
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.wallet-transactions tr.credit td:nth-child(3) {
  color: var(--w-green);
}
.wallet-transactions tr.credit td:nth-child(3)::before {
  content: "+ ";
  font-weight: 800;
}
.wallet-transactions tr.debit td:nth-child(3) {
  color: var(--w-red);
}
.wallet-transactions tr.debit td:nth-child(3)::before {
  content: "\2212  ";
  font-weight: 800;
}
.wallet-transactions tr.cashback td:nth-child(3) {
  color: var(--w-brand-1);
}
.wallet-transactions td:nth-child(3) small {
  display: block;
  font-weight: 500;
  font-size: 12px;
  color: var(--w-muted);
}

/* Date + description columns */
.wallet-transactions tbody td:nth-child(1) {
  white-space: nowrap;
  color: #334155;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.wallet-transactions tbody td:nth-child(4) {
  color: #475569;
  min-width: 180px;
}

/* Expiry pills (same class names, modern badge look) */
.wallet-transactions .expired,
.wallet-transactions .expires-today,
.wallet-transactions .expiring-soon,
.wallet-transactions .valid {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.wallet-transactions .expired {
  color: var(--w-red);
  background: var(--w-red-bg);
  border-color: #fecdc9;
}
.wallet-transactions .expires-today,
.wallet-transactions .expiring-soon {
  color: var(--w-amber);
  background: var(--w-amber-bg);
  border-color: #fde68a;
}
.wallet-transactions .valid {
  color: var(--w-green);
  background: var(--w-green-bg);
  border-color: #a6f4c5;
}
.wallet-transactions td:nth-child(5) {
  white-space: nowrap;
}

/* Empty state */
.woocommerce-account .woocommerce-MyAccount-content .wallet-balance + p:not(.wallet-balance) {
  margin: 14px 2px 0;
  padding: 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--w-muted);
  text-align: center;
  font-size: 14px;
}

/* ---------- Pagination ---------- */
.woocommerce-account .woocommerce-MyAccount-content .tablenav {
  margin: 4px 0 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}
.woocommerce-account .woocommerce-MyAccount-content .tablenav-pages {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.woocommerce-account .woocommerce-MyAccount-content .displaying-num {
  font-size: 13px;
  color: var(--w-muted);
  margin-right: 6px;
}
.woocommerce-account .woocommerce-MyAccount-content .pagination-container {
  display: flex;
}
.woocommerce-account .woocommerce-MyAccount-content ul.pagination {
  display: flex;
  flex-wrap: wrap;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 6px;
}
.woocommerce-account .woocommerce-MyAccount-content .pagination .page-item {
  display: inline-block;
  margin: 0;
}
.woocommerce-account .woocommerce-MyAccount-content .pagination .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  min-height: 36px;
  padding: 6px 12px;
  color: #334155;
  background: #fff;
  border: 1px solid var(--w-line);
  border-radius: 10px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: transform 0.12s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.woocommerce-account .woocommerce-MyAccount-content .pagination a.page-link:hover,
.woocommerce-account .woocommerce-MyAccount-content .pagination a.page-link:focus-visible {
  border-color: var(--w-brand-1);
  color: var(--w-brand-1);
  background: #eef2ff;
  outline: none;
  transform: translateY(-1px);
}
.woocommerce-account .woocommerce-MyAccount-content .pagination .page-item.active .page-link {
  background: linear-gradient(120deg, var(--w-brand-1), var(--w-brand-2));
  color: #fff;
  border-color: transparent;
  cursor: default;
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.6);
}
.woocommerce-account .woocommerce-MyAccount-content .pagination .page-item.disabled .page-link {
  color: #a3aec2;
  background: #f3f5f9;
  border-color: #e9edf3;
  cursor: not-allowed;
  box-shadow: none;
}

/* ---------- Wallet navigation (segmented control) ---------- */
.wallet-navigation-container {
  margin-bottom: 22px;
  width: 100%;
}
.wallet-navigation {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--w-soft, #f4f6fb);
  background-color: #eef1f7;
  border-radius: 14px;
  box-shadow: none;
  overflow: hidden;
  border: 1px solid var(--w-line, #e6eaf2);
  padding: 6px;
}
.wallet-navigation .nav-item {
  flex: 1 1 auto;
  position: relative;
  border-radius: 10px;
  transition: background-color 0.2s ease;
}
.wallet-navigation .nav-item a {
  display: block;
  padding: 12px 18px;
  color: #475569;
  text-decoration: none !important;
  font-weight: 700;
  font-size: 14px;
  transition: color 0.2s ease;
  position: relative;
  text-align: center;
  border-radius: 10px;
}
.wallet-navigation .nav-item:not(:last-child)::after {
  display: none;
}
.wallet-navigation .nav-item:hover {
  background-color: #e2e8f0;
}
.wallet-navigation .nav-item:hover a {
  color: #0f172a;
}
.wallet-navigation .nav-item.active {
  background: linear-gradient(120deg, var(--w-brand-1, #4f46e5), var(--w-brand-2, #7c3aed));
  box-shadow: 0 6px 16px -6px rgba(79, 70, 229, 0.6);
}
.wallet-navigation .nav-item.active a {
  color: #fff;
}
.wallet-navigation .nav-item.active::after {
  display: none;
}
.wallet-navigation .nav-text {
  position: relative;
}
.wallet-navigation .nav-item.active .nav-text::after {
  display: none;
}

/* ---------- Add-fund card ---------- */
.woocommerce-account .woocommerce-MyAccount-content .pisol-wallet-add-fund-container {
  position: relative;
  max-width: 560px;
  margin: 4px auto 0;
  padding: 28px 28px 26px;
  background: #fff;
  border: 1px solid var(--w-line);
  border-radius: 20px;
  box-shadow: var(--w-shadow);
  overflow: hidden;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-wallet-add-fund-container::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--w-brand-1), var(--w-brand-2), #a855f7);
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-wallet-title {
  text-align: left;
  margin: 2px 0 6px;
  color: var(--w-ink);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-add-fund-form::before {
  content: "Funds are added as wallet credit after checkout.";
  display: block;
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--w-muted);
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field {
  margin-bottom: 18px;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 13.5px;
  color: #1e293b;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field label .required {
  color: #e11d48;
  font-weight: 800;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field input {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #dbe1ec;
  border-radius: 12px;
  box-sizing: border-box;
  font-size: 17px;
  font-weight: 700;
  color: var(--w-ink);
  background: #fbfcff;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  -moz-appearance: textfield;
  appearance: textfield;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field input::-webkit-outer-spin-button,
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field input::placeholder {
  color: #9aa5b8;
  font-weight: 500;
  font-size: 15px;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field input:hover {
  border-color: #b9c2d6;
  background: #fff;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field input:focus {
  outline: none;
  border-color: var(--w-brand-1);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-submit {
  text-align: center;
  margin-top: 6px;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-submit button.button,
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-submit button {
  width: 100%;
  appearance: none;
  background: linear-gradient(120deg, var(--w-brand-1), var(--w-brand-2));
  color: #fff;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 10px 22px -8px rgba(79, 70, 229, 0.65);
  transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-submit button:hover {
  filter: brightness(1.05);
  background: linear-gradient(120deg, var(--w-brand-1), var(--w-brand-2));
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -8px rgba(79, 70, 229, 0.7);
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-submit button:active {
  transform: translateY(0);
  box-shadow: 0 6px 14px -8px rgba(79, 70, 229, 0.6);
}
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-submit button:focus-visible,
.woocommerce-account .woocommerce-MyAccount-content .pisol-form-field input:focus-visible,
.woocommerce-account .woocommerce-MyAccount-content .pagination a.page-link:focus-visible {
  outline: 2px solid var(--w-brand-1);
  outline-offset: 2px;
}

/* ---------- Responsive: transactions become cards ---------- */
@media (max-width: 720px) {
  .woocommerce-account .woocommerce-MyAccount-content table.wallet-transactions {
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
  }
  .wallet-transactions thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .wallet-transactions,
  .wallet-transactions tbody {
    display: block;
  }
  .wallet-transactions tbody tr {
    display: block;
    background: #fff;
    border: 1px solid var(--w-line, #e6eaf2);
    border-radius: 14px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
  }
  .wallet-transactions tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 14px;
    border-bottom: 1px solid #eef1f6;
    font-size: 13.5px;
  }
  .wallet-transactions tbody tr:last-child td,
  .wallet-transactions tbody td:last-child {
    border-bottom: none;
  }
  .wallet-transactions tbody td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: #8a94a8;
  }
  .wallet-transactions tbody td:nth-child(1)::before {
    content: "Date";
  }
  .wallet-transactions tbody td:nth-child(2)::before {
    content: "Type";
  }
  .wallet-transactions tbody td:nth-child(3)::before {
    content: "Amount";
  }
  .wallet-transactions tbody td:nth-child(4) {
    align-items: flex-start;
  }
  .wallet-transactions tbody td:nth-child(4)::before {
    content: "Description";
  }
  .wallet-transactions tbody td:nth-child(5)::before {
    content: "Expires";
  }
  .wallet-transactions tbody td:nth-child(2),
  .wallet-transactions tbody td:nth-child(3),
  .wallet-transactions tbody td:nth-child(5) {
    text-align: right;
  }
  .wallet-transactions tbody td:nth-child(4) {
    text-align: right;
  }
  .woocommerce-account .woocommerce-MyAccount-content .pisol-wallet-add-fund-container {
    padding: 22px 18px 20px;
    border-radius: 16px;
  }
  .woocommerce-account .woocommerce-MyAccount-content .tablenav {
    justify-content: center;
  }
}

/* ---------- Dark-mode safeguard (subtle) ---------- */
@media (prefers-color-scheme: dark) {
  .woocommerce-account .woocommerce-MyAccount-content table.wallet-transactions,
  .woocommerce-account .woocommerce-MyAccount-content .pisol-wallet-add-fund-container {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .wallet-transactions tbody tr,
  .woocommerce-account .woocommerce-MyAccount-content .pagination .page-link,
  .woocommerce-account .woocommerce-MyAccount-content .pisol-form-submit button,
  .wallet-navigation .nav-item {
    transition: none;
  }
}
