/* Formulaires CF7 : CSS porte tel quel de la page Contact BlackTenders (7781). */

/* === Variables CSS === */
.cf7-grid {
  --cf7-brand: #111827;
  --cf7-brand-hover: #2563eb;
  --cf7-text: #1f2937;
  --cf7-text-muted: #6b7280;
  --cf7-border: #d1d5db;
  --cf7-bg-input: #ffffff;
  --cf7-radius: 8px;
}

/* === Anti-wpautop : <p> et <br> parasites === */
.cf7-grid p,
.cf7-grid .cf7-alert p,
.cf7-phone p {
  display: contents;
  margin: 0;
}
.cf7-grid br,
.cf7-phone br {
  display: none;
}

/* === Grille CF7 === */
.cf7-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem 1.25rem;
  width: 100%;
  box-sizing: border-box;
}
.cf7-col-50  { grid-column: span 1; }
.cf7-col-100 { grid-column: span 2; }

/* === Groupes conditionnels === */
.cf7-grid [data-class="wpcf7cf_group"] { display: contents; }
.cf7-grid [data-class="wpcf7cf_group"].wpcf7cf-hidden { display: none; }

/* === Téléphone : préfixe + numéro côte à côte === */
.cf7-phone {
  display: flex;
  gap: 0.4rem;
}
.cf7-phone .wpcf7-form-control-wrap[data-name="your-phone-prefix"] {
  flex: 0 0 80px;
}
.cf7-phone .wpcf7-form-control-wrap[data-name="your-phone"] {
  flex: 1;
  min-width: 0;
}
.cf7-phone input[name="your-phone-prefix"] {
  width: 100%;
  padding-left: 0.4rem;
  padding-right: 0.4rem;
  text-align: center;
  font-weight: 500;
}
.cf7-phone input[type="tel"] {
  width: 100%;
}

/* === Labels === */
.cf7-grid label,
.cf7-grid .cf7-label,
.cf7-grid .cf7-file-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--cf7-text);
  width: 100%;
}
.cf7-grid .cf7-label {
  display: block;
  margin-bottom: 0.35rem;
}

/* === Inputs harmonisés === */
.cf7-grid input[type="text"],
.cf7-grid input[type="email"],
.cf7-grid input[type="tel"],
.cf7-grid input[type="date"],
.cf7-grid input[type="number"],
.cf7-grid select,
.cf7-grid textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--cf7-border);
  border-radius: var(--cf7-radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--cf7-text);
  background: var(--cf7-bg-input);
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
.cf7-grid select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}
.cf7-grid input:focus,
.cf7-grid select:focus,
.cf7-grid textarea:focus {
  outline: none;
  border-color: var(--cf7-brand-hover);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
.cf7-grid textarea {
  min-height: 120px;
  resize: vertical;
}

/* === Alerte info (BlackTenders : pas d'urgence, juste contexte) === */
.cf7-grid .cf7-alert {
  padding: 0.85rem 1rem;
  border-radius: var(--cf7-radius);
  font-size: 0.875rem;
  line-height: 1.5;
  margin: 0;
}
.cf7-grid .cf7-alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

/* === Checkboxes (use_label_element) === */
.cf7-grid .wpcf7-checkbox {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin-top: 0.25rem;
}
.cf7-grid .wpcf7-checkbox .wpcf7-list-item {
  display: inline-flex;
  margin: 0;
  flex: 0 0 auto;
}
.cf7-grid .wpcf7-checkbox .wpcf7-list-item label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  width: auto;
  font-weight: 400;
  font-size: 0.9375rem;
  color: var(--cf7-text);
  cursor: pointer;
  margin: 0;
}
.cf7-grid .wpcf7-checkbox .wpcf7-list-item-label {
  display: inline;
}
.cf7-grid .wpcf7-checkbox input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--cf7-brand);
  margin: 0;
  flex-shrink: 0;
  -webkit-appearance: auto;
  appearance: auto;
}

/* === Pièces jointes === */
.cf7-grid input[type="file"] {
  width: 100%;
  padding: 1rem;
  border: 2px dashed var(--cf7-border);
  border-radius: var(--cf7-radius);
  background: #fafafa;
  font-size: 0.9375rem;
  color: var(--cf7-text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s;
  box-sizing: border-box;
}
.cf7-grid input[type="file"]:hover,
.cf7-grid input[type="file"]:focus {
  border-color: var(--cf7-brand);
  background: #f5f5f5;
  outline: none;
}
.cf7-grid input[type="file"]::file-selector-button {
  background: var(--cf7-brand);
  color: #fff;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.875rem;
  margin-right: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s;
}
.cf7-grid input[type="file"]::file-selector-button:hover {
  background: var(--cf7-brand-hover);
}
.cf7-grid .cf7-file-hint {
  display: block;
  font-size: 0.8125rem;
  color: var(--cf7-text-muted);
  margin-top: 0.5rem;
  line-height: 1.4;
}

/* === Submit === */
.cf7-submit {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}
.cf7-grid input[type="submit"] {
  background: var(--cf7-brand);
  color: #fff;
  border: none;
  padding: 0.85rem 2rem;
  border-radius: var(--cf7-radius);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background .15s;
  width: auto;
}
.cf7-grid input[type="submit"]:hover {
  background: var(--cf7-brand-hover);
}

/* === Validation errors === */
.cf7-grid .wpcf7-not-valid {
  border-color: #dc2626 !important;
}
.cf7-grid .wpcf7-not-valid-tip {
  color: #dc2626;
  font-size: 0.8125rem;
  margin-top: 0.25rem;
  display: block;
}

/* === Tablette === */
@media (max-width: 768px) {
  .cf7-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }
  .cf7-col-50,
  .cf7-col-100 {
    grid-column: span 1;
  }
}

/* === Mobile : 16px pour éviter zoom iOS === */
@media (max-width: 480px) {
  .cf7-grid input[type="text"],
  .cf7-grid input[type="email"],
  .cf7-grid input[type="tel"],
  .cf7-grid input[type="date"],
  .cf7-grid input[type="number"],
  .cf7-grid select,
  .cf7-grid textarea {
    font-size: 16px;
  }
  .cf7-phone .wpcf7-form-control-wrap[data-name="your-phone-prefix"] {
    flex: 0 0 75px;
  }
  .cf7-submit {
    justify-content: stretch;
  }
  .cf7-grid input[type="submit"] {
    width: 100%;
  }
}

/* Turnstile s'affiche apres ~1 s : hauteur reservee pour ne plus decaler le formulaire. */
.wpcf7-turnstile {
  min-height: 65px;
}
