/* ==========================================================================
   iDSI — MODULE PANIER & CONFIRMATION DE PAIEMENT (UNIFIÉ MULTI-PAGES)
   Compatible pages sombres (index.html) et claires (formations.html, login.html)
   ========================================================================== */

/* Bouton Panier dans les barres de navigation */
.idsi-cart-nav-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.36);
  background: rgba(14, 27, 51, 0.88);
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.idsi-cart-nav-btn:hover {
  border-color: #38bdf8;
  background: #132442;
  transform: translateY(-1px);
}

.idsi-cart-nav-btn.light-surface {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1e3a8a;
}

.idsi-cart-nav-btn.light-surface:hover {
  background: #dbeafe;
  border-color: #2563eb;
}

.idsi-cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #38bdf8;
  color: #04101f;
  font-size: 0.74rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.idsi-cart-badge.empty {
  background: rgba(148, 163, 184, 0.28);
  color: #cbd5e1;
}

.idsi-cart-nav-btn.light-surface .idsi-cart-badge.empty {
  background: #cbd5e1;
  color: #334155;
}

html.partner-hide-prices .idsi-cart-nav-btn,
html.partner-hide-prices .idsi-cart-backdrop,
html.partner-hide-prices .idsi-cart-toast {
  display: none !important;
}

/* Backdrop + Tiroir Latéral Panier */
.idsi-cart-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100050;
  background: rgba(3, 7, 18, 0.74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  justify-content: flex-end;
}

.idsi-cart-backdrop.open {
  display: flex;
}

.idsi-cart-drawer {
  width: min(500px, 100vw);
  height: 100%;
  background: #091224;
  color: #f8fafc;
  border-left: 1px solid rgba(125, 211, 252, 0.22);
  box-shadow: -20px 0 60px rgba(1, 4, 12, 0.72);
  display: flex;
  flex-direction: column;
  font-family: 'Figtree', 'Inter', system-ui, -apple-system, sans-serif;
  animation: idsiCartSlideIn 0.26s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes idsiCartSlideIn {
  from {
    transform: translateX(36px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.idsi-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(148, 184, 224, 0.14);
  background: #070e1c;
}

.idsi-cart-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.idsi-cart-title {
  margin: 0;
  font-family: 'Bricolage Grotesque', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 1.18rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.idsi-cart-step-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.32);
  color: #7dd3fc;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.idsi-cart-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(148, 184, 224, 0.2);
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.idsi-cart-close:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(125, 211, 252, 0.45);
}

/* Barre d'étapes (1. Panier -> 2. Confirmation -> 3. Reçu) */
.idsi-cart-stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 12px 22px;
  border-bottom: 1px solid rgba(148, 184, 224, 0.12);
  background: rgba(10, 19, 38, 0.72);
}

.idsi-step-chip {
  text-align: center;
  padding: 6px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
}

.idsi-step-chip.active {
  color: #ffffff;
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.42);
}

.idsi-step-chip.done {
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.34);
}

.idsi-cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.idsi-cart-footer {
  padding: 16px 22px 20px;
  border-top: 1px solid rgba(148, 184, 224, 0.16);
  background: #070e1c;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Liste d'articles dans le panier */
.idsi-cart-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.idsi-cart-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #0e1b33;
  border: 1px solid rgba(148, 184, 224, 0.16);
}

.idsi-cart-item-main {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
  flex: 1;
}

.idsi-cart-item-ico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.24);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.idsi-cart-item-title {
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.35;
  color: #f8fafc;
}

.idsi-cart-item-meta {
  font-size: 0.76rem;
  color: #94a3b8;
  margin-top: 3px;
}

.idsi-cart-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.idsi-cart-item-price {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.9rem;
  font-weight: 700;
  color: #7dd3fc;
  white-space: nowrap;
}

.idsi-cart-remove-btn {
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid rgba(251, 113, 133, 0.28);
  background: rgba(251, 113, 133, 0.08);
  color: #fda4af;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.idsi-cart-remove-btn:hover {
  background: rgba(251, 113, 133, 0.2);
}

/* Panier vide + suggestions rapides */
.idsi-cart-empty {
  text-align: center;
  padding: 28px 18px;
  border-radius: 18px;
  background: rgba(14, 27, 51, 0.65);
  border: 1px dashed rgba(148, 184, 224, 0.24);
}

.idsi-cart-empty h4 {
  margin: 8px 0 6px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #ffffff;
}

.idsi-cart-empty p {
  margin: 0 0 16px;
  font-size: 0.85rem;
  color: #9fb2cc;
}

.idsi-cart-quick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.idsi-cart-quick-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 13px;
  background: #0e1b33;
  border: 1px solid rgba(148, 184, 224, 0.16);
}

.idsi-cart-quick-add {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.14);
  color: #7dd3fc;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.idsi-cart-quick-add:hover {
  background: #38bdf8;
  color: #04101f;
}

/* Bloc Code Promo & Totaux */
.idsi-cart-promo-box {
  padding: 14px 16px;
  border-radius: 16px;
  background: #0d1930;
  border: 1px solid rgba(148, 184, 224, 0.14);
}

.idsi-cart-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.idsi-cart-promo-row {
  display: flex;
  gap: 8px;
}

.idsi-cart-input {
  width: 100%;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1px solid rgba(148, 184, 224, 0.24);
  background: #060d1c;
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.88rem;
}

.idsi-cart-input::placeholder {
  color: #64748b;
}

.idsi-cart-input:focus {
  outline: 2px solid #38bdf8;
  outline-offset: 1px;
}

.idsi-cart-summary {
  padding: 16px;
  border-radius: 16px;
  background: #0e1b33;
  border: 1px solid rgba(125, 211, 252, 0.22);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.idsi-cart-sum-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  color: #cbd5e1;
}

.idsi-cart-sum-row.discount {
  color: #6ee7b7;
  font-weight: 700;
}

.idsi-cart-sum-row.total {
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid rgba(148, 184, 224, 0.16);
  font-size: 1.14rem;
  font-weight: 800;
  color: #ffffff;
}

.idsi-cart-sum-row.total span:last-child {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  color: #38bdf8;
}

/* Étape 2 : Sélecteur de passerelles */
.idsi-pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.idsi-pay-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 13px;
  border: 1px solid rgba(148, 184, 224, 0.22);
  background: #0e1b33;
  color: #cbd5e1;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.idsi-pay-opt.active {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  color: #ffffff;
}

.idsi-pay-opt.tn-opt {
  grid-column: 1 / -1;
  border-color: rgba(251, 146, 60, 0.45);
  background: rgba(194, 65, 12, 0.14);
  color: #fed7aa;
}

.idsi-pay-opt.tn-opt.active {
  border-color: #fb923c;
  background: rgba(234, 88, 12, 0.28);
  color: #ffffff;
}

.idsi-pay-panel {
  padding: 16px;
  border-radius: 16px;
  background: #0e1b33;
  border: 1px solid rgba(148, 184, 224, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.idsi-pay-panel.tn-panel {
  border-color: rgba(251, 146, 60, 0.48);
  background: #171219;
}

.idsi-tn-meta {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(251, 146, 60, 0.08);
  border: 1px solid rgba(251, 146, 60, 0.24);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #ffedd5;
}

.idsi-tn-meta code {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.35);
  color: #fde68a;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem;
}

.idsi-tn-total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(234, 88, 12, 0.18);
  border: 1px dashed rgba(251, 146, 60, 0.6);
  font-size: 0.86rem;
  font-weight: 700;
  color: #ffedd5;
}

.idsi-tn-total-bar strong {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 1.12rem;
  color: #fdba74;
}

.idsi-card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.idsi-stripe-mount {
  padding: 12px 14px;
  border-radius: 11px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
}

/* Case de confirmation explicite avant paiement */
.idsi-confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.24);
  font-size: 0.82rem;
  line-height: 1.45;
  color: #e2e8f0;
  cursor: pointer;
}

.idsi-confirm-check input {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  accent-color: #38bdf8;
  flex-shrink: 0;
}

/* Boutons d'action du tiroir */
.idsi-cart-btn-primary {
  width: 100%;
  padding: 14px 20px;
  border-radius: 999px;
  border: 0;
  background: #38bdf8;
  color: #04101f;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.idsi-cart-btn-primary:hover:not(:disabled) {
  background: #7dd3fc;
  transform: translateY(-1px);
}

.idsi-cart-btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.idsi-cart-btn-primary.tn-cta {
  background: #ea580c;
  color: #ffffff;
}

.idsi-cart-btn-primary.tn-cta:hover:not(:disabled) {
  background: #f97316;
}

.idsi-cart-btn-primary.paypal-cta {
  background: #ffc439;
  color: #003087;
}

.idsi-cart-btn-secondary {
  width: 100%;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid rgba(148, 184, 224, 0.24);
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.idsi-cart-btn-secondary:hover {
  border-color: rgba(125, 211, 252, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

.idsi-cart-btn-wa {
  width: 100%;
  padding: 13px 18px;
  border-radius: 999px;
  border: 0;
  background: #059669;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.idsi-cart-btn-wa:hover {
  background: #10b981;
}

/* Alertes & Reçus */
.idsi-cart-alert {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.45;
  display: none;
}

.idsi-cart-alert.show {
  display: block;
}

.idsi-cart-alert.error {
  background: rgba(225, 29, 72, 0.16);
  border: 1px solid rgba(251, 113, 133, 0.45);
  color: #fecdd3;
}

.idsi-cart-alert.info {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.36);
  color: #bae6fd;
}

.idsi-cart-alert.success {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
}

.idsi-receipt-card {
  padding: 20px;
  border-radius: 18px;
  background: #0e1b33;
  border: 1px solid rgba(16, 185, 129, 0.45);
  text-align: center;
}

.idsi-receipt-card.tn-receipt {
  border-color: rgba(251, 146, 60, 0.55);
}

.idsi-receipt-ref {
  display: inline-block;
  margin: 8px 0 12px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.35);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.92rem;
  font-weight: 700;
  color: #7dd3fc;
}

.idsi-receipt-list {
  list-style: none;
  padding: 12px 14px;
  margin: 12px 0 0;
  border-radius: 12px;
  background: rgba(6, 12, 24, 0.65);
  text-align: left;
  font-size: 0.84rem;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Toast notification d'ajout au panier */
.idsi-cart-toast {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 100040;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 16px;
  border-radius: 16px;
  background: #0b162c;
  border: 1px solid rgba(56, 189, 248, 0.42);
  color: #f8fafc;
  box-shadow: 0 18px 42px rgba(1, 4, 12, 0.65);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: 'Figtree', 'Inter', system-ui, sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.idsi-cart-toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.idsi-cart-toast-btn {
  padding: 6px 12px;
  border-radius: 999px;
  border: 0;
  background: #38bdf8;
  color: #04101f;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .idsi-cart-drawer {
    width: 100vw;
  }
  .idsi-pay-grid {
    grid-template-columns: 1fr;
  }
  .idsi-cart-nav-btn .idsi-cart-nav-label {
    display: none;
  }
}
