/* ============================================================
   Chantier Admin — refonte visuelle des 5 drawers Outils admin
   Scopée sur .chpro-modal et classes chpro-*
============================================================ */

/* ---- Modal container ---- */
.chpro-modal {
  background: #fafbfd !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: -20px 0 60px rgba(10, 45, 95, 0.15) !important;
  font-family: 'Manrope', system-ui, -apple-system, sans-serif !important;
}

/* ---- Hero header ---- */
.chpro-modal-head {
  background: linear-gradient(135deg, #0a2d5f 0%, #1b4f9c 50%, #0ea5e9 100%) !important;
  color: #fff !important;
  padding: 24px 32px !important;
  position: relative !important;
  overflow: hidden !important;
  border-radius: 0 !important;
  display: flex !important;
  align-items: center !important;
  gap: 20px !important;
}
.chpro-modal-head::before {
  content: '' !important;
  position: absolute !important;
  top: -80px; right: -80px !important;
  width: 240px; height: 240px !important;
  background: radial-gradient(circle, rgba(240,120,90,0.35) 0%, transparent 70%) !important;
  pointer-events: none !important;
}
.chpro-modal-head-ic {
  background: rgba(255,255,255,0.2) !important;
  padding: 14px !important;
  border-radius: 14px !important;
  backdrop-filter: blur(10px) !important;
  flex-shrink: 0 !important;
}
.chpro-modal-head-ic svg {
  width: 24px !important; height: 24px !important; color: #fff !important;
}
.chpro-modal-head-txt { flex: 1 !important; position: relative !important; z-index: 2 !important; }
.chpro-modal-eye {
  font-size: 10.5px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.18em !important;
  color: rgba(255,255,255,0.75) !important;
  margin-bottom: 4px !important;
  display: block !important;
}
.chpro-modal-title {
  font-size: 24px !important;
  font-weight: 800 !important;
  letter-spacing: -0.02em !important;
  color: #fff !important;
  line-height: 1.1 !important;
  margin-bottom: 4px !important;
}
.chpro-modal-sub {
  font-size: 13px !important;
  color: rgba(255,255,255,0.88) !important;
  line-height: 1.4 !important;
}
.chpro-modal-head .chpro-icon-btn {
  background: rgba(255,255,255,0.18) !important;
  color: #fff !important;
  border: 1px solid rgba(255,255,255,0.25) !important;
  width: 36px !important; height: 36px !important;
  border-radius: 10px !important;
  position: relative !important; z-index: 2 !important;
  flex-shrink: 0 !important;
}
.chpro-modal-head .chpro-icon-btn:hover {
  background: rgba(255,255,255,0.3) !important;
}

/* ---- Modal body ---- */
.chpro-modal-body {
  padding: 24px 32px 100px !important;
  background: #fafbfd !important;
  max-height: calc(100vh - 110px) !important;
  overflow-y: auto !important;
}

/* ---- Grid de cards ---- */
.chpro-tpl-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)) !important;
  gap: 14px !important;
}

/* ---- Card (templates, apps, types, statuts, webhooks) ---- */
.chpro-tpl-card {
  background: #fff !important;
  border: 1px solid #e6edf6 !important;
  border-radius: 14px !important;
  padding: 18px !important;
  position: relative !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
}
.chpro-tpl-card::before {
  content: '' !important;
  position: absolute !important;
  top: 0; left: 0; right: 0 !important;
  height: 3px !important;
  background: linear-gradient(90deg, #0ea5e9, #1b4f9c) !important;
  opacity: 0 !important;
  transition: opacity 0.2s !important;
}
.chpro-tpl-card:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.12), 0 4px 10px rgba(0,0,0,0.04) !important;
  border-color: rgba(14, 165, 233, 0.4) !important;
}
.chpro-tpl-card:hover::before { opacity: 1 !important; }

/* ---- Card header ---- */
.chpro-tpl-head {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin-bottom: 4px !important;
}
.chpro-tpl-emo {
  font-size: 28px !important;
  line-height: 1 !important;
  width: 48px !important;
  height: 48px !important;
  background: linear-gradient(135deg, #f0f7ff, #e0f0ff) !important;
  border-radius: 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
}
.chpro-tpl-head-txt { flex: 1 !important; min-width: 0 !important; }
.chpro-tpl-title {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #0a2d5f !important;
  margin-bottom: 2px !important;
  line-height: 1.2 !important;
}

/* ---- Badges (types, priorités) ---- */
.chpro-tpl-badges {
  display: flex !important;
  gap: 6px !important;
  flex-wrap: wrap !important;
}
.chpro-tag {
  display: inline-flex !important;
  align-items: center !important;
  padding: 3px 10px !important;
  border-radius: 20px !important;
  font-size: 10.5px !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
}
.chpro-tag-type { background: rgba(14, 165, 233, 0.12) !important; color: #0369a1 !important; }
.chpro-tag-prio.chpro-prio-critical { background: rgba(220, 38, 38, 0.12) !important; color: #b91c1c !important; }
.chpro-tag-prio.chpro-prio-high    { background: rgba(234, 88, 12, 0.14) !important; color: #c2410c !important; }
.chpro-tag-prio.chpro-prio-med     { background: rgba(234, 179, 8, 0.14) !important; color: #a16207 !important; }
.chpro-tag-prio.chpro-prio-low     { background: rgba(34, 197, 94, 0.14) !important; color: #15803d !important; }

/* ---- Body du template (texte) ---- */
.chpro-tpl-body {
  background: #f8fafc !important;
  border-radius: 10px !important;
  padding: 10px 12px !important;
  font-size: 12px !important;
  color: #64748b !important;
  line-height: 1.4 !important;
  max-height: 100px !important;
  overflow: hidden !important;
  position: relative !important;
  font-family: ui-monospace, Menlo, Monaco, monospace !important;
}
.chpro-tpl-body::after {
  content: '' !important;
  position: absolute !important;
  bottom: 0; left: 0; right: 0 !important;
  height: 30px !important;
  background: linear-gradient(to top, #f8fafc, transparent) !important;
  pointer-events: none !important;
}

/* ---- Pied de card : boutons d'action ---- */
.chpro-tpl-foot {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  margin-top: auto !important;
  padding-top: 10px !important;
  border-top: 1px solid #f1f5f9 !important;
}

/* ---- Boutons icônes (edit/supprimer/haut/bas) ---- */
.chpro-icon-btn {
  width: 34px !important;
  height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid #e6edf6 !important;
  background: #fff !important;
  color: #5b7297 !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  transition: all 0.15s !important;
  padding: 0 !important;
  font-family: inherit !important;
}
.chpro-icon-btn:hover:not([disabled]) {
  background: #f0f7ff !important;
  border-color: #0ea5e9 !important;
  color: #0ea5e9 !important;
  transform: translateY(-1px) !important;
}
.chpro-icon-btn[disabled] {
  opacity: 0.3 !important;
  cursor: not-allowed !important;
}
.chpro-icon-btn-danger {
  color: #dc2626 !important;
  border-color: #fecaca !important;
  background: #fef2f2 !important;
}
.chpro-icon-btn-danger:hover:not([disabled]) {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #dc2626 !important;
}
.chpro-icon-btn svg { width: 18px !important; height: 18px !important; }

/* ---- Boutons principaux (Enregistrer, Créer, OK) ---- */
.chpro-btn {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 10px 20px !important;
  border-radius: 10px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  border: 1px solid #e6edf6 !important;
  background: #fff !important;
  color: #0a2d5f !important;
  font-family: inherit !important;
  transition: all 0.2s !important;
}
.chpro-btn:hover {
  background: #f0f7ff !important;
  border-color: #0ea5e9 !important;
  color: #0369a1 !important;
}
.chpro-btn-primary {
  background: linear-gradient(135deg, #f0785a, #e05e3f) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 4px 14px rgba(240, 120, 90, 0.3) !important;
}
.chpro-btn-primary:hover {
  background: linear-gradient(135deg, #ff8c6b, #ef6e4f) !important;
  color: #fff !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 20px rgba(240, 120, 90, 0.4) !important;
}
.chpro-btn-sm {
  padding: 6px 12px !important;
  font-size: 11.5px !important;
}

/* ---- Ajouter nouveau (card dashed) ---- */
.chpro-tpl-add {
  background: #fff !important;
  border: 2px dashed #cbd5e1 !important;
  border-radius: 14px !important;
  padding: 24px !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 10px !important;
  color: #64748b !important;
  cursor: pointer !important;
  transition: all 0.2s !important;
  min-height: 160px !important;
  text-decoration: none !important;
}
.chpro-tpl-add:hover {
  border-color: #0ea5e9 !important;
  background: #f0f7ff !important;
  color: #0369a1 !important;
}
.chpro-tpl-add-plus {
  font-size: 32px !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, #f0785a, #e05e3f) !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-weight: 300 !important;
}
.chpro-tpl-add-lbl {
  font-size: 13.5px !important;
  font-weight: 700 !important;
}

/* ---- Inputs / forms génériques ---- */
.chpro-modal input[type="text"],
.chpro-modal input[type="email"],
.chpro-modal input[type="url"],
.chpro-modal input[type="password"],
.chpro-modal input[type="number"],
.chpro-modal select,
.chpro-modal textarea {
  width: 100% !important;
  padding: 8px 12px !important;
  border: 1px solid #e6edf6 !important;
  border-radius: 8px !important;
  font-size: 13px !important;
  font-family: inherit !important;
  background: #fff !important;
  color: #0a2d5f !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}
.chpro-modal input[type="text"]:focus,
.chpro-modal input[type="email"]:focus,
.chpro-modal input[type="url"]:focus,
.chpro-modal input[type="password"]:focus,
.chpro-modal input[type="number"]:focus,
.chpro-modal select:focus,
.chpro-modal textarea:focus {
  outline: none !important;
  border-color: #0ea5e9 !important;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12) !important;
}
.chpro-modal label {
  display: block !important;
  font-size: 11.5px !important;
  font-weight: 700 !important;
  color: #5b7297 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  margin-bottom: 4px !important;
}

/* ---- Checkbox / toggle style ---- */
.chpro-modal input[type="checkbox"] {
  width: 18px !important;
  height: 18px !important;
  border-radius: 4px !important;
  border: 2px solid #cbd5e1 !important;
  cursor: pointer !important;
  accent-color: #f0785a !important;
}

/* ---- Row application (code + Actif + OK + delete) ---- */
.chpro-modal form[action*="chantier"][class*="app"] {
  background: #fff !important;
  border: 1px solid #e6edf6 !important;
  border-radius: 12px !important;
  padding: 14px 16px !important;
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
}

/* ---- Section titles dans modal ---- */
.chpro-modal h3, .chpro-modal .chpro-section-title {
  font-size: 15px !important;
  font-weight: 800 !important;
  color: #0a2d5f !important;
  letter-spacing: -0.01em !important;
  margin: 20px 0 10px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

/* ---- Empty state ---- */
.chpro-modal-body > *:empty {
  min-height: 120px !important;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
  .chpro-modal-head { padding: 18px 20px !important; }
  .chpro-modal-body { padding: 18px 20px 80px !important; }
  .chpro-modal-title { font-size: 20px !important; }
  .chpro-tpl-grid { grid-template-columns: 1fr !important; }
}