@import "global.css";
/* --- Vyra Global Text Selection (#ffbe8e) --- */
::selection {
  background-color: #ffbe8e !important;
  color: #0d0d14 !important;
}
::-moz-selection {
  background-color: #ffbe8e !important;
  color: #0d0d14 !important;
}

/* =========================================================================
   VYRA — PAGE "FACTURATION"
   Comme pour Générer et Historique, ce fichier ne redéfinit aucun token :
   il s'appuie sur les variables, la sidebar, la navbar, .stat-card et
   .section-heading déjà définis dans assets/css/dashboard.css (chargé
   avant celui-ci). Il ajoute uniquement les composants propres à cette
   page : hero + badge de plan, carte plan/usage, actions d'abonnement,
   moyen de paiement, informations de facturation, historique des
   paiements et bandeau sécurité.
   ========================================================================= */

/* =========================================================================
   HERO + BADGE DE PLAN
   ========================================================================= */
.billing-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}
.billing-hero-content h1 {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin: 0.5rem 0 0.4rem;
}
.billing-hero-content p {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.6;
}
.plan-badge {
  display: inline-flex; align-items: center; gap: 0.55rem;
  flex-shrink: 0;
  background: var(--accent-tint);
  border: 1px solid rgba(224, 138, 73, 0.35);
  color: var(--accent-strong);
  font-size: 0.85rem; font-weight: 700;
  padding: 0.6rem 1.1rem;
  border-radius: 100px;
}
.plan-badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-strong);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: planBadgePulse 2s infinite;
}
@keyframes planBadgePulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.4); } }

/* =========================================================================
   CARTE VERRE GÉNÉRIQUE (même recette glassmorphism que le reste du SaaS)
   ========================================================================= */
.glass-card {
  background: var(--bg-surface, #ffffff);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.75rem;
  box-shadow: var(--shadow-card);
  margin-bottom: 1.5rem;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.glass-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.1rem; gap: 0.75rem; flex-wrap: wrap; }
.glass-card-header h2 { font-size: 1.02rem; font-weight: 700; color: var(--text-primary); letter-spacing: -0.01em; }

.status-badge {
  font-size: 0.72rem; font-weight: 700;
  padding: 0.28rem 0.7rem;
  border-radius: 100px;
  white-space: nowrap;
}
.status-badge.status-active { background: rgba(52,211,153,0.14); color: #34d399; }
.status-badge.status-canceled { background: rgba(248,113,113,0.14); color: #f87171; }

/* =========================================================================
   PLAN ACTUEL + UTILISATION
   ========================================================================= */
.plan-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.6rem;
}
.plan-info-item {
  display: flex; flex-direction: column; gap: 0.35rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-md);
  background: var(--bg-glass-1);
  border: 1px solid var(--border-soft);
}
.plan-info-label { font-size: 0.74rem; color: var(--text-muted); font-weight: 600; }
.plan-info-value { font-family: 'Sora', sans-serif; font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }
.plan-info-value small { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); margin-left: 2px; }

.usage-block { padding-top: 0.4rem; }
.usage-block-top {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; color: var(--text-secondary);
  margin-bottom: 0.6rem;
}
.usage-block-top strong { color: var(--text-primary); }
.usage-bar-track {
  width: 100%; height: 10px;
  border-radius: 100px;
  background: var(--bg-glass-1);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}
.usage-bar-fill {
  height: 100%;
  border-radius: 100px;
  background: #ff6f6f;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}
.usage-block-note { display: block; font-size: 0.76rem; color: var(--text-muted); margin-top: 0.6rem; }

/* =========================================================================
   BOUTONS DE FACTURATION (même langage que les autres pages : pill, glow,
   variantes primaire / ghost / danger)
   ========================================================================= */
.subscription-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.billing-btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.75rem 1.3rem;
  border-radius: 100px;
  background: var(--bg-glass-1);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-size: 0.86rem; font-weight: 600;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.billing-btn svg { width: 16px; height: 16px; }
.billing-btn:hover { background: var(--bg-glass-2); color: var(--text-primary); transform: translateY(-1px); }

.billing-btn-primary {
  background: #ff6f6f;
  border-color: transparent;
  color: #fff;
  box-shadow: 0 10px 26px rgba(224, 138, 73, 0.35);
}
.billing-btn-primary:hover { color: #fff; box-shadow: 0 14px 34px rgba(224, 138, 73, 0.5); filter: brightness(1.05); }

.billing-btn-ghost { background: transparent; }

.billing-btn-danger:hover { background: rgba(239,68,68,0.12); color: #f87171; border-color: rgba(239,68,68,0.3); }

.billing-btn-block { width: 100%; justify-content: center; margin-top: 1.2rem; }

/* =========================================================================
   MOYEN DE PAIEMENT + INFORMATIONS — grille 2 colonnes
   ========================================================================= */
.billing-split-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
  align-items: start;
}
.billing-split-grid .glass-card { margin-bottom: 0; }

/* Carte bancaire visuelle (mockup) */
.payment-card-visual {
  position: relative;
  border-radius: 16px;
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.3rem;
  background: #141418;
  border: 1px solid rgba(255, 190, 142, 0.25);
  color: #fff;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(20, 20, 26, 0.25);
}
.payment-card-visual::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.payment-card-chip {
  width: 34px; height: 24px;
  border-radius: 5px;
  background: #eab308;
  margin-bottom: 1.6rem;
}
.payment-card-number {
  font-family: 'Sora', sans-serif;
  font-size: 1.05rem; font-weight: 700;
  letter-spacing: 0.06em;
  margin-bottom: 1.4rem;
}
.payment-card-bottom {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.72rem; letter-spacing: 0.04em;
  color: rgba(255,255,255,0.85);
}

.payment-card-details, .billing-info-list {
  display: flex; flex-direction: column; gap: 0.7rem;
  margin-bottom: 1.3rem;
}
.payment-detail-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.payment-detail-row:last-child { border-bottom: none; }
.payment-detail-label { font-size: 0.8rem; color: var(--text-muted); }
.payment-detail-value { font-size: 0.86rem; font-weight: 600; color: var(--text-primary); text-align: right; }

.payment-card-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* =========================================================================
   HISTORIQUE DES PAIEMENTS
   ========================================================================= */
.invoices-count { font-size: 0.78rem; color: var(--text-muted); }
.table-scroll { overflow-x: auto; }
.billing-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.billing-table thead th {
  text-align: left;
  font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.9rem 0.9rem;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.billing-table thead th.col-actions { text-align: right; }
.billing-table tbody td {
  padding: 0.85rem 0.9rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
.billing-table tbody tr:last-child td { border-bottom: none; }
.billing-table tbody tr { transition: background 0.2s var(--ease); }
.billing-table tbody tr:hover td { background: var(--bg-glass-1); }
.billing-table td.cell-invoice { color: var(--text-primary); font-weight: 600; }
.billing-table td.col-actions { text-align: right; white-space: nowrap; }

.invoice-row-actions { display: inline-flex; gap: 0.4rem; }
.invoice-action-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-secondary);
  background: var(--bg-glass-1);
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}
.invoice-action-btn:hover { background: var(--accent-strong); color: #fff; transform: translateY(-1px); }
.invoice-action-btn svg { width: 14px; height: 14px; }

/* Squelette de chargement (au premier affichage du tableau) */
.skeleton-row td { padding: 0.85rem 0.9rem; }
.skeleton-bar {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-glass-1) 25%, var(--border-strong) 50%, var(--bg-glass-1) 75%);
  background-size: 200% 100%;
  animation: billingShimmer 1.4s ease-in-out infinite;
}
@keyframes billingShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* =========================================================================
   CONSOMMATION — réutilise .stat-card de dashboard.css
   ========================================================================= */
.consumption-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.1rem;
  margin-bottom: 1.5rem;
}
.consumption-grid .stat-card-value { font-size: 1.3rem; }

/* =========================================================================
   SÉCURITÉ
   ========================================================================= */
.security-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}
.security-item {
  display: flex; align-items: flex-start; gap: 0.9rem;
  padding: 1.3rem 1.4rem;
  border-radius: var(--radius-md);
  background: linear-gradient(160deg, var(--bg-glass-1), var(--bg-glass-2));
  border: 1px solid var(--border-soft);
  transition: transform 0.25s var(--ease), border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.security-item:hover { transform: translateY(-3px); border-color: rgba(224, 138, 73, 0.35); box-shadow: 0 14px 34px var(--accent-glow); }
.security-icon {
  width: 42px; height: 42px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--accent-tint);
  color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
}
.security-icon svg { width: 20px; height: 20px; }
.security-item h3 { font-size: 0.92rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.3rem; }
.security-item p { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.55; }

/* =========================================================================
   RESPONSIVE
   Desktop : disposition multi-colonnes — Tablette : 2 colonnes — Mobile : 1
   ========================================================================= */
@media (max-width: 1180px) {
  .plan-card-grid { grid-template-columns: repeat(2, 1fr); }
  .consumption-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1024px) {
  .billing-split-grid { grid-template-columns: 1fr; }
  .security-band { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .billing-hero { flex-direction: column; align-items: flex-start; }
  .plan-badge { width: 100%; justify-content: center; }
  .plan-card-grid { grid-template-columns: 1fr 1fr; }
  .consumption-grid { grid-template-columns: 1fr 1fr; }
  .security-band { grid-template-columns: 1fr; }
  .subscription-actions { flex-direction: column; }
  .billing-btn { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .plan-card-grid { grid-template-columns: 1fr; }
  .consumption-grid { grid-template-columns: 1fr; }
  .glass-card { padding: 1.3rem 1.15rem; }
}