:root {
  --credit-primary: var(--bs-primary);
  --credit-primary-dark: #7442e8;
  --credit-primary-soft: rgba(var(--bs-primary-rgb), 0.09);

  --credit-success: #28c76f;
  --credit-warning: #ff9f43;
  --credit-danger: #ea5455;

  --credit-radius: 18px;

  /* Light theme */
  --credit-surface: #fff;
  --credit-surface-soft: #f7f7fa;
  --credit-border: #e9e9ed;
  --credit-muted: #8a8d93;
  --credit-text: #3b3f45;
}

[data-style="dark"] {
  --credit-surface: #28243d;
  --credit-surface-soft: #28243d;
  --credit-border: rgba(255, 255, 255, 0.08);
  --credit-muted: #aaa7bd;
  --credit-text: #e5e3ef;
  --credit-primary-soft: rgba(var(--bs-primary-rgb), 0.15);
}

/** balance */
.credit-main-card {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  border: 0;
  border-radius: var(--credit-radius);
  color: #fff;

  background:
    radial-gradient(
      circle at 88% 12%,
      rgba(255, 255, 255, 0.1),
      transparent 28%
    ),
    radial-gradient(
      circle at 10% 100%,
      rgba(255, 255, 255, 0.04),
      transparent 35%
    ),
    linear-gradient(135deg, #6241b5 0%, #7655c9 50%, #8065c7 100%);
}

.credit-main-card::before,
.credit-main-card::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  pointer-events: none;
}

.credit-main-card::before {
  width: 320px;
  height: 320px;
  right: -130px;
  bottom: -170px;
}

.credit-main-card::after {
  width: 180px;
  height: 180px;
  top: -110px;
  right: 80px;
  border-color: rgba(255, 255, 255, 0.07);
}

.credit-balance {
  font-size: 3.7rem;
  line-height: 1;
  letter-spacing: -0.06em;
}

.credit-unit {
  font-size: 1.1rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.95);
  letter-spacing: normal;
  vertical-align: middle;
}

.credit-health {
  background: rgba(255, 255, 255, 0.14);
}

.credit-health-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}

.credit-health-dot.healthy {
  background: #28c76f;
}

.credit-health-dot.low {
  background: #ff9f43;
}

.credit-health-dot.critical,
.credit-health-dot.empty {
  background: #ea5455;
}

.credit-progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50rem;
}

.credit-progress .progress-bar {
  background: #fff;
  transition: width 0.5s ease;
}

/** summary */
.credit-summary-card {
  height: 100%;
  border: 1px solid var(--credit-border);
  border-radius: var(--credit-radius);
  background: var(--credit-surface);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.credit-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

[data-bs-theme="dark"] .credit-summary-card:hover {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.credit-summary-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  font-size: 1.2rem;
}

.credit-summary-icon.added,
.credit-transaction-icon.purchase {
  color: var(--credit-success);
  background: rgba(40, 199, 111, 0.12);
}

.credit-summary-icon.used,
.credit-transaction-icon.usage {
  color: var(--credit-danger);
  background: rgba(234, 84, 85, 0.12);
}

/** activity */
.credit-activity-card {
  overflow: hidden;
  border: 1px solid var(--credit-border);
  border-radius: var(--credit-radius);
}

/** tabs */
.credit-tabs {
  gap: 1.5rem;
  border-bottom: 1px solid var(--credit-border);
}

.credit-tabs .nav-link {
  position: relative;
  padding: 0.9rem 0;
  border: 0;
  border-radius: 0;
  color: var(--credit-muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.credit-tabs .nav-link:hover,
.credit-tabs .nav-link.active {
  color: var(--credit-primary);
  background: transparent;
}

.credit-tabs .nav-link.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  border-radius: 50rem;
  background: var(--credit-primary);
}

/** activity toolbar */
.credit-activity-toolbar {
  background: var(--credit-surface-soft);
  border-top: 1px solid var(--credit-border);
  border-bottom: 1px solid var(--credit-border);
}

.credit-date-range {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--credit-surface-soft);
  color: var(--credit-muted);
}

/** transactions */
.credit-transaction-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  place-items: center;
  border-radius: 11px;
}

.credit-amount {
  font-weight: 700;
  white-space: nowrap;
}

.credit-amount.usage {
  color: var(--credit-danger);
}

.credit-amount.purchase {
  color: var(--credit-success);
}

/** empty state */
.credit-empty-icon {
  display: grid;
  width: 62px;
  height: 62px;
  place-items: center;
  margin: 0 auto 1rem;
  border-radius: 18px;
  color: var(--credit-muted);
  background: var(--credit-surface-soft);
  font-size: 1.6rem;
}

/** table */
.credit-activity-card .table {
  margin-bottom: 0;
}

/** modal */
.credit-purchase-modal .modal-content {
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background: var(--credit-surface);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.18);
}

/** progress bar */
.credit-progress {
  height: 4px;
  width: 100%;
  background: #ececf2;
}

.credit-progress-bar {
  height: 100%;
  width: 50%;
  background: linear-gradient(90deg, var(--credit-primary), #8d7bd0);
  transition: width 0.3s ease;
}

.credit-modal-header {
  padding: 22px 28px 18px;
  border-bottom: 1px solid var(--credit-border);
}

.credit-modal-step {
  gap: 10px;
}

.credit-step-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--credit-primary);
  font-size: 0.75rem;
  font-weight: 800;
}

.credit-step-number.inactive {
  color: var(--credit-muted);
  background: var(--credit-primary-soft);
}

.credit-modal-step-title {
  font-size: 0.85rem;
  font-weight: 750;
}

.credit-modal-step-subtitle {
  margin-top: 1px;
  color: var(--credit-muted);
  font-size: 0.67rem;
}

.credit-modal-close {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--credit-muted);
  background: var(--credit-surface-soft);
  font-size: 1.05rem;
  transition: 0.2s ease;
}

.credit-modal-close:hover {
  color: var(--credit-text);
  background: var(--credit-border);
}

/** progress step */
.credit-step {
  display: none;
}

.credit-step.active {
  display: block;
}

.credit-modal-body {
  padding: 26px 28px;
}

.credit-step-heading {
  margin-bottom: 20px;
}

.credit-step-heading h4 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 750;
}

.credit-step-heading p {
  margin: 5px 0 0;
  color: var(--credit-muted);
  font-size: 0.75rem;
}

/** package review */
.credit-review-card {
  padding: 20px;
  border: 1px solid var(--credit-border);
  border-radius: 16px;
  background: var(--credit-surface);
}

.credit-review-card-title {
  margin-bottom: 16px;
  color: var(--credit-text);
  font-size: 0.75rem;
  font-weight: 750;
}

.credit-review-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  color: var(--credit-muted);
  font-size: 0.7rem;
}

.credit-review-row strong {
  color: var(--credit-text);
  font-size: 0.75rem;
}

.credit-review-total {
  margin-top: 5px;
  padding-top: 14px;
  border-top: 1px solid var(--credit-border);
}

.credit-review-total strong {
  color: var(--credit-primary);
  font-size: 1.2rem;
}

.credit-payment-box {
  margin-top: 18px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(40, 199, 111, 0.07);
}

.credit-payment-box-title {
  gap: 7px;
  color: #1f9d58;
  font-size: 0.7rem;
  font-weight: 750;
}

.credit-payment-box-text {
  margin-top: 4px;
  color: var(--credit-muted);
  font-size: 0.63rem;
  line-height: 1.5;
}

.credit-new-balance {
  margin-top: 17px;
  padding: 15px;
  border: 1px dashed rgba(var(--bs-primary-border-subtle), 0.35);
  border-radius: 13px;
  background: var(--credit-primary-soft);
  text-align: center;
}

.credit-new-balance-label {
  color: var(--credit-muted);
  font-size: 0.63rem;
}

.credit-new-balance-value {
  margin-top: 3px;
  color: var(--bs-primary);
  font-size: 1.4rem;
  font-weight: 850;
}

/** modal footer */
.credit-modal-footer {
  gap: 12px;
  padding: 17px 28px;
  border-top: 1px solid var(--credit-border);
  background: var(--credit-surface-soft);
}

.credit-footer-note {
  gap: 6px;
  color: var(--credit-muted);
  font-size: 0.62rem;
}

.credit-footer-actions {
  gap: 8px;
}

.credit-btn {
  gap: 6px;
  min-width: 105px;
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 0.72rem;
  font-weight: 700;
}

.credit-btn-primary {
  color: #fff;
  background: var(--credit-primary);
  border-color: var(--credit-primary);
}

.credit-btn-primary:hover {
  color: #fff;
  background: var(--credit-primary-dark);
  border-color: var(--credit-primary-dark);
}

/** Success */
.credit-success {
  padding: 45px 25px;
}

.credit-success-icon {
  display: grid;
  width: 65px;
  height: 65px;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 20px;
  color: var(--credit-success);
  background: rgba(40, 199, 111, 0.1);
  font-size: 1.8rem;
}

.credit-success h4 {
  font-size: 1.05rem;
  font-weight: 800;
}

.credit-success p {
  max-width: 430px;
  margin: 7px auto 0;
  color: var(--credit-muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

@media (max-width: 767px) {
  .credit-balance {
    font-size: 2.7rem;
  }

  .credit-tabs {
    gap: 1rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .credit-tabs::-webkit-scrollbar {
    display: none;
  }

  .credit-tabs .nav-link {
    flex-shrink: 0;
  }

  .credit-purchase-modal .modal-dialog {
    margin: 0.5rem;
  }

  .credit-modal-header {
    padding: 17px 18px;
  }

  .credit-modal-body {
    padding: 20px 18px;
  }

  .credit-modal-footer {
    align-items: stretch;
    flex-direction: column;
    padding: 15px 18px;
  }

  .credit-footer-actions {
    width: 100%;
  }

  .credit-btn {
    flex: auto;
  }
}

/** Credit Purchase card **/

.credit-purchase-card {
  height: 100%;
  border: 1px solid var(--credit-border);
  border-radius: var(--credit-radius);
  padding: 24px;
  background: var(--credit-surface);
  color: var(--credit-text);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.04);
}

.credit-purchase-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
}

.credit-purchase-eyebrow {
  margin-bottom: 5px;
  color: var(--credit-primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
}

.credit-purchase-title {
  margin-bottom: 4px;
  color: var(--credit-text);
  font-size: 17px;
  font-weight: 700;
}

.credit-purchase-subtitle {
  max-width: 240px;
  color: var(--credit-muted);
  font-size: 12px;
  line-height: 1.5;
}

.credit-price-badge {
  display: flex;
  align-items: baseline;
  gap: 2px;
  padding: 7px 11px;
  border-radius: 10px;
  color: var(--credit-primary);
  background: var(--credit-primary-soft);
  white-space: nowrap;
}

.credit-price-badge span {
  font-size: 15px;
  font-weight: 800;
}

.credit-price-badge small {
  font-size: 10px;
  font-weight: 600;
}

/** Labels */

.credit-form-label {
  color: var(--credit-text);
  font-size: 12px;
  font-weight: 600;
}

/** Credit Packages */

.credit-package-grid {
  display: flex;
  width: 100%;
  gap: 8px;
}

.credit-package {
  flex: 1;
  min-width: 0;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  border: 1px solid var(--credit-border);
  border-radius: 50px;

  color: var(--credit-text);
  background: var(--credit-surface);

  cursor: pointer;
  white-space: nowrap;

  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.credit-package-credits {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: var(--credit-text);
}

.credit-package-price {
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  color: var(--credit-muted);
}

.credit-package:hover {
  border-color: var(--credit-primary);
  background: var(--credit-primary-soft);
}

.credit-package.active {
  border-color: var(--credit-primary);
  background: var(--credit-primary-soft);
}

.credit-package.active .credit-package-credits {
  color: var(--credit-primary);
}

.credit-package.active .credit-package-price {
  color: var(--credit-primary);
}

/** Custom Input */

.credit-input-group {
  display: flex;
  align-items: center;
  height: 42px;
  border: 1px solid var(--credit-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--credit-surface);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.credit-input-group:focus-within {
  border-color: var(--credit-primary);
  box-shadow: 0 0 0 3px var(--credit-primary-soft);
}

.credit-input-prefix {
  display: flex;
  padding-left: 12px;
  color: var(--credit-primary);
}

.credit-input {
  height: 100%;

  border: 0 !important;
  box-shadow: none !important;

  color: var(--credit-text);
  background: transparent !important;

  font-size: 13px;
  font-weight: 600;
}

.credit-input::placeholder {
  color: var(--credit-muted);
}

.credit-input-suffix {
  padding-right: 12px;
  color: var(--credit-muted);
  font-size: 10px;
  font-weight: 600;
}

.credit-modal-dialog {
  max-width: 700px;
}
