/*
 * Générateur de facture Vinted — styles scopés au formulaire (.vc-fac*).
 * Volontairement indépendant du build Tailwind purgé, comme les autres outils.
 * Palette de marque VintedCRM : teal #007782.
 */

.vc-fac {
  --vc-teal: #007782;
  --vc-teal-dark: #005d66;
  --vc-teal-soft: #e0f7f9;
  --vc-red: #b91c1c;
  --vc-red-soft: #fef2f2;
  --vc-ink: #1f2937;
  --vc-muted: #6b7280;
  --vc-border: #e5e7eb;

  position: relative;
  max-width: 64rem;
  margin: 0 auto 3rem;
  color: var(--vc-ink);
  font-size: 16px;
}

.vc-fac *,
.vc-fac *::before,
.vc-fac *::after {
  box-sizing: border-box;
}

.vc-fac__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

/* Desktop : le vendeur (carte la plus haute) occupe la colonne gauche, acheteur + vente s'empilent à
   droite, les articles prennent toute la largeur. Les cartes s'étirent pour aligner les bords. */
@media (min-width: 768px) {
  .vc-fac__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "vendeur acheteur"
      "vendeur vente"
      "articles articles";
  }
  .vc-fac__card--vendeur {
    grid-area: vendeur;
  }
  .vc-fac__card--acheteur {
    grid-area: acheteur;
  }
  .vc-fac__card--vente {
    grid-area: vente;
  }
  .vc-fac__card--articles {
    grid-area: articles;
  }
}

/* ---- Cartes ---- */
.vc-fac__card {
  background: #fff;
  border: 1px solid var(--vc-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.vc-fac__card-title {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--vc-muted);
}

/* ---- Champs ---- */
.vc-fac__field {
  margin-bottom: 1.1rem;
}
.vc-fac__field:last-child {
  margin-bottom: 0;
}

.vc-fac__label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.4rem;
}

.vc-fac__input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--vc-border);
  border-radius: 10px;
  background: #fff;
  color: var(--vc-ink);
  -webkit-appearance: none;
  appearance: none;
}
.vc-fac__input:focus {
  outline: none;
  border-color: var(--vc-teal);
  box-shadow: 0 0 0 3px rgba(0, 119, 130, 0.15);
}
textarea.vc-fac__input {
  resize: vertical;
  min-height: 4.5rem;
}
select.vc-fac__input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}
.vc-fac__field[hidden] {
  display: none;
}

.vc-fac__hint {
  font-size: 0.85rem;
  color: var(--vc-muted);
  margin: 0.4rem 0 0;
}

.vc-fac__error {
  color: var(--vc-red);
  font-size: 0.88rem;
  margin: 0.35rem 0 0;
}

.vc-fac__alert {
  background: var(--vc-red-soft);
  border: 1px solid #fecaca;
  color: var(--vc-red);
  border-radius: 12px;
  padding: 0.9rem 1.1rem;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

/* ---- Lignes d'articles ---- */
.vc-fac__lines {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.vc-fac__line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem auto;
  gap: 0.6rem;
  align-items: start;
}
.vc-fac__line .vc-fac__label {
  font-size: 0.85rem;
}

.vc-fac__remove {
  margin-top: 1.75rem;
  height: 2.9rem;
  width: 2.9rem;
  border: 1px solid var(--vc-border);
  border-radius: 10px;
  background: #fff;
  color: var(--vc-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.vc-fac__remove:hover {
  color: var(--vc-red);
  border-color: #fecaca;
}

.vc-fac__add {
  margin-top: 1rem;
  background: var(--vc-teal-soft);
  color: var(--vc-teal-dark);
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
}
.vc-fac__add:hover {
  background: #c9f0f3;
}
.vc-fac__add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---- Honeypot : hors écran, jamais rempli par un humain ---- */
.vc-fac__hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- Action ---- */
.vc-fac__actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.vc-fac__actions .vc-fac__hint {
  margin: 0;
  flex: 1 1 260px;
}

.vc-fac__submit {
  background: var(--vc-teal);
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  border: none;
  border-radius: 10px;
  padding: 0.9rem 1.8rem;
  cursor: pointer;
}
.vc-fac__submit:hover {
  background: var(--vc-teal-dark);
}

/* ---- Recherche d'entreprise (annuaire public) ---- */
.vc-fac__lookup {
  position: relative;
}
.vc-fac__suggestions {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  margin: 0.25rem 0 0;
  padding: 0.25rem;
  list-style: none;
  background: #fff;
  border: 1px solid var(--vc-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 18rem;
  overflow-y: auto;
}
.vc-fac__suggestions[hidden] {
  display: none;
}
.vc-fac__suggestion {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  cursor: pointer;
}
.vc-fac__suggestion:hover,
.vc-fac__suggestion.is-active {
  background: var(--vc-teal-soft);
}
.vc-fac__suggestion-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.vc-fac__suggestion-meta {
  font-size: 0.8rem;
  color: var(--vc-muted);
}

/* ---- Mémorisation locale ---- */
.vc-fac__check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 1.1rem;
  font-size: 0.92rem;
  cursor: pointer;
}
.vc-fac__check[hidden] {
  display: none;
}
.vc-fac__check input {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  accent-color: var(--vc-teal);
  flex-shrink: 0;
}
