/* ==============================================================
   🧱 MODALE GÉNÉRIQUE — CLEAN (dark/light)
   Objectif : supprimer doublons / overrides hasardeux,
              garder le comportement actuel (desktop + mobile),
              conserver tabs scrollbar + modales success/error/loader.
   ============================================================== */

/* ------------------------------
   Backdrop
------------------------------ */
.modal-backdrop{
  position: fixed;
  inset: 0;
  z-index: 2000;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;

  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.modal-backdrop.show{
  opacity: 1;
  pointer-events: auto;
}

/* ------------------------------
   Modal base
------------------------------ */
.modal{
  width: 90%;
  max-height: 90vh;

  display: flex;
  flex-direction: column;
  overflow: hidden;

  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;

  transform: translateY(20px);
  opacity: 0;
  transition: transform .25s ease, opacity .25s ease;
}

.modal.show{
  transform: translateY(0);
  opacity: 1;
}

/* Tailles standard */
.modal.small  { width: 380px; }
.modal.medium { width: 600px; }
.modal.large  { width: 800px; }
.modal.xlarge { width: 1200px; }

/* ------------------------------
   Header
------------------------------ */
.modal-header{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px 10px 58px;
    overflow: visible;
    background: var(--accent-200);
}

.modal-header h3{
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1.1rem;
  font-weight: 200;
  color: var(--text);
}

.modal-header .icon-wrap .lucide{
  width: 25px;
  height: 25px;
 
}

.modal-header .btn-icon{
  background: none;
  border: none;
  color: var(--muted);

  padding: 6px;
  border-radius: 6px;
  cursor: pointer;

  transition: background .2s ease, color .2s ease;
}

.modal-header .btn-icon:hover{
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}

/* ------------------------------
   Body
------------------------------ */
.modal-body{
  flex: 1 1 auto;
  padding: 0px 60px 16px;
  overflow-y: auto;

  background: var(--panel);

  scrollbar-width: thin;
  scrollbar-color: var(--accent) var(--panel);
}

.modal-body::-webkit-scrollbar{ width: 6px; }
.modal-body::-webkit-scrollbar-thumb{
  background: var(--accent);
  border-radius: 4px;
}

/* Conteneur interne d’injection */
.modal-content{
  display: block;
  width: 100%;
}

/* ------------------------------
   Footer (base + version sticky)
------------------------------ */
.modal-actions{
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;

  padding: 14px 18px;
  border-top: 1px solid var(--border);

  background: var(--panel);
}

/* Boutons footer */
.modal-actions .btn,
.modal-actions .btn-secondary{
  min-width: 100px;
}

/* Footer “dynamique” (tes boutons d’onglets) */
.modal-actions-dynamic{
  display: flex;
  gap: 20px;
}

.modal-actions button .lucide{
  width: 18px;
  height: 18px;
  opacity: 0.9;
  transform: translateY(-0.5px);
}

.modal-actions button:hover .lucide{
  opacity: 1;
}

/* Animation de transition des boutons (conservée) */
.modal-actions button{
  animation: modalFooterFade .25s ease forwards;
  opacity: 0;
}

@keyframes modalFooterFade{
  from{ opacity: 0; transform: translateY(5px); }
  to  { opacity: 1; transform: translateY(0); }
}

/* ------------------------------
   Scroll lock
------------------------------ */
html.no-scroll,
body.no-scroll{
  overflow: hidden !important;
}

/* ------------------------------
   Tabs scrollbar (si présent)
------------------------------ */
nav.tabs::-webkit-scrollbar{ height: 6px; }
nav.tabs::-webkit-scrollbar-thumb{
  background: var(--accent);
  border-radius: 6px;
}
nav.tabs::-webkit-scrollbar-thumb:hover{
  background: color-mix(in srgb, var(--accent) 85%, white);
}

/* iOS/Safari */
@supports (-webkit-touch-callout: none){
  nav.tabs{ -webkit-overflow-scrolling: touch; }
  nav.tabs::-webkit-scrollbar{
    -webkit-appearance: none;
    height: 8px;
  }
  nav.tabs::-webkit-scrollbar-thumb{
    background-color: var(--accent);
    border-radius: 6px;
  }
}

/* ------------------------------
   Desktop large : modales ancrées haut
------------------------------ */
@media (min-width: 1200px){

  .modal.xlarge{
    position: fixed;
    left: 50%;
    top: 6vh;
    transform: translateX(-50%) translateY(0); /* ✅ pas de translateY(50%) */
    max-height: 88vh;
  }

  /* Header & footer taille naturelle */
  .modal-header{ flex: 0 0 auto; }
  .modal-actions{ flex: 0 0 auto; }

  /* Body prend le reste */
  .modal-body{
    flex: 1 1 auto;
    overflow: auto;
  }

  /* Onglets collés en haut du body */
  .modal .tabs{
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--panel);
  }
}

/* ------------------------------
   Responsive
------------------------------ */
@media (max-width: 1210px){
  /* backdrop “plein écran” */
  .modal-backdrop{
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    position: fixed;
    overflow: hidden;
  }

  .modal-body{
    padding: 0 30px 16px;
  }

  /* Modale full screen */
  .modal.medium,
  .modal.large,
  .modal.xlarge{
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;

    border-radius: 0;
    box-shadow: none;

    transform: translateY(100%);
    opacity: 1;
    transition: transform .3s ease;
  }

  .modal.show{
    transform: translateY(0);
  }

  .modal-header,
  .modal-actions{
    padding: 14px 16px;
  }

  /* Footer reste visible */
  .modal-actions{
    position: sticky;
    bottom: 0;
    z-index: 15;
    backdrop-filter: blur(6px);
  }
}

@media (max-width: 680px){
  .modal-actions{
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 12px;
  }

  .modal-actions button{
    flex: 1 1 auto;
    justify-content: center;
    font-size: 0.88rem;
    padding: 9px 12px;
  }

  .modal-actions button .lucide{
    display: none;
  }
}

@media (max-width: 600px){
  .modal-body{
    padding: 0 16px 16px;
  }
}

/* ============================================================
   MODAL — CHARGES COMMUNES
   ============================================================ */
.charges-block{
  margin-bottom: 30px;
}

.charges-subtitle{
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;

  margin: 10px 0 6px;
  opacity: 0.85;
  color: var(--text);
}

.charges-subtitle .icon-inline{
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.meta .payer{
  font-style: italic;
  opacity: 0.8;
}

/* (si tu utilises réellement .badge-orange) */
@media (prefers-color-scheme: dark){
  .badge-orange{ background: #fbbf24; }
}

/* ============================================================
   ❌ Carte erreur (fallback)
   ============================================================ */
.ms-error-icon-circle{
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  background:
    radial-gradient(circle at 30% 0%, #ff4f4f, transparent 60%),
    color-mix(in srgb, #ff4f4f 22% 78%);
}

.ms-error-title{
  font-size: 1.2rem;
  margin: 4px 0 6px;
}

.ms-error-message{
  margin: 0 0 16px;
  opacity: .85;
}

.ms-error-actions{
  display: flex;
  justify-content: center;
}

.ms-error-actions .btn{
  min-width: 220px;
}

/* ============================================================
   🔁 Spin générique
   ============================================================ */
@keyframes spin{
  to{ transform: rotate(360deg); }
}

/* ============================================================
   🔄 Loader minimal (backdrop)
   ============================================================ */
.ms-loader-overlay{
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  background: transparent !important;
  pointer-events: none;

  border: none !important;
  box-shadow: none !important;
}

.ms-loader-text-only{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;

  color: #fff;
  background: none !important;
  border: none !important;
  box-shadow: none !important;

  animation: fadeIn .4s ease-out;
}

.ms-loader-lines{
  text-align: center;
}

.ms-loader-spinner{
  width: 70px;
  height: 70px;
  animation: spinSmooth .8s linear infinite;
  transform-origin: center;
  stroke-width: 1.6;
  opacity: 1;
  background: none;
}

.ms-loader-title{
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0;
}

.ms-loader-subtitle{
  font-size: 0.95rem;
  opacity: 0.9;
  margin: 0;
}

@keyframes spinSmooth{
  from{ transform: rotate(0deg); }
  to  { transform: rotate(360deg); }
}

@keyframes fadeIn{
  from{ opacity: 0; transform: translateY(8px); }
  to  { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   ✅ Modale succès
   ============================================================ */
.modal-body .ms-success-card{
  max-width: 520px;
  margin: 8px auto 4px;
}

.ms-success-card{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;

  padding: 20px 4px 8px;
  color: var(--text, #f5f5f5);
}

.ms-success-icon{
  display: flex;
  align-items: center;
  justify-content: center;

  width: 60px;
  height: 60px;
  border-radius: 50%;
  margin-bottom: 14px;

  background: var(--success);
}

.ms-success-icon .lucide{
  width: 60px;
  height: 60px;
  color: var(--panel);
}

.ms-success-title{
  font-size: 1.4rem;
  font-weight: 200;
  margin: 4px 0;

  color: var(--success);
}

.ms-success-subtitle{
    opacity: 1;
    color: var(--success);
    font-size: 1rem;
    margin: 0 0 10px;
}

.ms-success-meta{
  font-size: 0.85rem;
  opacity: 0.7;
  margin: 0 0 18px;
}

.ms-success-tags{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
}

.ms-success-tag{
  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 4px 10px;
  font-size: 0.8rem;

  border: 1px solid var(--border);
  border-radius: 99px;
}

.ms-success-tag .lucide{
  width: 14px;
  height: 14px;
  opacity: 0.9;
}

.ms-success-actions{
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.ms-success-action{
  display: flex;
  align-items: center;
  gap: 12px;

  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);

  color: var(--text);
  cursor: pointer;

  transition:
    background .2s ease,
    border-color .2s ease,
    transform .1s ease,
    box-shadow .2s ease;

  animation: ms-success-fadeIn .4s ease both;
}

.ms-success-action.accent{
  border-color: var(--accent);
}

.ms-success-action:hover{
  background: color-mix(in srgb, var(--accent) 22%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 60%);
  transform: translateY(-1px);
}

.ms-success-action.accent:hover{
  background: color-mix(in srgb, var(--accent) 45%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 75%);
}

.ms-success-action-icon{
  display: flex;
  align-items: center;
  justify-content: center;

  width: 28px;
  height: 28px;

  color: var(--accent);
  flex-shrink: 0;

  transition: color .2s ease, transform .2s ease;
}

.ms-success-action:hover .ms-success-action-icon{
  transform: scale(1.1);
}

.ms-success-action.accent .ms-success-action-icon{
  color: #fff;
}

.ms-success-action-text{
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.ms-success-action-label{
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ms-success-action-caption{
  font-size: 0.8rem;
  opacity: 0.8;
  margin-top: 2px;
}

.ms-success-action:nth-child(1){ animation-delay: .05s; }
.ms-success-action:nth-child(2){ animation-delay: .10s; }
.ms-success-action:nth-child(3){ animation-delay: .15s; }
.ms-success-action:nth-child(4){ animation-delay: .20s; }

@keyframes ms-success-fadeIn{
  from{ opacity: 0; transform: translateY(18px) scale(.98); }
  to  { opacity: 1; transform: translateY(0) scale(1); }
}



.modal-header.success {
  background: var(--success); /* vert */
  color: var(--textNeg);
}


.modal-header.success  .btn-icon {
  color: var(--textNeg);
}


.modal-confirm-msg {
  margin: 30px 0;
}

/* Backdrop normal (ta règle actuelle probablement) */
/* .modal-backdrop { background: rgba(...); } */

/* ✅ Backdrop des modales empilées : pas de couche sombre en plus */
.modal-backdrop.modal-backdrop--transparent{
  background: transparent !important;
}


.modal-backdrop.modal-backdrop--transparent{
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  filter: none !important;
}

.modal-backdrop.modal-backdrop--transparent{
  background: transparent !important;
  opacity: 1 !important;
}

.modal-backdrop,
.modal{
  mix-blend-mode: normal;
}
.modal-backdrop{
  isolation: isolate;
}