/* Evotic — Modal "Ajouter contact" v2.44 (refonte design + scanner caméra live) */

/* ───────── Modal form ───────── */
.contact-add-form-v2 {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 8px;
}

/* ───────── Scan buttons (caméra + image) ───────── */
.contact-scan-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contact-scan-btn-primary {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 18px 16px;
  background: linear-gradient(135deg, #6750A4 0%, #7F67BE 100%);
  color: #FFF;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 4px 16px rgba(103, 80, 164, 0.25);
  transition: transform .15s, box-shadow .15s;
}
.contact-scan-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(103, 80, 164, 0.35);
}
.contact-scan-btn-primary:active { transform: translateY(0); }
.contact-scan-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.contact-scan-btn-primary i {
  font-size: 24px;
  margin-bottom: 2px;
}
.contact-scan-label {
  font-size: 15px;
  font-weight: 700;
}
.contact-scan-hint-small {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.9;
  margin-top: 2px;
}
.contact-scan-btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 16px;
  background: var(--card-bg, #FFF);
  color: var(--text, #1a1a1a);
  border: 1.5px solid var(--border, #E5E7EB);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background .15s, border-color .15s;
}
.contact-scan-btn-secondary:hover {
  background: #FFF7ED;
  border-color: #6750A4;
}

/* ───────── Preview après scan ───────── */
.contact-scan-preview-v2 {
  background: linear-gradient(135deg, #ECFDF5 0%, #D1FAE5 100%);
  border: 1.5px solid #16A34A;
  border-radius: 14px;
  padding: 12px;
  animation: scanSuccessFadeIn 0.3s ease-out;
}
@keyframes scanSuccessFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.contact-scan-preview-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.contact-scan-avatar-v2 {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #6750A4;
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.contact-scan-avatar-v2 img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.contact-scan-info { flex: 1; min-width: 0; }
.contact-scan-pseudo-v2 {
  font-weight: 700;
  font-size: 15px;
  color: #064E3B;
}
.contact-scan-meta {
  font-size: 11px;
  color: #047857;
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.contact-scan-clear-v2 {
  background: rgba(255, 255, 255, 0.6);
  border: none;
  color: #047857;
  cursor: pointer;
  font-size: 14px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.contact-scan-clear-v2:hover { background: rgba(255, 255, 255, 0.9); }

/* ───────── Divider OU ───────── */
.contact-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 4px 0;
  color: var(--text-muted, #6B7280);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.contact-divider::before,
.contact-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border, #E5E7EB);
}

/* ───────── Inputs (téléphone, surnom) ───────── */
.contact-input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contact-input-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #6750A4;
  letter-spacing: 0.02em;
}
.contact-input-label i { font-size: 12px; }
.contact-input-wrap {
  display: flex;
  align-items: stretch;
  background: var(--card-bg, #FFF);
  border: 1.5px solid var(--border, #E5E7EB);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.contact-input-wrap:focus-within {
  border-color: #6750A4;
  box-shadow: 0 0 0 3px rgba(103, 80, 164, 0.12);
}
.contact-input-prefix {
  display: flex;
  align-items: center;
  padding: 0 12px 0 14px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-muted, #6B7280);
  background: rgba(0, 0, 0, 0.02);
  border-right: 1px solid var(--border, #E5E7EB);
  flex-shrink: 0;
}
.contact-input-v2 {
  flex: 1;
  border: none;
  background: transparent;
  padding: 14px 14px;
  font-size: 16px; /* 16px = pas de zoom auto iOS */
  font-weight: 500;
  color: var(--text, #1a1a1a);
  outline: none;
  font-family: inherit;
  min-width: 0;
}
.contact-input-v2::placeholder {
  color: var(--text-muted, #9CA3AF);
  font-weight: 400;
}
.contact-input-hint-v2 {
  font-size: 11px;
  color: var(--text-muted, #6B7280);
  line-height: 1.4;
  padding-left: 4px;
}

/* ───────── Submit button ───────── */
.contact-submit-btn-v2 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(135deg, #6750A4 0%, #7F67BE 100%);
  color: #FFF;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 800;
  font-size: 16px;
  margin-top: 8px;
  box-shadow: 0 4px 16px rgba(103, 80, 164, 0.3);
  transition: transform .15s, box-shadow .15s, opacity .15s;
}
.contact-submit-btn-v2:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(103, 80, 164, 0.4);
}
.contact-submit-btn-v2:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: linear-gradient(135deg, #9CA3AF 0%, #6B7280 100%);
  box-shadow: none;
}
.contact-submit-btn-v2 .fa-circle-notch { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── Error message ───────── */
.contact-err-v2 {
  font-size: 12px;
  color: #DC2626;
  background: #FEE2E2;
  padding: 10px 14px;
  border-radius: 10px;
  margin: 4px 0 0;
  display: none;
  animation: errFadeIn 0.2s;
}
.contact-err-v2:not(:empty) { display: block; }
@keyframes errFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

/* ───────── Caméra live scanner overlay ───────── */
.contact-camera-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #000;
  display: flex;
  flex-direction: column;
}
.contact-camera-overlay[hidden] { display: none; }
.contact-camera-topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top, 12px)) 14px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.65), rgba(0,0,0,0));
  color: #FFF;
}
.contact-camera-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #FFF;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.contact-camera-title {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  flex: 1;
  margin: 0 12px;
}
.contact-camera-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.contact-camera-frame-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.contact-camera-frame {
  width: min(270px, 70vw);
  height: min(270px, 70vw);
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  position: relative;
  box-shadow:
    0 0 0 9999px rgba(0, 0, 0, 0.55),
    inset 0 0 0 2px rgba(103, 80, 164, 0.4);
  animation: cameraFramePulse 2.2s ease-in-out infinite;
}
.contact-camera-frame::before,
.contact-camera-frame::after,
.contact-camera-frame > .corner-tl,
.contact-camera-frame > .corner-tr {
  /* corners via pseudo-elements next */
}
.contact-camera-frame::before {
  content: '';
  position: absolute;
  top: -3px; left: -3px;
  width: 32px; height: 32px;
  border-top: 4px solid #6750A4;
  border-left: 4px solid #6750A4;
  border-top-left-radius: 24px;
}
.contact-camera-frame::after {
  content: '';
  position: absolute;
  bottom: -3px; right: -3px;
  width: 32px; height: 32px;
  border-bottom: 4px solid #6750A4;
  border-right: 4px solid #6750A4;
  border-bottom-right-radius: 24px;
}
@keyframes cameraFramePulse {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), inset 0 0 0 2px rgba(103, 80, 164,0.4); }
  50%      { box-shadow: 0 0 0 9999px rgba(0,0,0,0.55), inset 0 0 0 2px rgba(103, 80, 164,0.8); }
}
.contact-camera-status {
  color: #FFF;
  font-size: 13px;
  font-weight: 600;
  margin-top: 18px;
  text-align: center;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.contact-camera-status.success {
  background: rgba(22, 163, 74, 0.9);
}
.contact-camera-status.error {
  background: rgba(220, 38, 38, 0.9);
}
.contact-camera-footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  padding: 20px 16px max(20px, env(safe-area-inset-bottom, 20px));
  background: linear-gradient(0deg, rgba(0,0,0,0.7), rgba(0,0,0,0));
}
.contact-camera-fallback {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #FFF;
  font-weight: 600;
  font-size: 13px;
  border-radius: 999px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.contact-camera-fallback:hover { background: rgba(255, 255, 255, 0.25); }

/* ───────── Toast feedback ───────── */
.contact-toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9100;
  background: #16A34A;
  color: #FFF;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.3s ease-out;
  max-width: calc(100vw - 32px);
}
.contact-toast.toast-err { background: #DC2626; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}
.contact-toast.out { animation: toastOut 0.25s ease-in forwards; }
