/* === Auto Motive Concept — PWA styles === */
:root {
  --amc-red: #c8102e;
  --amc-red-dark: #a00d24;
  --amc-silver: #c0c0c0;
  --amc-bg: #0a0a0a;
  --amc-fg: #ffffff;
  --amc-card: #161616;
  --amc-card-hover: #1f1f1f;
  --amc-border: #2a2a2a;
  --amc-text-mute: #909090;
  --amc-success: #22c55e;
  --amc-error: #ef4444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  background: var(--amc-bg);
  color: var(--amc-fg);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter",
    sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

input,
button,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-main {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
}
.login-logo {
  width: 220px;
  height: auto;
  margin-bottom: 16px;
}
.login-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 4px;
}
.login-sub {
  color: var(--amc-text-mute);
  margin-bottom: 32px;
  font-size: 14px;
}
.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}
.login-form label span {
  font-size: 13px;
  color: var(--amc-text-mute);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.login-form input {
  background: var(--amc-card);
  border: 1px solid var(--amc-border);
  color: var(--amc-fg);
  padding: 14px 16px;
  border-radius: 8px;
  font-size: 16px;
}
.login-form input:focus {
  outline: 2px solid var(--amc-red);
  border-color: var(--amc-red);
}
.login-form button {
  background: var(--amc-red);
  color: var(--amc-fg);
  padding: 16px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 8px;
  transition: background 0.15s;
}
.login-form button:hover:not(:disabled) {
  background: var(--amc-red-dark);
}
.login-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.login-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--amc-error);
  color: #fca5a5;
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 4px;
}

/* ============================================================
   APP PAGE
   ============================================================ */
.app-page {
  padding-bottom: 32px;
}
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--amc-border);
  background: var(--amc-bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header-logo {
  height: 40px;
  width: auto;
}
.app-header-text {
  flex: 1;
  min-width: 0;
}
.app-header-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header-sub {
  font-size: 12px;
  color: var(--amc-text-mute);
}
.app-header-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--amc-card);
  color: var(--amc-fg);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--amc-border);
  flex-shrink: 0;
  text-decoration: none;
}
.app-header-icon-btn:hover {
  background: var(--amc-card-hover);
}

/* === Liste "Vidéos récentes" (page /videos) === */
.recent-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.recent-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--amc-text-mute);
  font-size: 14px;
}
.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--amc-bg);
  border: 1px solid var(--amc-border);
  border-radius: 8px;
  flex-wrap: wrap;
}
.recent-item-info {
  flex: 1;
  min-width: 0;
}
.recent-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--amc-fg);
  word-break: break-word;
  line-height: 1.3;
}
.recent-item-meta {
  font-size: 12px;
  color: var(--amc-text-mute);
  margin-top: 2px;
}
.recent-item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.recent-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--amc-card);
  border: 1px solid var(--amc-border);
  color: var(--amc-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
  flex-shrink: 0;
}
.recent-action-btn:hover:not(:disabled) {
  background: var(--amc-red);
  border-color: var(--amc-red);
  color: var(--amc-fg);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.35);
}
.recent-action-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(200, 16, 46, 0.3);
}
.recent-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.recent-action-btn svg {
  display: block;
  pointer-events: none;
}
/* Bouton "Lire" : rouge AMC en repos (CTA principal de la ligne) */
.recent-action-btn.play {
  background: var(--amc-red);
  border-color: var(--amc-red);
}
.recent-action-btn.play:hover:not(:disabled) {
  background: var(--amc-red-dark);
  border-color: var(--amc-red-dark);
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.5);
}
/* Bouton "Supprimer" : signalé en repos par une icône poubelle distincte
   et un border-color qui vire au rouge dès le hover sans ambiguïté */
.recent-action-btn.delete:hover:not(:disabled) {
  background: var(--amc-error);
  border-color: var(--amc-error);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}
/* Bouton "Publier" : action ULTIME (étape 13 — workflow n8n).
   Dégradé rouge saturé + glow constant + lift + scale au hover pour signaler
   visuellement qu'il s'agit du CTA majeur de la ligne (publier sur les réseaux). */
.recent-action-btn.publish {
  background: linear-gradient(135deg, var(--amc-red) 0%, #ff4d6d 100%);
  border-color: #ff4d6d;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.4);
}
.recent-action-btn.publish:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--amc-red-dark) 0%, var(--amc-red) 100%);
  border-color: var(--amc-red);
  box-shadow: 0 6px 22px rgba(255, 77, 109, 0.65);
  transform: translateY(-2px) scale(1.05);
}
.recent-action-btn.publish:active:not(:disabled) {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 3px 10px rgba(200, 16, 46, 0.5);
}
/* État "publié" : marqueur vert (success), bouton non cliquable mais pleinement
   visible (pas d'opacité réduite — l'utilisateur doit voir clairement la coche).
   Sera positionné automatiquement par le workflow n8n en phase 13 quand la
   publication FB/IG sera confirmée (écrit submission.publication.publishedAt). */
.recent-action-btn.publish.published {
  background: var(--amc-success);
  border-color: var(--amc-success);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.35);
  cursor: default;
  opacity: 1;
  transform: none;
}
.recent-action-btn.publish.published:hover {
  /* Pas d'effet hover : c'est un marqueur, pas un CTA */
  background: var(--amc-success);
  border-color: var(--amc-success);
  box-shadow: 0 2px 6px rgba(34, 197, 94, 0.35);
  transform: none;
}
@keyframes recent-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* === Modal "Textes marketing FB/IG" (page /videos) === */
.social-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  animation: social-fade-in 0.18s ease-out;
}
/* L'attribut HTML `hidden` doit gagner sur `display: flex` ci-dessus
   (sinon la modale reste visible au chargement et bloque la page) */
.social-overlay[hidden] {
  display: none;
}
@keyframes social-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.social-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--amc-bg);
  border: 1px solid var(--amc-border);
  color: var(--amc-fg);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.social-close:hover {
  background: var(--amc-red);
  border-color: var(--amc-red);
}
.social-panel {
  width: 100%;
  max-width: 720px;
  background: var(--amc-card);
  border: 1px solid var(--amc-border);
  border-radius: 12px;
  padding: 16px;
  margin: 24px 0;
}
.social-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--amc-border);
}
.social-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.social-sub {
  font-size: 13px;
  color: var(--amc-text-mute);
  margin-top: 2px;
  word-break: break-word;
}
.social-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.social-regen-btn {
  background: var(--amc-bg);
  border: 1px solid var(--amc-border);
  color: var(--amc-fg);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.social-regen-btn:hover:not(:disabled) {
  background: var(--amc-red);
  border-color: var(--amc-red);
}
.social-regen-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.social-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.social-empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--amc-text-mute);
  font-size: 14px;
}
.social-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 48px 16px;
  color: var(--amc-text-mute);
  font-size: 14px;
}
.social-loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amc-red);
  animation: social-pulse 1s ease-in-out infinite;
}
@keyframes social-pulse {
  0%, 100% { opacity: 0.3; transform: scale(0.85); }
  50%      { opacity: 1; transform: scale(1.15); }
}
.social-variant {
  background: var(--amc-bg);
  border: 1px solid var(--amc-border);
  border-radius: 8px;
  padding: 14px;
}
.social-variant-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.social-variant-name {
  display: inline-block;
  background: var(--amc-red);
  color: var(--amc-fg);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.social-variant-audience {
  font-size: 13px;
  color: var(--amc-text-mute);
  font-style: italic;
}
.social-channel {
  margin-top: 12px;
}
.social-channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.social-channel-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--amc-silver);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.social-copy-btn {
  background: var(--amc-card);
  border: 1px solid var(--amc-border);
  color: var(--amc-fg);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s;
}
.social-copy-btn:hover {
  background: var(--amc-red);
  border-color: var(--amc-red);
}
.social-copy-btn.copied {
  background: var(--amc-success);
  border-color: var(--amc-success);
}
.social-textarea {
  width: 100%;
  background: var(--amc-card);
  border: 1px solid var(--amc-border);
  color: var(--amc-fg);
  padding: 10px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  min-height: 100px;
}
.social-textarea:focus {
  outline: 2px solid var(--amc-red);
  border-color: var(--amc-red);
}
.social-textarea.instagram {
  min-height: 140px;
}

/* === Modal "Publier sur FB / IG" (page /videos) === */
/* Réutilise .social-overlay / .social-panel / .social-header / .social-body /
   .social-empty / .social-loading. Ajoute uniquement les classes spécifiques
   à la sélection de variante, aux checkboxes canaux, au CTA et au toast. */

/* Cards radio "variante" (3 cartes empilées, une seule sélectionnable) */
.publish-variant-card {
  background: var(--amc-bg);
  border: 2px solid var(--amc-border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  position: relative;
}
.publish-variant-card:hover {
  border-color: var(--amc-silver);
}
.publish-variant-card.selected {
  border-color: var(--amc-red);
  background: rgba(200, 16, 46, 0.06);
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.15);
}
.publish-variant-card .publish-variant-radio {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--amc-border);
  background: var(--amc-card);
  flex-shrink: 0;
  transition: all 0.15s;
}
.publish-variant-card.selected .publish-variant-radio {
  border-color: var(--amc-red);
  background: var(--amc-red);
  box-shadow: inset 0 0 0 3px var(--amc-card);
}
.publish-variant-card-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-right: 32px; /* laisse la place pour le radio */
}
.publish-variant-name {
  display: inline-block;
  background: var(--amc-red);
  color: var(--amc-fg);
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.publish-variant-audience {
  font-size: 13px;
  color: var(--amc-text-mute);
  font-style: italic;
}
.publish-variant-preview {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
@media (min-width: 640px) {
  .publish-variant-preview {
    grid-template-columns: 1fr 1fr;
  }
}
.publish-variant-preview-block {
  background: var(--amc-card);
  border: 1px solid var(--amc-border);
  border-radius: 6px;
  padding: 10px 12px;
}
.publish-variant-preview-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--amc-silver);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.publish-variant-preview-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--amc-fg);
  white-space: pre-wrap;
  /* Tronque à 4 lignes via line-clamp pour garder la card compacte */
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* Variante "full" — affichage complet du texte (utilisé dans la modale Publier
   depuis la simplification 3 variantes → 1 seul texte, pour que l'utilisateur voie
   exactement ce qui sera publié). */
.publish-variant-preview-text--full {
  -webkit-line-clamp: unset;
  display: block;
  overflow: visible;
  font-size: 13px;
  line-height: 1.55;
}

/* Variante "readonly" — désactive le hover/sélection puisqu'il n'y a plus
   qu'une seule carte à afficher (preview, pas de choix). */
.publish-variant-card--readonly {
  cursor: default;
  border-color: var(--amc-border);
}
.publish-variant-card--readonly:hover {
  border-color: var(--amc-border);
}
.publish-variant-card--readonly .publish-variant-radio {
  display: none;
}

/* Section "canaux" (checkboxes Facebook / Instagram) */
.publish-channels-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--amc-bg);
  border: 1px solid var(--amc-border);
  border-radius: 8px;
  padding: 14px;
}
.publish-channels-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--amc-silver);
  letter-spacing: 1px;
  text-transform: uppercase;
}
.publish-channels-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.publish-channel-checkbox {
  flex: 1 1 calc(50% - 5px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--amc-card);
  border: 2px solid var(--amc-border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  user-select: none;
  transition: all 0.12s;
  min-width: 140px;
}
.publish-channel-checkbox:hover {
  border-color: var(--amc-silver);
}
.publish-channel-checkbox.checked {
  border-color: var(--amc-red);
  background: rgba(200, 16, 46, 0.08);
}
/* Canal désactivé (ex: Facebook — throttling API Meta). Non cochable, grisé. */
.publish-channel-checkbox.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: line-through;
  text-decoration-color: rgba(144, 144, 144, 0.5);
}
.publish-channel-checkbox.disabled:hover {
  border-color: var(--amc-border);
}
.publish-channel-checkbox input {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--amc-border);
  border-radius: 4px;
  background: var(--amc-bg);
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  margin: 0;
}
.publish-channel-checkbox input:checked {
  background: var(--amc-red);
  border-color: var(--amc-red);
}
.publish-channel-checkbox input:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Bouton CTA "Publier" plein largeur en bas de la modale */
.publish-cta {
  width: 100%;
  background: linear-gradient(135deg, var(--amc-red) 0%, #ff4d6d 100%);
  color: var(--amc-fg);
  border: none;
  border-radius: 8px;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.15s;
  box-shadow: 0 4px 12px rgba(200, 16, 46, 0.25);
  margin-top: 4px;
}
.publish-cta:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(200, 16, 46, 0.35);
}
.publish-cta:active:not(:disabled) {
  transform: translateY(0);
}
.publish-cta:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.publish-cta-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: publish-spin 0.7s linear infinite;
}
@keyframes publish-spin {
  to { transform: rotate(360deg); }
}

/* Bandeau d'info en bas de modale (rappels, warnings) */
.publish-info {
  background: rgba(255, 255, 255, 0.04);
  border-left: 3px solid var(--amc-silver);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--amc-text-mute);
}
.publish-info strong {
  color: var(--amc-fg);
}

/* Toast — succès / erreur après publication (top center, auto-hide) */
.publish-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--amc-card);
  border: 1px solid var(--amc-border);
  border-left: 4px solid var(--amc-red);
  color: var(--amc-fg);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  z-index: 200;
  max-width: calc(100vw - 32px);
  animation: toast-slide-in 0.25s ease-out;
}
.publish-toast[hidden] { display: none; }
.publish-toast.success { border-left-color: var(--amc-success); }
.publish-toast.error   { border-left-color: var(--amc-error); }
@keyframes toast-slide-in {
  from { opacity: 0; transform: translate(-50%, -16px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* Marqueur "publication en cours" sur la liste — bouton publish avec spinner */
.recent-action-btn.publish.pending {
  opacity: 0.85;
  pointer-events: none;
  background: rgba(200, 16, 46, 0.4);
}
.recent-action-btn.publish.pending svg {
  animation: publish-spin 0.7s linear infinite;
}

/* Marqueur "échec publication" — bouton orange/jaune cliquable pour retry */
.recent-action-btn.publish.failed {
  background: #d97706; /* amber-600 */
  border-color: #b45309;
}
.recent-action-btn.publish.failed:hover {
  background: #b45309;
}

.app-main {
  max-width: 700px;
  margin: 0 auto;
  padding: 16px;
}

.vehicle-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* === Sections === */
.section {
  background: var(--amc-card);
  border: 1px solid var(--amc-border);
  border-radius: 12px;
  padding: 20px 16px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.section-num {
  background: var(--amc-red);
  color: var(--amc-fg);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.section-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 999px;
}
.section-tag.required {
  background: var(--amc-red);
  color: var(--amc-fg);
}
.section-tag.optional {
  background: var(--amc-border);
  color: var(--amc-text-mute);
}
.section-help {
  font-size: 13px;
  color: var(--amc-text-mute);
  margin: 4px 0 16px 40px;
}

/* === Form fields === */
.vehicle-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}
.vehicle-form label > span {
  font-size: 12px;
  color: var(--amc-text-mute);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.vehicle-form input[type="text"],
.vehicle-form input[type="number"],
.vehicle-form select,
.vehicle-form textarea {
  background: var(--amc-bg);
  border: 1px solid var(--amc-border);
  color: var(--amc-fg);
  padding: 12px 14px;
  border-radius: 8px;
  width: 100%;
}
.vehicle-form input:focus,
.vehicle-form select:focus,
.vehicle-form textarea:focus {
  outline: 2px solid var(--amc-red);
  border-color: var(--amc-red);
}
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
@media (max-width: 540px) {
  .grid-3 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-3 label:last-child {
    grid-column: 1 / -1;
  }
}

/* === Checklist === */
.checklist-cat {
  margin-top: 16px;
}
.checklist-cat h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--amc-silver);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.checklist-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px 14px 10px 40px;
  min-height: 52px;
  background: var(--amc-bg);
  border: 1px solid var(--amc-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.3;
  transition: all 0.12s;
}
.checklist-item:hover {
  background: var(--amc-card-hover);
}
.checklist-item input[type="checkbox"] {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  accent-color: var(--amc-red);
  cursor: pointer;
}
.checklist-item.checked {
  background: rgba(200, 16, 46, 0.12);
  border-color: var(--amc-red);
}
.checklist-item.checked span {
  color: var(--amc-fg);
  font-weight: 600;
}

/* === Photo zones === */
.photo-zone {
  margin-top: 12px;
}
.zone-add-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 24px;
  border: 2px dashed var(--amc-border);
  border-radius: 8px;
  background: var(--amc-bg);
  color: var(--amc-text-mute);
  font-size: 14px;
  transition: all 0.12s;
}
.zone-add-btn:hover {
  border-color: var(--amc-red);
  color: var(--amc-fg);
  background: var(--amc-card-hover);
}
.zone-add-btn .plus {
  font-size: 36px;
  line-height: 1;
  font-weight: 300;
}
.zone-add-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* === Auto-tag IA === */
.ai-tag-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 16px;
  border: 1px solid var(--amc-border);
  border-radius: 6px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2a1a3e 100%);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.ai-tag-btn:hover:not(:disabled) {
  border-color: #8b5cf6;
  background: linear-gradient(135deg, #2a1a3e 0%, #3a1a4e 100%);
  transform: translateY(-1px);
}
.ai-tag-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ai-tag-btn.loading .ai-tag-icon {
  animation: ai-pulse 1.2s ease-in-out infinite;
}
.ai-tag-btn.loading .ai-tag-label::after {
  content: "…";
  display: inline-block;
  animation: ai-dots 1.2s steps(4, end) infinite;
  margin-left: 2px;
}
@keyframes ai-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.5; transform: scale(1.15); }
}
@keyframes ai-dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%  { content: "..."; }
  100% { content: ""; }
}

.ai-tag-status {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.4;
}
.ai-tag-status.pending {
  background: #1a1a2e;
  color: #c4b5fd;
  border: 1px solid #4c1d95;
}
.ai-tag-status.success {
  background: #052e1a;
  color: #86efac;
  border: 1px solid #166534;
}
.ai-tag-status.error {
  background: #2a0a0a;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
}

.photo-ai-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 10px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.4);
  pointer-events: none;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.photo-item {
  background: var(--amc-bg);
  border: 1px solid var(--amc-border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.photo-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--amc-bg);
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.85);
  color: var(--amc-fg);
  border: 1px solid var(--amc-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}
.photo-remove:hover {
  background: var(--amc-red);
  border-color: var(--amc-red);
}
.photo-label-select {
  width: 100%;
  padding: 8px;
  background: var(--amc-card);
  border: none;
  border-top: 1px solid var(--amc-border);
  color: var(--amc-fg);
  font-size: 12px;
}
.photo-name {
  font-size: 11px;
  color: var(--amc-text-mute);
  padding: 4px 8px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Submit === */
.section-submit {
  background: transparent;
  border: none;
  padding: 0;
}
.submit-btn {
  width: 100%;
  background: var(--amc-red);
  color: var(--amc-fg);
  padding: 18px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.submit-btn:hover:not(:disabled) {
  background: var(--amc-red-dark);
}
.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.submit-status {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  text-align: center;
}
.submit-status.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid var(--amc-success);
  color: #86efac;
}
.submit-status.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--amc-error);
  color: #fca5a5;
}
.submit-status.pending {
  background: rgba(200, 16, 46, 0.1);
  border: 1px solid var(--amc-red);
  color: #fca5a5;
}

/* ============================================================
   Phase 14.5 — Historique groupé par mois (sections collapsibles)
   ============================================================ */

/* Conteneur <details> par mois : utilise l'élément natif HTML5 pour l'accordéon
   (pas de JS nécessaire). L'attribut `open` sur le mois courant le déplie au load. */
.month-section {
  border: 1px solid var(--amc-border);
  border-radius: 10px;
  background: var(--amc-card);
  overflow: hidden;
}
.month-section + .month-section {
  margin-top: 12px;
}
.month-summary {
  cursor: pointer;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--amc-fg);
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  list-style: none;
  transition: background 0.15s ease;
}
/* Cache la flèche par défaut WebKit / Firefox, on met la nôtre */
.month-summary::-webkit-details-marker {
  display: none;
}
.month-summary::marker {
  content: "";
}
.month-summary::before {
  content: "›";
  font-size: 22px;
  line-height: 1;
  color: var(--amc-text-mute);
  display: inline-block;
  width: 14px;
  transition: transform 0.15s ease;
}
.month-section[open] > .month-summary::before {
  transform: rotate(90deg);
}
.month-summary:hover {
  background: var(--amc-card-hover);
}
.month-label {
  flex: 1;
}
.month-count {
  font-size: 12px;
  color: var(--amc-text-mute);
  font-weight: 500;
}
.month-items {
  padding: 4px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* === Vidéos supprimées (soft delete) === */
/* Ligne entière atténuée + bordure pointillée pour signaler "fichier absent" */
.recent-item.deleted {
  opacity: 0.6;
  border-style: dashed;
  background: transparent;
}
.recent-item.deleted .recent-item-name {
  color: var(--amc-text-mute);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(144, 144, 144, 0.4);
}
.recent-item-deleted-badge {
  color: var(--amc-text-mute);
  font-style: italic;
}
/* Boutons grisés et non cliquables sur ligne supprimée — sauf la pastille verte ✓
   "publié" qu'on garde visible (la publication est valide chez Meta indépendamment). */
.recent-item.deleted .recent-action-btn:not(.publish.published) {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.5;
}
/* Le <a> de téléchargement ne supporte pas `disabled` → on utilise une classe */
.recent-action-btn.is-disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.5;
}
