/* Samnvay Session Wallet & Checkout — premium HTML/JS UI */

body.sm-modal-open {
  overflow: hidden !important;
}
body.sm-modal-open #sc-stage,
body.sm-modal-open #sc-debug {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* —— Avatar dock wallet badge —— */
.sc-wallet-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(22, 16, 36, 0.92);
  border: 1px solid rgba(138, 94, 224, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 5px 10px 5px 8px;
  color: #f3effb;
  font-family: var(--body, Inter, system-ui, sans-serif);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, background 0.2s;
  margin-bottom: 4px;
  user-select: none;
}
.sc-wallet-badge:hover {
  transform: translateY(-2px);
  border-color: rgba(167, 139, 250, 0.8);
  background: rgba(36, 26, 60, 0.96);
}
.sc-wallet-badge.low {
  border-color: rgba(232, 98, 46, 0.65);
  animation: sm-pulse-soft 2s ease-in-out infinite;
}
.sc-wallet-badge.empty {
  border-color: rgba(239, 68, 68, 0.75);
  background: rgba(48, 14, 20, 0.94);
  animation: sm-pulse-soft 1.35s ease-in-out infinite;
}
.sc-wallet-badge .bolt { color: #ffd98a; font-size: 13px; }
.sc-wallet-badge .recharge-btn,
.sm-standalone-badge .recharge-btn {
  background: linear-gradient(135deg, #6d3cd0, #8a5ee0);
  color: #fff;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sm-standalone-badge {
  position: fixed;
  right: 16px;
  bottom: 20px;
  z-index: 9000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(138, 94, 224, 0.5);
  background: rgba(18, 12, 32, 0.96);
  color: #f3effb;
  border-radius: 999px;
  padding: 11px 15px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.2s ease;
}
.sm-standalone-badge:hover { transform: translateY(-2px); }
.sm-standalone-badge.empty {
  border-color: rgba(239, 68, 68, 0.7);
  background: rgba(50, 15, 20, 0.96);
}

.sm-dash-low { border-color: rgba(232, 98, 46, 0.55) !important; }
.sm-dash-empty {
  border-color: rgba(239, 68, 68, 0.65) !important;
  background: rgba(70, 18, 24, 0.4) !important;
}

@keyframes sm-pulse-soft {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4); }
  50% { box-shadow: 0 6px 22px rgba(239, 68, 68, 0.28); }
}

/* —— Modal shell —— */
#sm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 14px;
  box-sizing: border-box;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(109, 60, 208, 0.28), transparent 60%),
    rgba(8, 6, 14, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
#sm-modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.sm-modal-box {
  position: relative;
  width: 100%;
  max-width: 920px;
  max-height: min(90vh, 860px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 24px;
  color: #f3effb;
  font-family: var(--body, Inter, system-ui, sans-serif);
  background:
    radial-gradient(90% 60% at 50% -15%, rgba(109, 60, 208, 0.32), transparent 55%),
    linear-gradient(180deg, #1a1430 0%, #120e1f 100%);
  border: 1px solid rgba(243, 239, 251, 0.14);
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: scale(0.96) translateY(14px);
  transition: transform 0.34s cubic-bezier(0.16, 1, 0.3, 1);
}
#sm-modal-overlay.open .sm-modal-box {
  transform: scale(1) translateY(0);
}

.sm-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 28px 28px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(155, 116, 240, 0.45) transparent;
}
.sm-scroll::-webkit-scrollbar { width: 6px; }
.sm-scroll::-webkit-scrollbar-track { background: transparent; }
.sm-scroll::-webkit-scrollbar-thumb {
  background: rgba(155, 116, 240, 0.4);
  border-radius: 99px;
}
.sm-foot {
  flex: 0 0 auto;
  padding: 8px 28px 18px;
  background: linear-gradient(180deg, transparent, rgba(18, 14, 31, 0.96) 30%);
}

.sm-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: #c9c0e3;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s, transform 0.15s, color 0.2s;
}
.sm-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  transform: scale(1.06);
}

/* —— Header —— */
.sm-header {
  text-align: center;
  margin-bottom: 26px;
  padding: 0 36px;
}
.sm-header .sm-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #7dffb0;
  background: rgba(125, 255, 176, 0.08);
  border: 1px solid rgba(125, 255, 176, 0.28);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.sm-header h2 {
  font-family: var(--display, "Space Grotesk", sans-serif);
  font-size: clamp(24px, 4vw, 32px);
  margin: 0 0 10px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.sm-header p {
  color: rgba(201, 192, 227, 0.85);
  font-size: 14.5px;
  margin: 0 auto;
  max-width: 520px;
  line-height: 1.55;
}
.sm-warn { color: #f87171; font-weight: 700; }

.sm-wallet-pill {
  display: inline-flex;
  margin-top: 16px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(243, 239, 251, 0.92);
}
.sm-wallet-pill.low {
  border-color: rgba(232, 98, 46, 0.5);
  color: #ffb089;
}
.sm-wallet-pill.empty {
  border-color: rgba(239, 68, 68, 0.55);
  color: #fca5a5;
}

/* —— Plans —— */
#sm-plans-container[hidden],
.sm-plans-grid[hidden],
.sm-header[hidden],
.sm-foot[hidden],
.sm-success[hidden],
#sm-success[hidden],
.sm-mock-checkout[hidden] {
  display: none !important;
}

.sm-plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.sm-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 22px 18px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s, box-shadow 0.28s;
}
.sm-plan-card:hover {
  transform: translateY(-4px);
  border-color: rgba(138, 94, 224, 0.5);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}
.sm-plan-card.featured {
  background:
    linear-gradient(165deg, rgba(31, 138, 76, 0.16), transparent 45%),
    rgba(255, 255, 255, 0.04);
  border-color: rgba(52, 211, 153, 0.4);
  box-shadow: 0 10px 28px rgba(31, 138, 76, 0.12);
}
.sm-plan-badge {
  position: absolute;
  top: -10px;
  right: 14px;
  background: linear-gradient(135deg, #34d399, #1f8a4c);
  color: #042016;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
}

.sm-plan-card h3 {
  font-family: var(--display, "Space Grotesk", sans-serif);
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.sm-plan-card .sm-sessions-qty {
  font-size: 12.5px;
  color: #ffd98a;
  font-weight: 600;
  margin-bottom: 12px;
}
.sm-plan-card .sm-price {
  font-family: var(--display, "Space Grotesk", sans-serif);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.03em;
}
.sm-plan-card .sm-price span {
  font-family: var(--body, Inter, system-ui, sans-serif);
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.48);
}

.sm-plan-feats {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  flex: 1;
}
.sm-plan-feats li {
  font-size: 12.5px;
  color: rgba(201, 192, 227, 0.9);
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.35;
}
.sm-plan-feats li::before {
  content: "✓";
  color: #7dffb0;
  font-weight: 800;
  flex-shrink: 0;
}

.sm-buy-btn {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transition: background 0.2s, transform 0.2s, opacity 0.2s, box-shadow 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sm-buy-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}
.sm-buy-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.sm-plan-card.featured .sm-buy-btn,
.sm-buy-btn.featured-btn {
  background: linear-gradient(135deg, #1f8a4c, #34d399);
  color: #042016;
  box-shadow: 0 6px 18px rgba(31, 138, 76, 0.35);
}
.sm-plan-card.featured .sm-buy-btn:hover:not(:disabled),
.sm-buy-btn.featured-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #249c57, #4ade80);
  box-shadow: 0 8px 22px rgba(31, 138, 76, 0.45);
}

/* Pro monthly button (non-featured) gets brand purple */
.sm-plan-card:not(.featured) .sm-buy-btn[data-plan-id="plan_pro_40"] {
  background: linear-gradient(135deg, #6d3cd0, #8a5ee0);
  box-shadow: 0 6px 16px rgba(109, 60, 208, 0.3);
}

.sm-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  color: rgba(255, 255, 255, 0.42);
  font-size: 11.5px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sm-trust span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sm-trust span::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(125, 255, 176, 0.7);
}

.sm-loading,
.sm-error-state {
  grid-column: 1 / -1;
  text-align: center;
  color: rgba(255, 255, 255, 0.55);
  padding: 40px 12px;
}
.sm-loading::after {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  margin: 14px auto 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: #8a5ee0;
  animation: sm-spin 0.7s linear infinite;
}
@keyframes sm-spin { to { transform: rotate(360deg); } }

/* Checkout busy veil (order / Razorpay / verify) */
.sm-busy-veil {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 14, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sm-busy-veil[hidden] {
  display: none !important;
}
.sm-busy-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 18px 22px;
  border-radius: 14px;
  background: rgba(27, 21, 48, 0.96);
  border: 1px solid rgba(243, 239, 251, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  color: #f3effb;
  font-size: 13.5px;
  font-weight: 600;
}
.sm-busy-card p { margin: 0; }
.sm-busy-spinner,
.sm-btn-spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  box-sizing: border-box;
  border: 2.5px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  animation: sm-spin 0.7s linear infinite;
}
.sm-btn-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border-width: 2px;
  margin-left: 8px;
  vertical-align: middle;
}
.sm-buy-btn.is-loading {
  opacity: 0.88;
  cursor: wait;
}
.sm-buy-btn.is-loading .sm-btn-spinner {
  display: inline-block;
}
#sm-modal-overlay.sm-busy {
  cursor: progress;
}

.sm-error-state .sm-buy-btn {
  max-width: 160px;
  margin: 14px auto 0;
}

/* —— Success —— */
.sm-success {
  text-align: center;
  padding: 28px 12px 10px;
}
.sm-success-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  color: #042016;
  background: linear-gradient(135deg, #34d399, #1f8a4c);
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.35);
  animation: sm-pop 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes sm-pop {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.sm-success h3 {
  font-family: var(--display, "Space Grotesk", sans-serif);
  margin: 0 0 8px;
  font-size: 24px;
  letter-spacing: -0.02em;
}
.sm-success p {
  color: rgba(201, 192, 227, 0.85);
  margin: 0 0 20px;
}
.sm-success .sm-buy-btn {
  max-width: 260px;
  margin: 0 auto;
}

/* —— Mock checkout —— */
.sm-mock-checkout {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 26px;
  background: rgba(8, 6, 14, 0.72);
  backdrop-filter: blur(6px);
}
.sm-mock-checkout[hidden] { display: none !important; }
.sm-mock-card {
  width: min(380px, 100%);
  text-align: center;
  padding: 24px;
  border-radius: 18px;
  background: linear-gradient(180deg, #1f1834, #161024);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  animation: sm-pop 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}
.sm-mock-tag {
  display: inline-block;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #ffd98a;
  background: rgba(232, 98, 46, 0.12);
  border: 1px solid rgba(232, 98, 46, 0.4);
  padding: 4px 9px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.sm-mock-card h3 {
  font-family: var(--display, "Space Grotesk", sans-serif);
  margin: 0 0 6px;
  font-size: 20px;
}
.sm-mock-card p {
  margin: 0;
  color: rgba(201, 192, 227, 0.85);
  font-size: 14px;
}
.sm-mock-note {
  margin-top: 12px !important;
  font-size: 12.5px !important;
  color: rgba(255, 255, 255, 0.45) !important;
}
.sm-mock-actions {
  display: grid;
  grid-template-columns: 1fr 1.45fr;
  gap: 10px;
  margin-top: 18px;
}

/* —— Toast —— */
#sm-toast,
.sm-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(18px);
  z-index: 100000;
  max-width: min(92vw, 420px);
  padding: 13px 18px;
  border-radius: 14px;
  background: #1b152a;
  color: #f3effb;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  font-size: 13.5px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  text-align: center;
}
#sm-toast.show,
.sm-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.sm-toast-success {
  border-color: rgba(52, 211, 153, 0.5);
  background: linear-gradient(180deg, #13261f, #1b152a);
}
.sm-toast-error {
  border-color: rgba(239, 68, 68, 0.55);
  background: linear-gradient(180deg, #2a1418, #1b152a);
}
.sm-toast-warn {
  border-color: rgba(232, 98, 46, 0.5);
  background: linear-gradient(180deg, #2a1a14, #1b152a);
}

@media (max-width: 860px) {
  .sm-plans-grid { grid-template-columns: 1fr; max-width: 420px; margin-left: auto; margin-right: auto; }
  .sm-modal-box { border-radius: 20px; max-height: min(94vh, 900px); }
  .sm-scroll { padding: 22px 16px 8px; }
  .sm-foot { padding: 6px 16px 14px; }
  .sm-plan-card.featured { order: -1; }
  .sm-header { padding: 0 28px 0 8px; }
  #sm-modal-overlay { align-items: flex-end; padding: 10px; }
}

@media (max-width: 480px) {
  .sm-standalone-badge {
    right: 12px;
    bottom: 14px;
    padding: 9px 12px;
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sc-wallet-badge,
  .sm-plan-card,
  .sm-modal-box,
  .sm-success-icon,
  .sm-mock-card,
  .sm-loading::after {
    animation: none !important;
    transition: none !important;
  }
}

/* —— Ledger table smooth slim scrollbar —— */
.sm-ledger-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(167, 139, 250, 0.4) transparent;
}
.sm-ledger-scroll::-webkit-scrollbar {
  width: 5px;
}
.sm-ledger-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.sm-ledger-scroll::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.35);
  border-radius: 99px;
}
.sm-ledger-scroll::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.6);
}

