/* ==========================================
   FORM-CONTACT.CSS - KarimBuilds
   Stylisation du formulaire de contact
   Design sobre et lisible, focus sur l'accessibilité
   ========================================== */

/* ===== CONTENEUR PRINCIPAL ===== */
.contact-form {
  max-width: 600px;
  margin: 0 auto;
}

/* ===== HONEYPOT - Caché mais accessible ===== */
.field.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ===== CHAMPS DE FORMULAIRE ===== */
.field {
  margin-bottom: 1.5rem;
}

.field:last-of-type {
  margin-bottom: 2rem;
}

/* Labels */
.field label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
}

/* Indicateur requis (optionnel) */
.field label[for]:has(+ input[required])::after,
.field label[for]:has(+ textarea[required])::after {
  content: ' *';
  color: var(--color-primary);
  font-weight: 700;
}

/* Inputs & Textarea - Style de base */
.field input[type="text"],
.field input[type="email"],
.field textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: var(--font-size-base);
  font-family: inherit;
  line-height: 1.5;
  color: var(--color-text);
  background: white;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  outline: none;
}

/* Placeholder */
.field input::placeholder,
.field textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

/* Textarea spécifique */
.field textarea {
  resize: vertical;
  min-height: 140px;
}

/* ===== ÉTATS INTERACTIFS ===== */

/* Hover */
.field input:hover,
.field textarea:hover {
  border-color: var(--color-primary-light);
}

/* Focus */
.field input:focus,
.field textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(43, 127, 217, 0.1);
  background: rgba(43, 127, 217, 0.02);
}

/* Valid (rempli) */
.field input:valid:not(:placeholder-shown),
.field textarea:valid:not(:placeholder-shown) {
  border-color: var(--color-success);
}

/* Invalid (après interaction) */
.field input:invalid:not(:focus):not(:placeholder-shown),
.field textarea:invalid:not(:focus):not(:placeholder-shown) {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.02);
}

/* Disabled */
.field input:disabled,
.field textarea:disabled {
  background: var(--color-bg-light);
  border-color: var(--color-border-light);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ===== TEXTE D'AIDE ===== */
.field-hint {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-top: 0.5rem;
  line-height: 1.5;
  font-style: italic;
}

/* ===== BOUTON SUBMIT ===== */
.contact-form .btn {
  width: 100%;
  padding: 1rem 2rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
}

.contact-form .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== MESSAGES DE FEEDBACK (optionnel) ===== */
.form-message {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: var(--font-size-sm);
  line-height: 1.6;
}

.form-message.success {
  background: rgba(16, 185, 129, 0.1);
  border-left: 4px solid var(--color-success);
  color: #059669;
}

.form-message.error {
  background: rgba(239, 68, 68, 0.1);
  border-left: 4px solid #ef4444;
  color: #dc2626;
}

/* ===== RESPONSIVE - Mobile ===== */
@media (max-width: 768px) {
  .contact-form {
    max-width: 100%;
  }

  .field {
    margin-bottom: 1.25rem;
  }

  .field input,
  .field textarea {
    padding: 0.75rem 0.875rem;
    font-size: var(--font-size-sm);
  }

  .contact-form .btn {
    padding: 0.875rem 1.5rem;
  }
}

/* ===== ANIMATIONS ===== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* Animation au submit si erreur */
.contact-form.error {
  animation: shake 0.3s ease-in-out;
}

/* Focus visible pour accessibilité */
.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ===== AMÉLIORATION PROGRESSIVE ===== */

/* Autofill styling */
.field input:-webkit-autofill,
.field input:-webkit-autofill:hover,
.field input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px white inset;
  -webkit-text-fill-color: var(--color-text);
  border-color: var(--color-primary-light);
  transition: background-color 5000s ease-in-out 0s;
}

/* Support navigateurs anciens */
.field input[type="email"]::-webkit-input-placeholder {
  color: var(--color-text-muted);
}

.field input[type="email"]::-moz-placeholder {
  color: var(--color-text-muted);
  opacity: 0.7;
}

/* ===== VARIANTES (optionnel) ===== */

/* Formulaire compact */
.contact-form.compact .field {
  margin-bottom: 1rem;
}

.contact-form.compact .field input,
.contact-form.compact .field textarea {
  padding: 0.625rem 0.875rem;
  font-size: var(--font-size-sm);
}

/* Formulaire dans une modal */
.modal .contact-form {
  max-width: 100%;
}

/* Formulaire en ligne (côte à côte) */
@media (min-width: 768px) {
  .contact-form.inline {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 800px;
  }

  .contact-form.inline .field:has(textarea),
  .contact-form.inline .btn {
    grid-column: 1 / -1;
  }
}

/* ===== LOADING STATE (optionnel) ===== */
.contact-form.loading {
  pointer-events: none;
  opacity: 0.6;
}

.contact-form.loading .btn::after {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-left: 0.5rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}