/* ============================================================================
 * FILE: /css/modal.css
 * Sor-sõngo — Styles de modales réutilisables
 * Compatible avec tous les thèmes : Clair, Ardoise (slate/dimmed), Sombre (dark)
 * ============================================================================ */

/* === BACKDROP === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

@media (min-width: 600px) {
  .modal-backdrop {
    align-items: center;
  }
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

/* === SHEET (panneau bas ou centré) === */
.modal-sheet {
  width: 100%;
  max-width: 500px;
  background: var(--page-solid, #f6f5f2);
  border: 1.5px solid var(--border-theme, rgba(0, 0, 0, 0.12));
  border-radius: 20px 20px 0 0;
  padding: 16px 20px 32px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.3);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 600px) {
  .modal-sheet {
    border-radius: 20px;
    transform: translateY(20px) scale(0.95);
    padding: 20px;
  }
}

.modal-backdrop.show .modal-sheet {
  transform: translateY(0) scale(1);
}

/* Poignée drag */
.modal-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgba(128, 128, 128, 0.3);
  margin: 0 auto 14px;
}

/* === EN-TÊTE === */
.modal-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-theme, rgba(0, 0, 0, 0.1));
  margin-bottom: 14px;
}

.modal-sheet-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text) !important;
}

/* === BOUTON FERMETURE === */
.modal-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.08);
  color: #dc2626;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(220, 38, 38, 0.18);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.45);
  transform: scale(1.06);
}

.modal-close-btn:active {
  transform: scale(0.92);
}

/* === VARIANTE : Modale centré type dialog (non sheet) === */
.modal-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}

.modal-dialog-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog-card {
  width: 100%;
  max-width: 440px;
  background: var(--page-solid, #f6f5f2);
  border: 1.5px solid var(--border-theme, rgba(0, 0, 0, 0.12));
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  transform: scale(0.92);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog-backdrop.show .modal-dialog-card {
  transform: scale(1);
}
