/* Shared styling for the auth pages (register, login, profile) and the
   shop checkout flow. Mirrors the landing page's purple/violet glass
   aesthetic without duplicating the embedded-app-frame CSS. */

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: #050507;
  color: #fafafa;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Suppress horizontal scrollbars from off-screen ambient orbs (position:
     fixed, far outside the viewport) and any narrow-phone overflow we may
     not catch in the per-component rules. The page is column-flow only. */
  overflow-x: hidden;
}
body {
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
}
a { color: inherit; text-decoration: none; }

/* ---------- ambient background — same DNA as landing/shop ----------- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(232, 121, 249, 0.10), transparent 60%),
    radial-gradient(ellipse 55% 40% at 15% 50%, rgba(192, 132, 252, 0.08), transparent 65%),
    radial-gradient(ellipse 55% 40% at 85% 70%, rgba(240, 130, 235, 0.08), transparent 65%),
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(212, 132, 252, 0.08), transparent 60%);
}
.orb { position: fixed; border-radius: 50%; z-index: -1; pointer-events: none; }
.orb-1 { width: 1000px; height: 1000px; top: -25%; left: -20%;
         background: radial-gradient(circle in oklch, rgba(232,121,249,0.09) 0%, rgba(232,121,249,0) 55%);
         filter: url(#orbBlur); animation: drift1 38s ease-in-out infinite; }
.orb-2 { width: 850px; height: 850px; top: -20%; right: -18%;
         background: radial-gradient(circle in oklch, rgba(192,132,252,0.09) 0%, rgba(192,132,252,0) 55%);
         filter: url(#orbBlur); animation: drift2 46s ease-in-out infinite; }
.orb-3 { width: 800px; height: 800px; bottom: -22%; left: -18%;
         background: radial-gradient(circle in oklch, rgba(216,180,254,0.08) 0%, rgba(216,180,254,0) 55%);
         filter: url(#orbBlur); animation: drift3 52s ease-in-out infinite; }
.orb-4 { width: 900px; height: 900px; bottom: -25%; right: -18%;
         background: radial-gradient(circle in oklch, rgba(240,130,235,0.09) 0%, rgba(240,130,235,0) 55%);
         filter: url(#orbBlur); animation: drift4 42s ease-in-out infinite; }
@keyframes drift1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(70px, 50px)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-70px, 60px)} }
@keyframes drift3 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(60px, -70px)} }
@keyframes drift4 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-65px, -55px)} }
.noise {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.14; mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.7 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 220px 220px;
}

/* ---------- top bar ---------- */
.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px clamp(20px, 4vw, 56px);
  /* Allow the right-side actions to wrap below brand on phones rather than
     overflowing the viewport. */
  flex-wrap: wrap;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  padding-left: 8px;
}
.brand-link img {
  height: 28px;
  width: 28px;
  object-fit: contain;
  margin-right: -8px;
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.5));
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tb-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: background-color 150ms ease, border-color 150ms ease;
  cursor: pointer;
}
.tb-link:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.16);
}
.tb-link.primary {
  color: white;
  background: linear-gradient(180deg, #b377ff 0%, #9333ea 100%);
  border-color: rgba(168, 85, 247, 0.5);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 0 14px rgba(168, 85, 247, 0.25);
}
.tb-link.primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 0 22px rgba(168, 85, 247, 0.4); }
.tb-link svg { width: 14px; height: 14px; }

/* ---------- centered card layout (login/register/checkout) ---------- */
.center-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px clamp(16px, 3vw, 40px) 60px;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: clamp(28px, 4vw, 40px);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 60px -20px rgba(0, 0, 0, 0.6),
    0 0 80px -30px rgba(168, 85, 247, 0.30);
}
.auth-card h1 {
  margin: 0 0 8px;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-card .lead {
  margin: 0 0 24px;
  color: rgba(255, 255, 255, 0.56);
  font-size: 14px;
  line-height: 1.5;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field-label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.65);
}
.field-input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 14px;
  color: white;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  outline: none;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}
.field-input::placeholder { color: rgba(255, 255, 255, 0.32); }
.field-input:focus {
  border-color: rgba(168, 85, 247, 0.55);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
}
.field-error {
  font-size: 12.5px;
  color: #f87171;
  margin-top: 2px;
  min-height: 16px;
}
.field-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  user-select: none;
  margin: 4px 0 18px;
}
.field-checkbox input { margin-top: 2px; accent-color: #a855f7; }
.field-checkbox a { color: rgba(232, 121, 249, 0.9); text-decoration: underline; text-decoration-color: rgba(232, 121, 249, 0.4); }

.btn-primary-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: white;
  background: linear-gradient(180deg, #b377ff 0%, #9333ea 100%);
  border: 1px solid rgba(168, 85, 247, 0.5);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 0 16px rgba(168, 85, 247, 0.28);
  cursor: pointer;
  transition: transform 150ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 150ms ease;
}
.btn-primary-block:hover {
  transform: translateY(-1px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 0 22px rgba(168, 85, 247, 0.4);
}
.btn-primary-block:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn-primary-block svg { width: 16px; height: 16px; }

.auth-aside {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
}
.auth-aside a {
  color: rgba(232, 121, 249, 0.9);
  font-weight: 500;
}
.auth-aside a:hover { text-decoration: underline; }

.alert {
  display: none;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.alert.show { display: block; }
.alert.error {
  color: #fca5a5;
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.30);
}
.alert.success {
  color: #86efac;
  background: rgba(34, 197, 94, 0.08);
  border-color: rgba(34, 197, 94, 0.30);
}

/* ---------- profile page wide layout ---------- */
.profile-shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: 12px clamp(16px, 3vw, 40px) 64px;
}
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
}
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
}
.profile-h {
  margin: 8px 0 22px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.profile-h h1 {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  /* Descender fix — `background-clip: text` clips the gradient to glyph
     shapes inside the line-box; ui-sans-serif descenders sit ~22% of em
     below the baseline, so the lower 1–2 px of "g/y/p/q/j" gets cut by
     the line-box edge unless we add explicit clearance. line-height 1.25
     + padding-bottom 0.18em is conservative enough to survive every
     browser + font-fallback combination we've tested. */
  display: inline-block;
  line-height: 1.25;
  padding-bottom: 0.18em;
  background: linear-gradient(180deg, #ffffff 0%, rgba(232, 121, 249, 0.85) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.profile-h .sub { color: rgba(255, 255, 255, 0.5); font-size: 13.5px; }

.card {
  padding: clamp(20px, 2vw, 28px);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
}
.card + .card { margin-top: 18px; }
.card-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}
.card-h .actions { display: flex; gap: 8px; }
.card-h .actions button {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-weight: 600;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.card-h .actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.kv-list { display: grid; grid-template-columns: max-content 1fr; column-gap: 24px; row-gap: 12px; align-items: center; }
.kv-list .k { color: rgba(255, 255, 255, 0.55); font-size: 13px; }
.kv-list .v { color: rgba(255, 255, 255, 0.92); font-size: 14px; font-variant-numeric: tabular-nums; }
.kv-list .v.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; }
@media (max-width: 540px) {
  .kv-list { grid-template-columns: 1fr; row-gap: 4px; }
  .kv-list .k { margin-top: 8px; }
}

.password-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.password-row .pwd-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 6px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
  border-color: rgba(255, 255, 255, 0.16);
}
.icon-btn svg { width: 14px; height: 14px; }

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 13.5px;
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: 12px;
}

/* ---------- table (payments / invoices) ---------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}
.table th, .table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-variant-numeric: tabular-nums;
}
.table th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}
.table td.muted { color: rgba(255, 255, 255, 0.55); }
.table td.amount { font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.table .badge.paid { color: #86efac; background: rgba(34, 197, 94, 0.10); border: 1px solid rgba(34, 197, 94, 0.30); }
.table .pay-pill { display: inline-flex; align-items: center; gap: 6px; }
.table .pm-icon {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; color: white; font-weight: 700; font-size: 10px;
}
.table .pm-icon.btc { background: linear-gradient(180deg, #f7931a 0%, #e07c0d 100%); }
.table .pm-icon.ltc { background: linear-gradient(180deg, #345d9d 0%, #2a4a82 100%); }
.table .pm-icon.pp  { background: linear-gradient(180deg, #003087 0%, #0070ba 100%); font-style: italic; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* On phones the table collapses to stacked cards — each <tr> becomes a
   block with key-on-left / value-on-right. Set in code via data-label
   attributes on each <td>. */
@media (max-width: 700px) {
  .table thead { display: none; }
  .table, .table tbody, .table tr { display: block; }
  .table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  }
  .table td::before {
    content: attr(data-label);
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
  }
  .table tr {
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }
  .table tr:last-child { border-bottom: none; }
}

/* ---------- license card sidebar ---------- */
.license-state {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(168, 85, 247, 0.20);
  background: linear-gradient(180deg, rgba(168, 85, 247, 0.10), rgba(168, 85, 247, 0.02));
}
.license-state .label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255, 255, 255, 0.65); }
.license-state .value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 14px; word-break: break-all;
  color: white;
}
.license-state .meta { font-size: 12.5px; color: rgba(255, 255, 255, 0.55); }
.license-state.empty {
  border-style: dashed;
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  align-items: center;
  padding: 22px 14px;
}
.license-state.empty .value { color: rgba(255, 255, 255, 0.45); font-family: inherit; font-size: 14px; }

/* ---------- footer ---------- */
.site-footer {
  margin-top: auto;
  padding: 22px;
  text-align: center;
  font-size: 12.5px;
  color: rgba(255, 255, 255, 0.4);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.site-footer a { color: rgba(255, 255, 255, 0.6); }
.site-footer a:hover { color: rgba(232, 121, 249, 0.9); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .orb-1 { animation-duration: 38s !important; animation-iteration-count: infinite !important; }
  .orb-2 { animation-duration: 46s !important; animation-iteration-count: infinite !important; }
  .orb-3 { animation-duration: 52s !important; animation-iteration-count: infinite !important; }
  .orb-4 { animation-duration: 42s !important; animation-iteration-count: infinite !important; }
  .btn-primary-block:hover { transform: none !important; }
}

/* ---------- print (for invoice download) ---------- */
@media print {
  body::before, .orb, .noise, .topbar, .site-footer, .invoice-actions { display: none !important; }
  body { background: white !important; color: black !important; }
  .invoice-print { color: black !important; }
  .invoice-print * { color: black !important; border-color: #ddd !important; }
  .invoice-print .table th, .invoice-print .table td { border-bottom-color: #eee !important; }
  .invoice-print .badge { border: 1px solid #c0c0c0 !important; color: #444 !important; background: white !important; }
}
