/* ============================================================
 * outsend UI · modal.css
 * ============================================================
 * Popup centrée avec backdrop semi-transparent.
 *
 * Utilisation HTML (Alpine.js) :
 *
 *   <div x-show="myModalOpen" x-cloak
 *        @keydown.escape.window="myModalOpen = false"
 *        class="ui-modal-backdrop"
 *        @click.self="myModalOpen = false">
 *     <div class="ui-modal" @click.stop>
 *       <div class="ui-modal-header">
 *         <h3>Titre</h3>
 *       </div>
 *       <div class="ui-modal-body">
 *         ... contenu ...
 *       </div>
 *       <div class="ui-modal-footer">
 *         <button class="btn btn-ghost" @click="myModalOpen = false">Fermer</button>
 *         <button class="btn btn-accent">Action</button>
 *       </div>
 *     </div>
 *   </div>
 *
 * Variantes de taille (overrides max-width par défaut 480px) :
 *   <div class="ui-modal ui-modal-md">  → 560px
 *   <div class="ui-modal ui-modal-lg">  → 720px
 *
 * Helpers JS (optionnels) : window.UI.modal.helpers.open / close
 * Variables CSS utilisées (style.css globaux) :
 *   --bg-card, --bg-soft, --border, --r-lg, --shadow-lg
 * ============================================================ */

.ui-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 24, 20, 0.4);
  backdrop-filter: blur(2px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: ui-modal-fade-in 0.18s ease-out;
}

@keyframes ui-modal-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.ui-modal {
  background: var(--bg-card, #FFFFFF);
  border-radius: var(--r-lg, 12px);
  border: 1px solid var(--border, #E5DFD5);
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, 0.08));
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: ui-modal-scale-in 0.18s ease-out;
}

@keyframes ui-modal-scale-in {
  from { transform: scale(0.96); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.ui-modal-md { max-width: 560px; }
.ui-modal-lg { max-width: 720px; }

.ui-modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border, #E5DFD5);
  flex-shrink: 0;
}

.ui-modal-header h1,
.ui-modal-header h2,
.ui-modal-header h3,
.ui-modal-header h4 {
  margin: 0;
}

.ui-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.ui-modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border, #E5DFD5);
  background: var(--bg-soft, #EDE8DF);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .ui-modal-backdrop {
    padding: 12px;
    align-items: flex-start;
    padding-top: 40px;
  }
  .ui-modal {
    max-width: 100%;
    max-height: calc(100vh - 80px);
  }
  .ui-modal-header { padding: 16px 18px; }
  .ui-modal-body   { padding: 18px; }
  .ui-modal-footer { padding: 14px 18px; }
}
