/* ── Pricing ─────────────────────────────────────────────────────
   Uses the app's design tokens via style.css. Self-contained layout.
   ─────────────────────────────────────────────────────────────────*/

/* ── Section Label ── */
.sec-lbl {
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* ── Plans Grid ── */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.plan-card {
  background: var(--bg-card, rgba(22,22,22,0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 16px);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color 0.25s ease;
}
.plan-card:hover {
  border-color: var(--border-hover, rgba(255,255,255,0.14));
}
.plan-card.is-pop {
  border: 2px solid var(--primary);
  padding: calc(1.5rem - 1px);
}

.card-pill {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--border);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
  border: 1px solid var(--border);
}
.pill-pop {
  background: var(--primary);
  color: #fff;
  border: none;
}

.card-name {
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.card-price {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
}
.p-num {
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.p-cur, .p-mo {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-period {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.card-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem 0;
}

.card-feats {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.feat-on {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.feat-on .ti-check {
  color: var(--primary);
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.feat-off {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  font-size: 0.875rem;
  color: var(--text-muted);
  opacity: 0.5;
}
.feat-off .ti-x {
  font-size: 0.8rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.card-btn {
  margin-top: 1.25rem;
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius-md, 12px);
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 0.88rem;
  cursor: pointer;
  transition: opacity 0.15s;
}
.card-btn:hover {
  opacity: 0.88;
}

.btn-done {
  background: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.7;
  border: none;
}
.btn-outline-primary {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
}
.btn-grad {
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 100%);
  color: #fff;
  border: none;
  font-weight: 600;
}

/* ── Top-up credits section ── */
.topup-section {
  background: var(--panel, rgba(18,18,34,0.75));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 20px);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-bottom: 2rem;
}

.topup-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.topup-card {
  background: var(--bg-card, rgba(22,22,22,0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  padding: 1.1rem 1rem 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color 0.25s ease;
}
.topup-card:hover {
  border-color: var(--border-hover, rgba(255,255,255,0.14));
}
.topup-card--pop {
  border: 2px solid var(--primary);
}
.topup-pop-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.topup-card__price {
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 2px;
}
.topup-card--pop .topup-card__price {
  color: var(--primary);
}
.topup-card__credits {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
}
.topup-card__rate {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}
.topup-card__btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem;
  border-radius: var(--radius-sm, 8px);
  background: var(--primary-soft, rgba(124,108,250,0.12));
  border: 0.5px solid var(--primary-alpha, rgba(124,108,250,0.25));
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  text-align: center;
  transition: background 0.13s, color 0.13s;
  margin-top: auto;
}
.topup-card__btn:hover {
  background: var(--primary);
  color: #fff;
}
.topup-card__btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.topup-card__btn--primary:hover {
  opacity: 0.88;
}

.topup-uses {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-md, 12px);
  border: 0.5px solid var(--border);
}
.topup-use {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.topup-use svg {
  color: var(--primary);
  flex-shrink: 0;
  margin-top: 1px;
}

[data-theme="light"] .topup-section { background: rgba(255,255,255,0.9); }
[data-theme="light"] .topup-card { background: #ffffff; }
[data-theme="light"] .topup-uses { background: rgba(0,0,0,0.02); }

/* ── Bottom Row ── */
.bottom-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.b-card {
  min-width: 0;
  background: var(--bg-card, rgba(22,22,22,0.95));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 16px);
  padding: 1.25rem 1.5rem 1.5rem;
  transition: border-color 0.25s ease;
}
.b-card:hover {
  border-color: var(--border-hover, rgba(255,255,255,0.14));
}

.b-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  margin-bottom: 0.85rem;
}

.pay-opts {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.pay-opt {
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md, 12px);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}
.pay-opt.on {
  border-color: var(--primary);
  background: var(--primary-soft, rgba(124,108,250,0.1));
}
.pay-opt__header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}
.pay-opt__header svg {
  color: var(--text-muted);
  flex-shrink: 0;
  transition: color 0.14s;
}
.pay-opt.on .pay-opt__header svg {
  color: var(--primary);
}
.opt-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}
.opt-tag {
  font-size: 0.62rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-muted);
  border: 0.5px solid var(--border);
  white-space: nowrap;
}
.pay-opt.on .opt-tag {
  background: color-mix(in srgb, var(--primary) 15%, transparent);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}
.opt-detail {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: 22px;
}

.pay-footer {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 0.85rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.coupon-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.coupon-in {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md, 12px);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
}
.coupon-in:focus {
  border-color: var(--primary);
  outline: none;
}
.coupon-go {
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md, 12px);
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  white-space: nowrap;
}
.coupon-go:hover {
  opacity: 0.88;
}
.coupon-note {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.65rem;
  line-height: 1.5;
}

/* ── Cancel Link ── */
.cancel-sub-btn {
  background: none;
  border: none;
  font-size: 0.72rem;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  font-family: var(--font-body, 'DM Sans', system-ui, sans-serif);
}

/* ── Modal ── */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.modal-bg.on {
  display: flex;
}
.modal-sheet {
  background: var(--panel, rgba(18,18,34,0.75));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 20px) var(--radius-lg, 20px) 0 0;
  padding: 1.5rem;
  padding-bottom: calc(1.5rem + var(--safe-bottom, 0px));
  width: 100%;
  max-width: 480px;
}
.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  margin: 0 auto 1.25rem;
}
.modal-bg.on .modal-sheet {
  animation: sheetUp 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes sheetUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

@media (min-width: 769px) {
  .modal-bg { align-items: center; padding: 1rem; }
  .modal-sheet {
    border-radius: var(--radius-lg, 20px);
    max-width: 440px;
    padding-bottom: 1.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  }
  .modal-handle { display: none; }
  .modal-bg.on .modal-sheet { animation: modalCenterIn 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
}

@keyframes modalCenterIn {
  from { transform: translateY(10px) scale(0.98); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-bg.on .modal-sheet { animation: none; }
}
.modal-title {
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}
.modal-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.modal-summary {
  background: var(--primary-soft, rgba(124,108,250,0.15));
  border: 1px solid var(--primary-alpha, rgba(124,108,250,0.25));
  border-radius: var(--radius-md, 12px);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.msm-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}
.msm-price {
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}
.modal-pay-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.modal-pay-opt {
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 12px);
  padding: 0.75rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.modal-pay-opt.on {
  border-color: var(--primary);
  background: var(--primary-soft, rgba(124,108,250,0.15));
}
.mp-icon { font-size: 1.4rem; margin-bottom: 0.25rem; }
.mp-name { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.mp-hint { font-size: 0.72rem; color: var(--text-muted); }
.modal-actions {
  display: flex;
  gap: 0.75rem;
}
.m-cancel {
  flex: 1;
  padding: 0.75rem;
  border-radius: var(--radius-md, 12px);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  cursor: pointer;
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
}
.m-ok {
  flex: 2;
  padding: 0.75rem;
  border-radius: var(--radius-md, 12px);
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 100%);
  color: #fff;
  border: none;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}
.m-ok:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.pricing-spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 0.4rem;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Light Theme ── */
[data-theme="light"] .plan-card { background: #ffffff; }
[data-theme="light"] .b-card { background: #ffffff; }
[data-theme="light"] .modal-sheet { background: #fff; }
/* ── Responsive ── */
/* ── Flash Messages ── */
.pricing-flash {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md, 12px);
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
}
.pricing-flash--success {
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.25);
  color: #22c55e;
}
.pricing-flash--error,
.pricing-flash--danger {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  color: #ef4444;
}
.pricing-flash--info {
  background: rgba(124,108,250,0.12);
  border: 1px solid rgba(124,108,250,0.25);
  color: var(--primary);
}

/* ── Active Plan Banner ── */
.active-plan-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--primary-soft, rgba(124,108,250,0.12));
  border: 1px solid var(--primary-alpha, rgba(124,108,250,0.25));
  border-radius: var(--radius-lg, 20px);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}
.apb-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.apb-left i {
  font-size: 1.3rem;
  color: var(--primary);
}
.apb-name {
  font-family: var(--font-display, 'Space Grotesk', system-ui, sans-serif);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
}
.apb-date {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.apb-manage {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm, 8px);
  border: 1px solid var(--primary-alpha, rgba(124,108,250,0.3));
  transition: background 0.15s;
}
.apb-manage:hover {
  background: var(--primary-soft, rgba(124,108,250,0.15));
}

/* ── Plans Grid 3-column ── */
.plans-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

/* ── Current plan pill ── */
.pill-current {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.3);
}

/* ── Feature highlight (premium unlimited) ── */
.feat-highlight {
  color: var(--primary) !important;
  font-weight: 600;
}
.feat-highlight i {
  color: var(--primary) !important;
}
.feat-soft {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Ghost button (downgrade to free) ── */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: block;
  text-align: center;
  text-decoration: none;
}
.btn-ghost:hover {
  border-color: var(--text-muted);
  color: var(--text-primary);
  opacity: 1;
}

/* ── Card button as <a> / <div> (when not a <button>) ── */
.card-btn[href] {
  display: block;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .plans-grid--3 { grid-template-columns: 1fr; }
  .topup-row { grid-template-columns: 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .plans-grid { grid-template-columns: 1fr; }
  .b-card { padding: 1rem 1rem 1.25rem; }
}

.pricing-main { max-width: 960px; margin: 0 auto; padding: 6.5rem 1.25rem 4rem; }
@media (min-width: 1024px) { .pricing-main { padding-top: 8.5rem; } }
