/* Page plans/facturation - toggle mensuel/annuel + grille de cartes generees par billing.js. */

.billing-toggle {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 14px 0 32px;
}

.toggle-btn {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border: 1.5px solid var(--color-border);
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.toggle-btn-active {
  background: var(--gradient-brand);
  color: white;
  border-color: transparent;
}

/* Badge pose a cheval sur le coin du bouton Annuel, comme une etiquette : il se remarque sans
   agrandir le bouton, et reste lisible que l'annuel soit selectionne ou non. */
#toggle-yearly {
  position: relative;
}

.toggle-save {
  position: absolute;
  top: -9px;
  right: -30px;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  background: var(--color-accent);
  color: #052e1f;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 8px rgba(52, 211, 153, 0.3);
}

/* Quatre plans. En "auto-fit, minmax(240px)" ils tombaient en 3 + 1 selon la largeur, et le
   plan seul sur sa ligne s'etirait sur toute la page : le plus cher avait l'air d'une erreur
   de mise en page. On impose donc des paliers francs - 4 de front, puis 2 x 2, puis 1 - pour
   qu'aucune rangee ne reste depareillee. */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  align-items: stretch;
}

@media (max-width: 1100px) {
  .plans-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.plan-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

.plan-card-featured {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

.plan-card-current {
  border-color: var(--color-accent);
}

.plan-badge {
  position: absolute;
  top: -12px;
  right: 20px;
  background: var(--gradient-brand);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
}

.plan-current-badge {
  align-self: flex-start;
}

.plan-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}

.plan-price {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.plan-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13.5px;
  color: var(--color-text-secondary);
  flex-grow: 1;
}

.plan-features li::before {
  content: '✓ ';
  color: var(--color-accent);
  font-weight: 700;
}

.manage-link {
  grid-column: 1 / -1;
  text-align: center;
  margin-top: 8px;
}

.manage-link a {
  color: var(--color-primary-dark);
  text-decoration: none;
  font-weight: 600;
}

.manage-link a:hover {
  text-decoration: underline;
}

/* Carte de rachat de minutes. Volontairement sous la grille des plans et non dedans : c'est un
   depannage, pas une quatrieme formule - la mettre au milieu des abonnements detournerait des
   souscriptions vers une option dont le prix a la minute est moins avantageux. */
.topup-card {
  margin-top: 28px;
  text-align: center;
}

.topup-card h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.topup-note {
  margin: 12px 0 0;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}

/* La carte du pack reste affichee en permanence a cote des forfaits, mais ne se met en avant
   que lorsque l'achat est reellement possible (voir renderTopup dans billing.js). */
.topup-card:not(.topup-card-actif) {
  border-style: dashed;
  opacity: 0.85;
}

/* .btn est un inline-flex : sans cette regle, l'attribut hidden resterait sans effet. */
#topup-btn[hidden] {
  display: none;
}
