/* ============================================================
   SIP PV Recette — Design v4
   ============================================================ */

:root {
  --sip-dark2:      #1A2B4A;
  --sip-cyan:       #00AEEF;
  --sip-cyan-dark:  #0090C8;
  --sip-white:      #FFFFFF;
  --sip-danger:     #E74C3C;
  --sip-success:    #1D9E75;
  --sip-radius-field: 20px;
  --sip-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Barre admin WP masquée pour poseur */
body.role-poseur_sip #wpadminbar { display: none !important; }
body.role-poseur_sip { margin-top: 0 !important; padding-top: 0 !important; }

/* Fond global bleu foncé sur tout body + Elementor */
html, html body.role-poseur_sip { background: var(--sip-dark2) !important; overflow-x: hidden !important; }
body.role-poseur_sip .site,
body.role-poseur_sip main,
body.role-poseur_sip #primary,
body.role-poseur_sip .elementor-section,
body.role-poseur_sip .elementor-container,
body.role-poseur_sip .elementor-widget-wrap,
body.role-poseur_sip .e-con,
body.role-poseur_sip .e-con-inner { background: var(--sip-dark2) !important; }

/* PWA plein écran */
@media (display-mode: standalone) {
  .sip-header { padding-top: env(safe-area-inset-top, 44px); }
  .sip-footer { padding-bottom: calc(env(safe-area-inset-bottom, 20px) + 12px); }
}

.sip-app, .sip-app * { box-sizing: border-box; -webkit-font-smoothing: antialiased; }

.sip-app {
  font-family: var(--sip-font);
  background: var(--sip-dark2);
  width: 100%; max-width: 100%; margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex; flex-direction: column;
  color: var(--sip-white);
  overflow-x: hidden;
}

/* Header */
.sip-header {
  background: var(--sip-dark2); padding: 12px 16px 10px;
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid rgba(0,174,239,0.2);
}
.sip-header-top {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 12px;
}
.sip-logo { display: flex; align-items: center; gap: 10px; }
.sip-logo-img { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--sip-cyan); object-fit: contain; }
.sip-logo-text strong { display: block; font-size: 13px; font-weight: 700; color: var(--sip-white); }
.sip-logo-text span   { display: block; font-size: 10px; color: rgba(255,255,255,0.6); }
.sip-user-chip {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,174,239,0.15); border: 1px solid var(--sip-cyan);
  border-radius: 20px; padding: 4px 10px 4px 4px; max-width: 160px; overflow: hidden;
}
.sip-user-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--sip-cyan); color: var(--sip-dark2);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.sip-user-name { font-size: 10px; color: var(--sip-white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sip-steps-bar { display: flex; gap: 4px; margin-bottom: 6px; }
.sip-step-seg { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.15); transition: background 0.3s; }
.sip-step-seg.active { background: var(--sip-cyan); }
.sip-step-seg.done   { background: rgba(0,174,239,0.4); }
.sip-step-info { display: flex; justify-content: space-between; }
.sip-step-label, .sip-step-counter { font-size: 11px; color: rgba(255,255,255,0.6); }

/* Écran d'accueil */
.sip-welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 70vh; gap: 32px; padding: 40px 24px; text-align: center;
}
.sip-welcome-title { font-size: 18px; font-weight: 700; color: var(--sip-cyan); text-transform: uppercase; letter-spacing: 1px; }
.sip-welcome-logo { width: 180px; height: 180px; border-radius: 50%; border: 4px solid var(--sip-cyan); object-fit: contain; padding: 10px; }

/* Content */
.sip-content { flex: 1; padding: 16px 16px 20px; display: flex; flex-direction: column; gap: 20px; }

/* Cards */
.sip-card { background: transparent; animation: sipFadeUp 0.2s ease both; }
@keyframes sipFadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.sip-card-title { font-size: 12px; font-weight: 700; color: var(--sip-cyan); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }

/* Fields — arrondi 20px */
.sip-field { margin-bottom: 10px; }
.sip-field:last-child { margin-bottom: 0; }
.sip-field label { display: block; font-size: 11px; color: rgba(255,255,255,0.7); margin-bottom: 5px; font-weight: 500; }
.sip-field label .req { color: var(--sip-cyan); }

.sip-field input,
.sip-field select,
.sip-field textarea {
  width: 100% !important;
  font-size: 16px !important;
  padding: 13px 18px !important;
  border: none !important;
  border-radius: var(--sip-radius-field) !important;
  background: var(--sip-white) !important;
  color: var(--sip-dark2) !important;
  font-family: var(--sip-font) !important;
  outline: none !important;
  transition: box-shadow 0.15s !important;
  -webkit-appearance: none !important;
  appearance: none !important;
}
.sip-field textarea {
  border-radius: 16px !important;
  height: 90px !important;
  resize: none !important;
  line-height: 1.5 !important;
}
.sip-field input:focus,
.sip-field select:focus,
.sip-field textarea:focus { box-shadow: 0 0 0 3px var(--sip-cyan) !important; }
.sip-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%231A2B4A' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 18px center; padding-right: 44px;
}
.sip-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Toggles */
.sip-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 0; border-bottom: 1px dashed rgba(0,174,239,0.25); font-size: 14px; color: var(--sip-white);
}
.sip-toggle-row:last-child { border-bottom: none; }
.sip-toggle {
  width: 44px; height: 24px; border-radius: 12px;
  background: rgba(255,255,255,0.2); border: 1px solid rgba(255,255,255,0.3);
  position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.sip-toggle.on { background: var(--sip-cyan); border-color: var(--sip-cyan); }
.sip-toggle::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: white; top: 2px; left: 2px; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.sip-toggle.on::after { left: 22px; }

/* Vehicle cards */
.sip-vehicle-card { background: rgba(0,0,0,0.2); border: 1px solid var(--sip-cyan); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.sip-vehicle-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sip-vehicle-badge { font-size: 12px; font-weight: 700; background: var(--sip-cyan); color: var(--sip-dark2); padding: 4px 14px; border-radius: 50px; text-transform: uppercase; }

/* Bouton suppression véhicule — croix outline cyan */
.sip-vehicle-delete {
  width: 32px !important; height: 32px !important; border-radius: 50% !important;
  background: transparent !important; color: var(--sip-cyan) !important;
  border: 2px solid var(--sip-cyan) !important;
  font-size: 16px !important; font-weight: 700 !important;
  cursor: pointer !important; display: flex !important;
  align-items: center !important; justify-content: center !important;
  line-height: 1 !important;
}
.sip-vehicle-delete:active { background: var(--sip-cyan) !important; color: var(--sip-dark2) !important; }

/* Bouton ajouter véhicule — même style que ÉTAPE SUIVANTE */
.sip-add-vehicle-btn {
  width: 100% !important; padding: 14px 20px !important;
  border: 2px solid var(--sip-cyan) !important; border-radius: 50px !important;
  background: transparent !important; color: var(--sip-cyan) !important;
  font-size: 15px !important; font-weight: 700 !important;
  cursor: pointer !important; font-family: var(--sip-font) !important;
  letter-spacing: 0.5px !important;
  display: flex !important; align-items: center !important; justify-content: center !important; gap: 8px !important;
}
.sip-add-vehicle-btn:active { background: var(--sip-cyan) !important; color: var(--sip-dark2) !important; }

/* Photos */
.sip-photo-zone { display: block; cursor: pointer; margin-top: 10px; }
.sip-photo-input { display: none; }
.sip-photo-zone-inner {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 13px; border: none; border-radius: 50px;
  background: var(--sip-cyan); color: var(--sip-dark2); font-size: 14px; font-weight: 700;
}
.sip-photo-icon { font-size: 18px; }
.sip-photo-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sip-photo-thumb-wrap { position: relative; display: inline-block; }
.sip-photo-thumb { width: 70px; height: 70px; border-radius: 10px; object-fit: cover; border: 2px solid var(--sip-white); }
.sip-photo-thumb-del {
  position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--sip-dark2); color: var(--sip-white); border: 2px solid white;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; cursor: pointer;
}

/* Signatures */
.sip-sig-wrap {
  border: 2px solid rgba(255,255,255,0.3); border-radius: 16px;
  background: var(--sip-white); height: 120px;
  display: flex; align-items: center; justify-content: center;
  margin-top: 8px; position: relative; overflow: hidden; touch-action: none;
}
.sip-sig-wrap canvas { position: absolute; top: 0; left: 0; cursor: crosshair; touch-action: none; }
.sip-sig-hint { font-size: 12px; color: #aaa; pointer-events: none; user-select: none; }
.sip-sig-clear {
  position: absolute; top: 8px; right: 8px; font-size: 11px; color: var(--sip-dark2);
  background: #f0f0f0; border: 1px solid #ddd; border-radius: 6px; padding: 3px 10px;
  cursor: pointer; font-family: var(--sip-font); z-index: 10;
}

/* Footer */
.sip-footer {
  position: sticky !important;
  bottom: 0 !important;
  left: 0 !important; right: 0 !important;
  width: 100% !important; max-width: 100% !important;
  padding: 10px 16px 28px !important; background: var(--sip-dark2) !important;
  border-top: 1px solid rgba(0,174,239,0.15) !important;
  display: flex !important; gap: 10px !important; z-index: 100 !important; align-items: center !important;
  box-sizing: border-box !important; overflow: hidden !important;
  /* Colle au bas de l'écran sur iOS sans dépendre de position:fixed */
  margin-top: auto !important;
}

/* Bouton RETOUR — même style que SUIVANT */
.sip-btn-back {
  flex: 0 0 auto !important; padding: 14px 20px !important;
  border: 2px solid var(--sip-cyan) !important; border-radius: 50px !important;
  background: transparent !important; color: var(--sip-cyan) !important;
  font-size: 15px !important; font-weight: 700 !important; font-family: var(--sip-font) !important;
  cursor: pointer !important; letter-spacing: 0.5px !important;
  display: flex !important; align-items: center !important; justify-content: center !important; gap: 8px !important;
  white-space: nowrap !important;
}
.sip-btn-back:active { background: var(--sip-cyan) !important; color: var(--sip-dark2) !important; }

/* Bouton SUIVANT */
.sip-btn-next {
  flex: 1 !important; padding: 14px 20px !important;
  border: 2px solid var(--sip-cyan) !important; border-radius: 50px !important;
  background: transparent !important; color: var(--sip-cyan) !important;
  font-size: 15px !important; font-weight: 700 !important; font-family: var(--sip-font) !important;
  cursor: pointer !important; letter-spacing: 0.5px !important;
  display: flex !important; align-items: center !important; justify-content: center !important; gap: 8px !important;
}
.sip-btn-next:active { background: var(--sip-cyan) !important; color: var(--sip-dark2) !important; }
.sip-btn-next.loading { opacity: 0.5 !important; pointer-events: none !important; }

/* Bouton GÉNÉRER PDF */
.sip-btn-next.btn-pdf {
  background: var(--sip-success) !important; border-color: var(--sip-success) !important;
  color: white !important; max-width: 240px !important; margin-left: auto !important;
}

/* Succès */
.sip-success-screen { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 20px 100px; gap: 16px; }
.sip-success-ring { width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--sip-cyan); background: rgba(0,174,239,0.1); display: flex; align-items: center; justify-content: center; font-size: 36px; color: var(--sip-cyan); }
.sip-success-title { font-size: 20px; font-weight: 700; color: var(--sip-white); }
.sip-success-sub { font-size: 13px; color: rgba(255,255,255,0.7); line-height: 1.7; }
.sip-success-meta { background: rgba(0,0,0,0.2); border: 1px solid var(--sip-cyan); border-radius: 16px; padding: 14px 18px; width: 100%; }
.sip-meta-row { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 12px; }
.sip-meta-row:last-child { border-bottom: none; }
.sip-meta-label { color: rgba(255,255,255,0.6); }
.sip-meta-value { font-weight: 600; font-size: 11px; font-family: monospace; color: var(--sip-white); }
.sip-meta-ok { color: var(--sip-success); font-weight: 700; font-size: 11px; }
.sip-success-btns { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.sip-btn-primary { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border: none; border-radius: 50px; background: var(--sip-cyan); color: var(--sip-dark2); font-size: 14px; font-weight: 700; text-decoration: none; font-family: var(--sip-font); }
.sip-btn-secondary { padding: 14px; border: 2px solid var(--sip-white); border-radius: 50px; background: transparent; color: var(--sip-white); font-size: 14px; font-weight: 600; font-family: var(--sip-font); cursor: pointer; }

/* Erreur */
.sip-error { background: rgba(231,76,60,0.15); color: #ff6b6b; border: 1px solid var(--sip-danger); padding: 12px 16px; border-radius: 12px; font-size: 13px; }

/* ── Autocomplétion véhicules ── */
.sip-autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--sip-white);
  border-radius: 0 0 12px 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  z-index: 200;
  display: none;
  overflow: hidden;
  max-height: 200px;
  overflow-y: auto;
}
.sip-autocomplete-list div {
  padding: 10px 16px;
  font-size: 14px;
  color: var(--sip-dark2);
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.sip-autocomplete-list div:last-child { border-bottom: none; }
.sip-autocomplete-list div:active { background: var(--sip-blue-light); }
