// ========================================
// BILLING — Shared Components
// ========================================

.billing-title {
  font-weight: 700;
  font-size: 1.5rem;
}

.billing-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
}

.billing-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e5e7eb;
  font-weight: 600;
}

.billing-card-body {
  padding: 1.25rem;
}

.billing-empty-state-icon {
  font-size: 2.5rem;
}

// ========================================
// BILLING — Badges
// ========================================

.badge-billing {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;

  &.badge-active {
    background: #d1fae5;
    color: #065f46;
  }

  &.badge-pending {
    background: #fef3c7;
    color: #92400e;
  }

  &.badge-failed,
  &.badge-expired {
    background: #fee2e2;
    color: #991b1b;
  }

  &.badge-cancelled {
    background: #fef3c7;
    color: #92400e;
  }

  &.badge-trial {
    background: #dbeafe;
    color: #1e40af;
  }

  &.badge-paid {
    background: #d1fae5;
    color: #065f46;
  }

  &.badge-refunded {
    background: #dbeafe;
    color: #1e40af;
  }
}

// ========================================
// BILLING — Tables
// ========================================

.th-billing {
  padding: 0.75rem;
  font-weight: 600;
  color: #6b7280;
  border: none;
  background: #f8fafc;
  font-size: 0.82rem;
}

.td-billing {
  padding: 0.75rem;
  vertical-align: middle;
  border-color: #f3f4f6;
  font-size: 0.85rem;
}

// ========================================
// BILLING — Billing Pages (shared wrapper)
// ========================================

.billing-page {
  max-width: 1100px;

  &.change-plan-page {
    max-width: 1200px;
  }

  &.current-plan-page {
    .badge-billing {
      padding: 0.3rem 0.75rem;
      font-size: 0.75rem;
    }
  }

  .billing-empty-icon {
    font-size: 3rem;
    color: #d1d5db;
  }

  .billing-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f3f4f6;

    &:last-child {
      border-bottom: none;
    }
  }

  .billing-label {
    color: #6b7280;
    font-size: 0.88rem;
  }

  .billing-value {
    font-size: 0.88rem;
  }

  .limit-row {
    margin-bottom: 0.5rem;
  }

  .gap-1 {
    gap: 0.25rem;
  }

  .gap-2 {
    gap: 0.5rem;
  }

  .gap-3 {
    gap: 0.75rem;
  }

  .download-btn {
    font-size: 0.72rem;
    border-radius: 8px;
  }

  .action-btn {
    font-size: 0.72rem;
    border-radius: 8px;
  }

  // --- Current Plan ---

  .pending-notice,
  .cancelled-notice {
    background: #fef3c7;
    color: #92400e;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
  }

  .pending-upgrade-alert {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 1.15rem 1.25rem;
    color: #1e3a5f;
  }

  .pending-upgrade-alert h5 {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1d4ed8;
    margin: 0;
  }

  .pending-upgrade-alert p {
    font-size: 0.85rem;
    line-height: 1.5;
  }

  .pending-upgrade-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    background: #dbeafe;
    color: #2563eb;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
  }

  .billing-plan-ended-desc {
    max-width: 450px;
    margin: 0 auto;
  }

  .modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
  }

  .confirm-modal {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);

    h4 {
      font-weight: 700;
      margin-bottom: 0.5rem;
    }

    p {
      font-size: 0.88rem;
      margin-bottom: 1rem;
    }
  }

  .confirm-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #fee2e2;
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    font-size: 1.5rem;
  }

  .cancel-info {
    background: #f8fafc;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
  }

  .usage-limit-item {
    margin-bottom: 0.875rem;

    &:last-child {
      margin-bottom: 0;
    }
  }

  .usage-limit-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: #6b7280;
  }

  .usage-limit-icon {
    width: 1rem;
    text-align: center;
    font-size: 0.85rem;
  }

  .usage-limit-value {
    font-size: 0.82rem;
    font-weight: 600;
  }

  .usage-progress-track {
    height: 5px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
  }

  .usage-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;

    &.bg-primary {
      background: #6366f1;
    }

    &.bg-warning {
      background: #f59e0b;
    }

    &.bg-danger {
      background: #ef4444;
    }
  }

  .feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.375rem;
    border-radius: 8px;
    font-size: 0.85rem;

    &.feature-enabled {
      background: #ecfdf5;
      border: 1px solid #a7f3d0;

      .feature-status-icon {
        color: #10b981;
      }

      .feature-label {
        color: #1e293b;
      }
    }

    &.feature-disabled {
      background: #f8fafc;
      border: 1px solid #e5e7eb;

      .feature-status-icon {
        color: #94a3b8;
      }

      .feature-label {
        color: #94a3b8;
      }
    }
  }

  .feature-status-icon {
    font-size: 0.9rem;
  }

  .feature-label {
    font-weight: 500;
  }

  .expired-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fee2e2;
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    font-size: 1.75rem;
  }

  .expired-plan-info {
    background: #f8fafc;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-size: 0.88rem;
    display: inline-block;
  }

  // --- Change Plan ---

  .cycle-toggle {
    background: #f1f5f9;
    border-radius: 10px;
    padding: 4px;
  }

  .cycle-btn {
    padding: 0.4rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.88rem;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s;

    &.active {
      background: #fff;
      color: #6366f1;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    }
  }

  .save-badge {
    background: #10b981;
    color: #fff;
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
  }

  .plan-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 1.75rem 1.5rem;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s;

    &:hover {
      border-color: #a5b4fc;
    }

    &.plan-current {
      border-color: #6366f1;
    }
  }

  .plan-current-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #d1fae5;
    color: #065f46;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
  }

  .plan-name {
    font-weight: 700;
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
  }

  .plan-slug {
    font-size: 0.82rem;
    margin-bottom: 1rem;
  }

  .plan-price {
    margin-bottom: 0.5rem;
  }

  .price-amount {
    font-weight: 800;
    font-size: 2rem;
    line-height: 1;
  }

  .price-period {
    color: #6b7280;
    font-size: 0.88rem;
  }

  .plan-savings {
    display: inline-block;
    background: #d1fae5;
    color: #065f46;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
  }

  .plan-section-label {
    font-weight: 600;
    font-size: 0.72rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
  }

  .plan-feature-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    margin-bottom: 4px;
  }

  .plan-feature-icon {
    width: 16px;
    font-size: 0.8rem;
  }

  // --- Checkout ---

  .sticky-card {
    position: sticky;
    top: 80px;
  }

  .summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    font-size: 0.88rem;
  }

  .summary-total-label {
    font-size: 1.05rem;
  }

  .summary-total-amount {
    font-size: 1.2rem;
  }

  .summary-included {
    border-top: 1px solid #f3f4f6;
  }

  .upgrade-note {
    background: #fef3c7;
    color: #92400e;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-size: 0.82rem;
  }

  .cycle-option {
    cursor: pointer;

    &:hover .cycle-card {
      border-color: #c7d2fe;
    }

    &.selected .cycle-card {
      border-color: #6366f1;
      background: #eef2ff;
    }
  }

  .cycle-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.15s;
  }

  .save-chip {
    background: #10b981;
    color: #fff;
    font-size: 0.62rem;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 4px;
  }

  .gateway-option {
    cursor: pointer;

    &:hover .gateway-card {
      border-color: #c7d2fe;
    }

    &.selected .gateway-card {
      border-color: #6366f1;
      background: #eef2ff;
    }

    &.selected .gateway-check {
      color: #6366f1;
    }
  }

  .gateway-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.15s;
  }

  .gateway-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
  }

  .gateway-check {
    font-size: 1.2rem;
    color: #9ca3af;
  }

  .gateway-description {
    font-size: 0.72rem;
  }

  .no-gateways-icon {
    font-size: 2rem;
  }

  .offline-methods-panel {
    border: 1px solid #e5e7eb;
  }

  .proof-upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;

    &:hover {
      border-color: #6366f1;
      background: #f5f3ff;
    }
  }

  .proof-upload-icon {
    font-size: 1.5rem;
  }

  .proof-file-icon {
    font-size: 1.5rem;
    color: #6366f1;
  }

  .proof-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
  }
}

// ========================================
// BILLING — Payment Results
// ========================================

.result-page {
  max-width: 600px;
  margin: 3rem auto;

  .result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2.5rem;

    &.result-success {
      background: #d1fae5;
      color: #10b981;
    }

    &.result-processing {
      background: #fef3c7;
    }

    &.result-failed {
      background: #fee2e2;
      color: #ef4444;
    }
  }

  .result-spinner {
    width: 2.5rem;
    height: 2.5rem;
  }

  .result-title {
    font-weight: 800;
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
  }

  .result-desc {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .result-detail-card {
    max-width: 480px;
  }

  .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.45rem 0;
    font-size: 0.88rem;
    border-bottom: 1px solid #f3f4f6;

    &:last-child {
      border-bottom: none;
    }
  }

  .tips-box {
    background: #eef2ff;
    padding: 1rem;
    border-radius: 12px;
    max-width: 480px;
  }

  .gap-3 {
    gap: 0.75rem;
  }
}
