/**
 * Composant Modals — Styles des fenêtres modales/dialogs.
 *
 * Overlay, conteneurs de tailles variées, en-têtes, pieds,
 * modale PDF viewer, et animations d'apparition.
 *
 * @component modals
 */

/* ─── Overlay (fond semi-transparent) ─── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active,
.modal-overlay[style*="display: flex"] {
  display: flex;
}

/* ─── Conteneur modal ─── */
.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 25px 60px rgba(18, 28, 53, 0.12);
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.2s ease-out;
}

.modal-sm  { max-width: 420px; }
.modal-md  { max-width: 560px; }
.modal-lg  { max-width: 900px; }
.modal-xl  { max-width: 1100px; }

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ─── En-tête modal ─── */
.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ─── Corps modal ─── */
.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

/* ─── Pied modal ─── */
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── Modale PDF Viewer ─── */
#pdf-viewer-modal .modal-content {
  width: 95%;
  max-width: 1200px;
  height: 95vh;
}

#pdf-viewer-body {
  height: calc(95vh - 110px);
  overflow: auto;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.pdf-toolbar button {
  padding: 6px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.pdf-toolbar button:hover {
  background: var(--primary-light);
  color: var(--primary-dark);
}
