/* ==========================================================================
   ClassKit Global - Billing & Printable Receipt Styles
   Billing Summary, Purchase History Table, Official Reimbursement Voucher
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Billing & Receipts Page Layout
   -------------------------------------------------------------------------- */
.billing-container {
  max-width: 960px;
  margin: 36px auto 60px;
  padding: 0 20px;
}

.billing-header {
  margin-bottom: 28px;
}

.billing-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.billing-breadcrumbs a {
  color: inherit;
  text-decoration: none;
}

.billing-breadcrumbs a:hover {
  color: var(--primary);
}

.billing-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.billing-subtitle {
  font-size: 14px;
  color: var(--text-muted);
}

.billing-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

@media (max-width: 768px) {
  .billing-grid {
    grid-template-columns: 1fr;
  }
}

.billing-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg, 12px);
  padding: 24px;
  box-shadow: var(--shadow-xs);
}

.billing-card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.billing-plan-info {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
}

.plan-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.plan-icon-box.pro {
  background: var(--pro-gold-soft);
  border: 1px solid var(--pro-gold-border);
}

.plan-icon-box.free {
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
}

.plan-details-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.plan-details-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.plan-expiry-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

/* History Table */
.orders-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg, 12px);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.orders-table th {
  background: var(--bg-subtle);
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.orders-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  vertical-align: middle;
}

.orders-table tr:last-child td {
  border-bottom: none;
}

.orders-table tr:hover td {
  background: #FCFCFA;
}

.status-badge-paid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--accent-stem-soft);
  color: var(--accent-stem);
  border: 1px solid var(--accent-stem-border);
  font-size: 11px;
  font-weight: 700;
}

.status-badge-pending {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--warning-soft);
  color: var(--warning);
  border: 1px solid var(--pro-gold-border);
  font-size: 11px;
  font-weight: 700;
}

.btn-receipt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-receipt:hover {
  background: var(--bg-hover);
  border-color: var(--text-light);
  transform: translateY(-1px);
}

.empty-orders-state {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-orders-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

/* --------------------------------------------------------------------------
   2. Official Printable Receipt Modal & Print Engine
   -------------------------------------------------------------------------- */
.receipt-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease-out;
  padding: 20px;
}

.receipt-modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.receipt-modal-box {
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  background: #FFFFFF;
  border-radius: 12px;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.receipt-modal-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-medium);
}

.receipt-content-scroll {
  padding: 36px 40px;
  overflow-y: auto;
  color: #1E293B;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.voucher-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #E2E8F0;
  padding-bottom: 20px;
  margin-bottom: 24px;
}

.voucher-brand-name {
  font-size: 22px;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: -0.02em;
}

.voucher-brand-sub {
  font-size: 12px;
  color: #64748B;
  margin-top: 3px;
}

.voucher-title-badge {
  text-align: right;
}

.voucher-receipt-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #E11D48;
}

.voucher-receipt-id {
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  font-family: monospace;
}

.voucher-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
  font-size: 13px;
}

.voucher-meta-box {
  background: #F8FAFC;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
}

.voucher-meta-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748B;
  margin-bottom: 6px;
}

.voucher-item-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 13px;
}

.voucher-item-table th {
  background: #F1F5F9;
  border-bottom: 1px solid #CBD5E1;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #475569;
}

.voucher-item-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #E2E8F0;
}

.voucher-total-row td {
  border-bottom: none;
  font-size: 15px;
  font-weight: 800;
  color: #0F172A;
  padding-top: 16px;
}

.voucher-reimbursement-box {
  background: #F0FDF4;
  border: 1px dashed #86EFAC;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 12px;
  line-height: 1.5;
  color: #166534;
}

.voucher-footer-sign {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #94A3B8;
  border-top: 1px solid #E2E8F0;
  padding-top: 16px;
}

/* Print Engine */
@media print {
  body * {
    visibility: hidden;
  }
  .receipt-modal-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: #FFFFFF !important;
    padding: 0 !important;
    display: block !important;
    opacity: 1 !important;
    backdrop-filter: none !important;
  }
  .receipt-modal-box {
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    visibility: visible !important;
  }
  .receipt-modal-actions-bar {
    display: none !important;
  }
  .receipt-content-scroll {
    visibility: visible !important;
    padding: 0 !important;
    overflow: visible !important;
  }
  .receipt-content-scroll * {
    visibility: visible !important;
  }
}
