/* ===========================================
   BILLING — Checkout via Mercado Pago
   Modo claro (padrão) + modo escuro via [data-theme="dark"]
   =========================================== */

/* ===== PAYWALL OVERLAY ===== */
.billing-wall {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: billingFadeIn 0.3s ease;
}

.billing-wall-content {
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  max-width: 820px;
  width: 95%;
  text-align: center;
  border: 1px solid #e5e7eb;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
}

.billing-wall-header {
  margin-bottom: 24px;
}

.billing-wall-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: white;
}

.billing-wall-header h2 {
  font-size: 22px;
  color: #1f2937;
  margin: 0 0 8px;
}

.billing-wall-header p {
  color: #6b7280;
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

/* ===== PLANS GRID ===== */
.billing-plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  text-align: left;
}

@media (max-width: 640px) {
  .billing-plans-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== PLAN CARD ===== */
.billing-plan-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 28px;
  position: relative;
  transition: all 0.3s;
}

.billing-plan-card:hover {
  border-color: #c4b5fd;
  box-shadow: 0 8px 30px rgba(99, 102, 241, 0.08);
}

.billing-plan-card.plan-featured {
  border: 2px solid #8b5cf6;
  background: linear-gradient(
    180deg,
    rgba(139, 92, 246, 0.03) 0%,
    #f9fafb 100%
  );
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
}

.plan-badge-featured {
  background: linear-gradient(135deg, #f59e0b, #d97706) !important;
}

.plan-billing-info {
  font-size: 12px;
  color: #6b7280;
  margin: 0 0 12px;
}

.plan-savings {
  display: inline-block;
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}

.billing-subscribe-btn.btn-featured {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.billing-subscribe-btn.btn-featured:hover {
  background: linear-gradient(135deg, #7c4fe0, #6d28d9);
  box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

/* ===== INLINE PLAN BUTTONS (billing section) ===== */
.billing-plans-inline {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.billing-plans-inline .billing-subscribe-btn {
  flex: 1;
  font-size: 13px;
  padding: 12px 16px;
}

@media (max-width: 640px) {
  .billing-plans-inline {
    flex-direction: column;
  }
}

.plan-badge {
  display: inline-block;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 1px;
  margin-bottom: 12px;
}

.billing-plan-card h3 {
  color: #1f2937;
  font-size: 20px;
  margin: 0 0 16px;
}

.plan-price {
  margin-bottom: 20px;
}

.price-currency {
  font-size: 18px;
  color: #6b7280;
  vertical-align: super;
}

.price-value {
  font-size: 42px;
  font-weight: 800;
  color: #1f2937;
  line-height: 1;
}

.price-period {
  font-size: 14px;
  color: #9ca3af;
}

.plan-features {
  text-align: left;
  margin-bottom: 24px;
}

.plan-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: #374151;
  font-size: 13px;
}

.plan-feature i {
  color: #10b981;
  font-size: 12px;
  flex-shrink: 0;
}

/* ===== SUBSCRIBE BUTTON ===== */
.billing-subscribe-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.billing-subscribe-btn:hover {
  background: linear-gradient(135deg, #5558e6, #7c4fe0);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

.billing-secure-badge {
  margin-top: 12px;
  color: #9ca3af;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.billing-logout-btn {
  background: transparent;
  border: 1px solid #d1d5db;
  color: #6b7280;
  padding: 10px 20px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.billing-logout-btn:hover {
  border-color: #9ca3af;
  color: #374151;
}

/* ===== CHECKOUT MODAL ===== */
.checkout-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: billingFadeIn 0.3s ease;
  overflow-y: auto;
  padding: 20px;
}

.checkout-modal {
  background: #fff;
  border-radius: 20px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  border: 1px solid #e5e7eb;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.15);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.checkout-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: #f3f4f6;
  border: none;
  color: #6b7280;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.checkout-close:hover {
  background: #e5e7eb;
  color: #1f2937;
}

.checkout-header {
  text-align: center;
  margin-bottom: 28px;
}

.checkout-logo {
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
}

.checkout-header h2 {
  font-size: 20px;
  color: #1f2937;
  margin: 0 0 10px;
}

.checkout-trial-info {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 10px;
  padding: 10px 16px;
  color: #059669;
  font-size: 13px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

/* ===== FORM SECTIONS ===== */
.checkout-section {
  margin-bottom: 24px;
}

.checkout-section h3 {
  font-size: 14px;
  color: #6b7280;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.checkout-section h3 i {
  color: #6366f1;
}

.checkout-field {
  margin-bottom: 14px;
}

.checkout-field label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.checkout-field input {
  width: 100%;
  padding: 12px 14px;
  background: #f9fafb;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  color: #1f2937;
  font-size: 15px;
  font-family: "Inter", "Roboto Mono", monospace;
  transition: all 0.2s;
  box-sizing: border-box;
}

.checkout-field input:focus {
  outline: none;
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.checkout-field input::placeholder {
  color: #9ca3af;
}

.card-input-wrapper {
  position: relative;
}

.card-input-wrapper input {
  padding-right: 50px;
}

.card-brand-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
}

.checkout-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ===== SUMMARY ===== */
.checkout-summary {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  color: #374151;
  font-size: 14px;
}

.summary-row.trial {
  color: #059669;
}

.trial-free {
  font-weight: 700;
  color: #059669;
}

.summary-divider {
  height: 1px;
  background: #e5e7eb;
  margin: 8px 0;
}

.summary-row.total {
  font-weight: 700;
  font-size: 16px;
  color: #1f2937;
}

.total-value {
  color: #059669;
  font-size: 18px;
}

.summary-note {
  color: #9ca3af;
  font-size: 11px;
  margin: 10px 0 0;
  line-height: 1.5;
}

/* ===== SUBMIT BUTTON ===== */
.checkout-submit-btn {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.checkout-submit-btn:hover {
  background: linear-gradient(135deg, #0ea572, #047857);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(16, 185, 129, 0.3);
}

/* ===== SECURITY BADGES ===== */
.checkout-security {
  text-align: center;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}

.mercadopago-logo {
  height: 24px;
  opacity: 0.5;
  margin-bottom: 8px;
}

.security-badges {
  display: flex;
  justify-content: center;
  gap: 16px;
  color: #9ca3af;
  font-size: 11px;
}

.security-badges span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ===== PROCESSING ===== */
.checkout-processing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
}

.processing-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(99, 102, 241, 0.2);
  border-top-color: #6366f1;
  border-radius: 50%;
  animation: billingSpin 0.8s linear infinite;
  margin-bottom: 20px;
}

.checkout-processing h3 {
  color: #1f2937;
  font-size: 18px;
  margin: 0 0 8px;
}

.checkout-processing p {
  color: #6b7280;
  font-size: 13px;
  margin: 0;
}

/* ===== SUCCESS ===== */
.checkout-success {
  text-align: center;
  padding: 20px;
}

.success-icon {
  font-size: 64px;
  color: #10b981;
  margin-bottom: 16px;
  animation: billingScaleIn 0.4s ease;
}

.checkout-success h2 {
  color: #1f2937;
  font-size: 22px;
  margin: 0 0 8px;
}

.checkout-success > p {
  color: #6b7280;
  font-size: 14px;
  margin: 0 0 24px;
}

.success-details {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 24px;
  text-align: left;
}

.success-details .detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  color: #374151;
  font-size: 14px;
}

.success-details .detail-row + .detail-row {
  border-top: 1px solid #e5e7eb;
}

.checkout-done-btn {
  width: 100%;
  padding: 14px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.checkout-done-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.3);
}

/* ===== BILLING SECTION (Dashboard) ===== */
.billing-section {
  padding: 24px;
  max-width: 800px;
}

.billing-section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.billing-section-header h2 {
  font-size: 22px;
  color: #1f2937;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.billing-section-header h2 i {
  color: #6366f1;
}

.billing-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.billing-card h3 {
  font-size: 16px;
  color: #1f2937;
  margin: 0 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.billing-card h3 i {
  color: #6366f1;
}

.billing-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.billing-detail {
  background: #f9fafb;
  border-radius: 10px;
  padding: 12px 16px;
}

.detail-label {
  display: block;
  font-size: 10px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.detail-value {
  color: #1f2937;
  font-size: 14px;
  font-weight: 600;
}

/* ===== BADGES ===== */
.billing-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.billing-badge.active {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.billing-badge.trial {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.billing-badge.pending {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}

.billing-badge.overdue {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.billing-badge.cancelled {
  background: rgba(107, 114, 128, 0.1);
  color: #6b7280;
}

.billing-badge.suspended {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

/* ===== CANCEL BTN ===== */
.billing-cancel-btn {
  padding: 10px 20px;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.billing-cancel-btn:hover {
  background: rgba(239, 68, 68, 0.05);
  border-color: #dc2626;
}

/* ===== TRIAL PROMPT ===== */
.trial-subscribe-prompt {
  text-align: center;
  margin-top: 16px;
}

.trial-subscribe-prompt p {
  color: #6b7280;
  font-size: 13px;
  margin: 0 0 16px;
}

.trial-note {
  display: block;
  margin-top: 8px;
  color: #9ca3af;
  font-size: 12px;
}

/* ===== INVOICES ===== */
.invoices-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.invoice-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  background: #f9fafb;
  border-radius: 8px;
}

.invoice-info {
  display: flex;
  flex-direction: column;
}

.invoice-plan {
  color: #1f2937;
  font-weight: 600;
  font-size: 14px;
}

.invoice-date {
  color: #9ca3af;
  font-size: 12px;
  margin-top: 2px;
}

.invoice-amount {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #1f2937;
  font-weight: 600;
}

/* ===== LOADING & ERROR ===== */
.billing-loading {
  text-align: center;
  padding: 60px;
  color: #6b7280;
  font-size: 16px;
}

.billing-loading i {
  margin-right: 8px;
  color: #6366f1;
}

.billing-error {
  text-align: center;
  padding: 60px;
  color: #6b7280;
}

.billing-error i {
  font-size: 40px;
  color: #dc2626;
  margin-bottom: 16px;
}

.billing-error button {
  margin-top: 16px;
  padding: 10px 20px;
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.billing-no-subscription {
  text-align: center;
}

.billing-no-subscription > p {
  color: #6b7280;
  margin-bottom: 16px;
}

/* ===== ANIMATIONS ===== */
@keyframes billingFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes billingSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes billingScaleIn {
  from {
    transform: scale(0);
  }
  to {
    transform: scale(1);
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 560px) {
  .billing-wall-content,
  .checkout-modal {
    padding: 24px;
    border-radius: 16px;
  }

  .billing-details-grid {
    grid-template-columns: 1fr;
  }

  .price-value {
    font-size: 32px;
  }
}

/* ==========================================================
   DARK MODE — [data-theme="dark"]
   ========================================================== */

[data-theme="dark"] .billing-wall {
  background: rgba(10, 10, 20, 0.92);
}

[data-theme="dark"] .billing-wall-content {
  background: linear-gradient(145deg, #1a1d2e, #12141f);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .billing-wall-header h2 {
  color: #fff;
}

[data-theme="dark"] .billing-wall-header p {
  color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .billing-plan-card {
  background: linear-gradient(145deg, #1f2235, #191b2a);
  border-color: rgba(99, 102, 241, 0.2);
}

[data-theme="dark"] .billing-plan-card h3 {
  color: #fff;
}

[data-theme="dark"] .price-currency {
  color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .price-value {
  color: #fff;
}

[data-theme="dark"] .price-period {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .plan-feature {
  color: rgba(255, 255, 255, 0.8);
}

[data-theme="dark"] .billing-secure-badge {
  color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .billing-logout-btn {
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .billing-logout-btn:hover {
  border-color: rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
}

/* Checkout Modal — Dark */
[data-theme="dark"] .checkout-modal-overlay {
  background: rgba(10, 10, 20, 0.9);
}

[data-theme="dark"] .checkout-modal {
  background: linear-gradient(145deg, #1a1d2e, #12141f);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .checkout-close {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .checkout-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

[data-theme="dark"] .checkout-header h2 {
  color: #fff;
}

[data-theme="dark"] .checkout-trial-info {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: #10b981;
}

[data-theme="dark"] .checkout-section h3 {
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .checkout-field label {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .checkout-field input {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

[data-theme="dark"] .checkout-field input:focus {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.06);
}

[data-theme="dark"] .checkout-field input::placeholder {
  color: rgba(255, 255, 255, 0.25);
}

[data-theme="dark"] .checkout-summary {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .summary-row {
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .summary-row.trial {
  color: #10b981;
}

[data-theme="dark"] .summary-divider {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .summary-row.total {
  color: #fff;
}

[data-theme="dark"] .summary-note {
  color: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .checkout-security {
  border-top-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .mercadopago-logo {
  filter: brightness(0) invert(1);
}

[data-theme="dark"] .security-badges {
  color: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .checkout-processing h3 {
  color: #fff;
}

[data-theme="dark"] .checkout-processing p {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .checkout-success h2 {
  color: #fff;
}

[data-theme="dark"] .checkout-success > p {
  color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .success-details {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .success-details .detail-row {
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .success-details .detail-row + .detail-row {
  border-top-color: rgba(255, 255, 255, 0.05);
}

/* Billing Section — Dark */
[data-theme="dark"] .billing-section-header h2 {
  color: #fff;
}

[data-theme="dark"] .billing-card {
  background: linear-gradient(145deg, #1a1d2e, #14162a);
  border-color: rgba(255, 255, 255, 0.06);
  box-shadow: none;
}

[data-theme="dark"] .billing-card h3 {
  color: #fff;
}

[data-theme="dark"] .billing-detail {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .detail-label {
  color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .detail-value {
  color: #fff;
}

[data-theme="dark"] .billing-badge.active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

[data-theme="dark"] .billing-badge.trial {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

[data-theme="dark"] .billing-badge.pending {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

[data-theme="dark"] .billing-badge.overdue {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

[data-theme="dark"] .billing-badge.cancelled {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
}

[data-theme="dark"] .billing-cancel-btn {
  color: #ef4444;
}

[data-theme="dark"] .billing-cancel-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

[data-theme="dark"] .trial-subscribe-prompt p {
  color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .trial-note {
  color: rgba(255, 255, 255, 0.35);
}

[data-theme="dark"] .invoice-row {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .invoice-plan {
  color: #fff;
}

[data-theme="dark"] .invoice-date {
  color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .invoice-amount {
  color: #fff;
}

[data-theme="dark"] .billing-loading {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .billing-error {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .billing-no-subscription > p {
  color: rgba(255, 255, 255, 0.5);
}

/* ===== INVOICE CLICKABLE ROWS ===== */
.invoice-row-clickable {
  cursor: pointer;
  transition: all 0.2s ease;
}

.invoice-row-clickable:hover {
  background: rgba(99, 102, 241, 0.04) !important;
  transform: translateX(2px);
}

[data-theme="dark"] .invoice-row-clickable:hover {
  background: rgba(139, 92, 246, 0.1) !important;
}

/* ===== INVOICE MODAL OVERLAY ===== */
.invoice-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.invoice-modal-overlay.active {
  opacity: 1;
}

.invoice-modal {
  background: #fff;
  border-radius: 20px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2);
  animation: invoiceSlideIn 0.3s ease;
}

@keyframes invoiceSlideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===== INVOICE MODAL HEADER ===== */
.invoice-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.invoice-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.invoice-modal-header h3 i {
  color: #7c3aed;
}

.invoice-modal-close {
  background: #f3f4f6;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.invoice-modal-close:hover {
  background: #e5e7eb;
  color: #1e293b;
}

/* ===== INVOICE DOCUMENT ===== */
.invoice-document {
  padding: 28px 24px;
}

.invoice-doc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #7c3aed;
}

.invoice-doc-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #7c3aed;
}

.invoice-doc-logo i {
  font-size: 1.5rem;
}

.invoice-doc-number {
  text-align: right;
}

.invoice-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748b;
  margin-bottom: 2px;
}

.invoice-num {
  font-size: 0.95rem;
  font-weight: 700;
  color: #1e293b;
}

/* ===== INVOICE STATUS BAR ===== */
.invoice-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.invoice-status-paid {
  background: #dcfce7;
  color: #166534;
}

.invoice-status-pending {
  background: #fef3c7;
  color: #b45309;
}

.invoice-status-failed {
  background: #fee2e2;
  color: #991b1b;
}

.invoice-status-refunded {
  background: #f3f4f6;
  color: #6b7280;
}

/* ===== INVOICE SECTIONS ===== */
.invoice-section {
  margin-bottom: 20px;
}

.invoice-section h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #7c3aed;
  margin: 0 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 600;
}

.invoice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.invoice-field label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #64748b;
  margin-bottom: 3px;
  font-weight: 500;
}

.invoice-field span {
  font-size: 0.88rem;
  font-weight: 500;
  color: #1e293b;
}

.invoice-amount-value {
  font-size: 1.05rem !important;
  font-weight: 700 !important;
  color: #7c3aed !important;
}

/* ===== INVOICE SECURITY (LGPD) ===== */
.invoice-security {
  margin-top: 24px;
  padding: 14px 16px;
  background: #f8fafc;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.invoice-security-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: #64748b;
  margin-bottom: 6px;
}

.invoice-security-item:last-child {
  margin-bottom: 0;
}

.invoice-security-item i {
  color: #22c55e;
  width: 14px;
  text-align: center;
  font-size: 0.8rem;
}

/* ===== INVOICE FOOTER ===== */
.invoice-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 0.72rem;
  color: #94a3b8;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
}

.invoice-footer p {
  margin: 0 0 2px;
}

/* ===== INVOICE MODAL ACTIONS ===== */
.invoice-modal-actions {
  display: flex;
  gap: 10px;
  padding: 16px 24px 20px;
  border-top: 1px solid #e5e7eb;
}

.invoice-download-btn {
  flex: 1;
  padding: 12px 20px;
  background: linear-gradient(135deg, #7c3aed, #6366f1);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.invoice-download-btn:hover {
  background: linear-gradient(135deg, #6d28d9, #5558e6);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.invoice-close-btn {
  padding: 12px 20px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.invoice-close-btn:hover {
  background: #e5e7eb;
}

/* ===== INVOICE DARK MODE ===== */
[data-theme="dark"] .invoice-modal {
  background: #1e1e2e;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .invoice-modal-header {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .invoice-modal-header h3 {
  color: #fff;
}

[data-theme="dark"] .invoice-modal-close {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .invoice-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

[data-theme="dark"] .invoice-doc-header {
  border-color: #7c3aed;
}

[data-theme="dark"] .invoice-num {
  color: #fff;
}

[data-theme="dark"] .invoice-label {
  color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .invoice-status-paid {
  background: rgba(34, 197, 94, 0.12);
  color: #4ade80;
}

[data-theme="dark"] .invoice-status-pending {
  background: rgba(234, 179, 8, 0.12);
  color: #fbbf24;
}

[data-theme="dark"] .invoice-section h4 {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .invoice-field label {
  color: rgba(255, 255, 255, 0.4);
}

[data-theme="dark"] .invoice-field span {
  color: #fff;
}

[data-theme="dark"] .invoice-security {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .invoice-security-item {
  color: rgba(255, 255, 255, 0.5);
}

[data-theme="dark"] .invoice-footer {
  color: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .invoice-modal-actions {
  border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .invoice-close-btn {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.7);
}

[data-theme="dark"] .invoice-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* ===== MP CHECKOUT MODAL (Secure Fields) ===== */
.mp-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10100;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: billingFadeIn 0.25s ease;
}

.mp-modal {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.mp-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
}

.mp-modal-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.mp-modal-close:hover { background: rgba(255,255,255,0.3); }

.mp-modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mp-plan-summary {
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(139,92,246,0.04));
  border: 1px solid rgba(99,102,241,0.15);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mp-plan-summary strong { font-size: 15px; color: #1f2937; }
.mp-plan-price  { font-size: 18px; font-weight: 800; color: #6366f1; }
.mp-plan-trial  { font-size: 12px; color: #059669; }

.mp-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mp-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mp-input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 15px;
  color: #1f2937;
  background: #f9fafb;
  box-sizing: border-box;
  transition: all 0.2s;
}

.mp-input:focus {
  outline: none;
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

/* Secure Field divs — o SDK do MP injeta iframes aqui */
.mp-secure-field {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0 14px;
  height: 44px;
  display: flex;
  align-items: center;
  background: #f9fafb;
  transition: all 0.2s;
  overflow: hidden;
}

.mp-secure-field:focus-within {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.mp-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mp-error-msg {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.25);
  color: #dc2626;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.4;
}

.mp-security-note {
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
  margin: 0;
}

/* Dark mode */
[data-theme="dark"] .mp-modal {
  background: #1e293b;
}

[data-theme="dark"] .mp-plan-summary {
  background: rgba(99,102,241,0.1);
  border-color: rgba(99,102,241,0.2);
}

[data-theme="dark"] .mp-plan-summary strong { color: #e2e8f0; }

[data-theme="dark"] .mp-input,
[data-theme="dark"] .mp-secure-field {
  background: rgba(255,255,255,0.05);
  border-color: rgba(255,255,255,0.12);
  color: #e2e8f0;
}

[data-theme="dark"] .mp-input:focus,
[data-theme="dark"] .mp-secure-field:focus-within {
  background: rgba(255,255,255,0.08);
  border-color: #6366f1;
}

[data-theme="dark"] .mp-label { color: #94a3b8; }
