/* WCE — Front — Titre
 * Lié à :
 * - /inc/front/shortcode/titre/titre-shortcodes.php
 * - /assets/js/front-end/titre.js
 */

.wce-titre-form-wrap{
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color:#1d2327;
  max-width: 860px;          /* plus compact */
}

/* blocs */
.wce-titre-form-wrap .wce-titre-rules,
.wce-titre-form-wrap .wce-form-section{
  background:#fff;
  border:1px solid #dce0e5;
  border-radius:10px;
  padding:12px;
  box-shadow:none;           /* plus sobre/compact */
  margin: 0 0 12px;
}

.wce-titre-form-wrap .wce-titre-rules h3,
.wce-titre-form-wrap .wce-form-section h3{
  margin:0 0 10px;
  font-size:15px;
  border-bottom:1px solid #e7eaee;
  padding-bottom:6px;
}

.wce-titre-form-wrap .wce-titre-rules-grid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

.wce-titre-form-wrap .wce-titre-rules-block{
  border:1px solid #dcdcde;
  border-radius:10px;
  padding:10px;
  background:#f6f7f7;
}

.wce-titre-form-wrap .wce-titre-rules-block h4{
  margin:0 0 6px;
  font-size:13px;
}

.wce-titre-form-wrap .wce-titre-rules-block ul{
  margin:0;
  padding-left:16px;
}

/* grille principale : labels à gauche */
.wce-titre-form-wrap .wce-grid{
  display:grid;
  gap:8px;
}

/* champ label à gauche / contrôle à droite */
.wce-titre-form-wrap .wce-field{
  display:grid;
  grid-template-columns: 140px 1fr; /* label gauche */
  align-items:center;
  gap:10px;
  margin:0;
}

.wce-titre-form-wrap .wce-label{
  font-weight:600;
  font-size:13px;
  line-height:1;
  white-space:nowrap;        /* une seule ligne */
  overflow:hidden;
  text-overflow:ellipsis;
  margin:0;
}

.wce-titre-form-wrap .wce-req{
  color:#b32d2e;
  font-weight:700;
}

.wce-titre-form-wrap .wce-control{
  min-width:0;
}

.wce-titre-form-wrap input[type="text"],
.wce-titre-form-wrap input[type="email"],
.wce-titre-form-wrap input[type="date"],
.wce-titre-form-wrap select,
.wce-titre-form-wrap textarea{
  width:100%;
  box-sizing:border-box;
  border:1px solid #ccd0d4;
  border-radius:8px;
  padding:8px 10px;          /* plus compact */
  background:#fff;
  font-size:14px;
  line-height:1.2;
}

.wce-titre-form-wrap input[type="file"]{
  width:100%;
  font-size:13px;
}

.wce-titre-form-wrap .wce-help{
  display:block;
  margin-top:4px;
  color:#646970;
  font-size:12px;
}

.wce-titre-form-wrap .wce-muted{
  color:#646970;
  font-size:13px;
  margin: 0 0 8px;
}

/* uploads : plus dense */
.wce-titre-form-wrap .wce-uploads{
  margin-top:10px;
  display:grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap:8px;
}
.wce-titre-form-wrap .wce-uploads .wce-field{
  grid-template-columns: 90px 1fr;
}

/* actions */
.wce-titre-form-wrap .wce-form-actions{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.wce-titre-form-wrap .wce-form-msg{
  font-size:13px;
}

/* ===== Certificats : rendu tableau ===== */
.wce-titre-form-wrap .wce-certifs{
  border:1px solid #e3e6ea;
  border-radius:10px;
  overflow:hidden;
  background:#fff;
}

.wce-titre-form-wrap .wce-cert-head{
  display:grid;
  grid-template-columns: 120px 140px 140px 140px 1fr 180px 220px;
  gap:0;
  background:#f6f7f7;
  border-bottom:1px solid #e3e6ea;
  font-weight:600;
  font-size:12px;
}

.wce-titre-form-wrap .wce-cert-head > div{
  padding:8px 10px;
  border-right:1px solid #edf0f3;
}
.wce-titre-form-wrap .wce-cert-head > div:last-child{
  border-right:none;
}

/* Le conteneur que le JS remplit doit idéalement produire des "lignes" */
.wce-titre-form-wrap .wce-cert-body{
  display:flex;
  flex-direction:column;
}

/* Si ton JS génère des div.wce-cert-row avec 7 cellules : */
.wce-titre-form-wrap .wce-cert-row{
  display:grid;
  grid-template-columns: 120px 140px 140px 140px 1fr 180px 220px;
  border-bottom:1px solid #edf0f3;
}
.wce-titre-form-wrap .wce-cert-row:last-child{
  border-bottom:none;
}

.wce-titre-form-wrap .wce-cert-cell{
  padding:6px 10px;
  border-right:1px solid #f0f2f4;
  display:flex;
  align-items:center;
}
.wce-titre-form-wrap .wce-cert-cell:last-child{
  border-right:none;
}

.wce-titre-form-wrap .wce-cert-row input,
.wce-titre-form-wrap .wce-cert-row select{
  padding:7px 9px;
  border-radius:7px;
}

/* ===== Responsive ===== */
@media (max-width: 900px){
  .wce-titre-form-wrap{
    max-width: 100%;
  }
  .wce-titre-form-wrap .wce-titre-rules-grid{
    grid-template-columns: 1fr;
  }
  .wce-titre-form-wrap .wce-uploads{
    grid-template-columns: 1fr;
  }
  .wce-titre-form-wrap .wce-uploads .wce-field{
    grid-template-columns: 120px 1fr;
  }
}

@media (max-width: 640px){
  .wce-titre-form-wrap .wce-field{
    grid-template-columns: 120px 1fr; /* garde label à gauche */
  }

  /* Certificats : on garde le tableau, mais scroll horizontal (lisible/compact) */
  .wce-titre-form-wrap .wce-certifs{
    overflow-x:auto;
    -webkit-overflow-scrolling: touch;
  }
  .wce-titre-form-wrap .wce-cert-head,
  .wce-titre-form-wrap .wce-cert-row{
    min-width: 1050px; /* force le tableau à rester "tableau" */
  }
}