/* Modales de confirmation / alerte — Cartimmo Agents
   Remplace les alert() / confirm() natifs. Palette alignée sur la charte
   agent (vert #00b894), border-radius ≤ 5px conforme à la règle UI.
   Charge via static/js/cartimo-dialogs.js + partial templates/agency/_dialogs.html */

.cd-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 100000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.18s ease-out;
  pointer-events: none;
}
.cd-overlay.show {
  opacity: 1;
  pointer-events: auto;
}
/* L'attribut HTML [hidden] doit gagner sur le display:flex ci-dessus,
   sinon l'overlay reste dans le layout en permanence et peut deborder
   horizontalement sur mobile (cd-modal max-width:460 > viewport etroit). */
.cd-overlay[hidden] { display: none !important; }

.cd-modal {
  background: #fff;
  border-radius: 5px;
  max-width: 460px;
  width: 100%;
  /* box-sizing: border-box pour que le padding 26x28 ne s'ajoute pas au
     width:100% (sinon overflow horizontal sur mobile etroit). */
  box-sizing: border-box;
  box-shadow: 0 16px 48px rgba(15, 23, 42, 0.28);
  padding: 26px 28px 22px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.22s ease-out;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.cd-overlay.show .cd-modal { transform: translateY(0) scale(1); }

.cd-title {
  font-size: 17px;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 8px;
  line-height: 1.35;
}

.cd-message {
  font-size: 14px;
  color: #475569;
  line-height: 1.5;
  margin: 0 0 22px;
  white-space: pre-line;
}

/* Notice jaune affichee au-dessus du message (ex: warning pre-action) */
.cd-notice {
  background: #fef9c3;
  border: 1px solid #fde68a;
  color: #854d0e;
  padding: 10px 13px;
  border-radius: 5px;
  font-size: 13px;
  line-height: 1.45;
  margin: 0 0 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  white-space: pre-line;
}
.cd-notice[hidden] { display: none !important; }

.cd-input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 14px;
  font-family: inherit;
  margin: -12px 0 22px;
  outline: none;
  transition: border-color .15s;
}
/* L'attribut [hidden] doit gagner sur le `display: block` ci-dessus
   (sinon le champ reste visible en mode confirm/alert). */
.cd-input[hidden] { display: none !important; }
.cd-input:focus { border-color: #00b894; box-shadow: 0 0 0 3px rgba(0,184,148,.12); }

.cd-dontask { display: flex; align-items: center; gap: 8px;
              font-size: 12px; color: #64748b;
              margin: 0 0 18px; cursor: pointer;
              user-select: none; }
.cd-dontask[hidden] { display: none !important; }
.cd-dontask input { width: 14px; height: 14px; cursor: pointer; margin: 0; }
.cd-dontask span { line-height: 1; }
.cd-dontask:hover span { color: #1e293b; }

.cd-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.cd-btn {
  padding: 9px 18px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cd-btn-ghost {
  background: #fff;
  color: #475569;
  border-color: #cbd5e1;
}
.cd-btn-ghost:hover { background: #f8fafc; border-color: #94a3b8; }

.cd-btn-primary {
  background: var(--brand, #00b894);
  color: #fff;
  border-color: var(--brand, #00b894);
}
/* Hover : on assombrit a la volee la couleur --brand (qui peut etre la
   couleur personnalisee de l'agence) plutot que de dependre d'une variable
   --brand-hover separee qui n'est definie que dans la landing publique. */
.cd-btn-primary:hover {
  background: color-mix(in srgb, var(--brand, #00b894) 88%, black);
  border-color: color-mix(in srgb, var(--brand, #00b894) 88%, black);
}

.cd-btn-danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}
.cd-btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

.cd-btn-warning {
  background: #d97706;
  color: #fff;
  border-color: #d97706;
}
.cd-btn-warning:hover { background: #b45309; border-color: #b45309; }

@media (max-width: 540px) {
  .cd-overlay { padding: 16px; align-items: flex-end; }
  .cd-modal { padding: 22px 20px 18px; }
  .cd-actions { flex-direction: column-reverse; align-items: stretch; }
  .cd-btn { width: 100%; justify-content: center; }
}
