/* InviaApp Mobile — style-mobile.css */

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

:root {
  --blue:    #2E86AB;
  --blue-dk: #1a5f7a;
  --green:   #27AE60;
  --orange:  #E67E22;
  --red:     #E74C3C;
  --grey-1:  #f4f6f8;
  --grey-2:  #e0e6ed;
  --grey-3:  #8492a6;
  --text:    #1a202c;
  --safe-b:  env(safe-area-inset-bottom, 0px);
  --safe-t:  env(safe-area-inset-top, 0px);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--grey-1);
  -webkit-tap-highlight-color: transparent;
}

/* ── Header ── */
.m-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--blue);
  color: #fff;
  padding: calc(12px + var(--safe-t)) 16px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.m-header h1 { font-size: 1.1rem; font-weight: 700; flex: 1; }
.m-header .back-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px 8px 4px 0;
  line-height: 1;
}
.m-header .badge {
  background: var(--orange);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

/* ── Main content ── */
.m-main {
  padding: 16px;
  padding-bottom: calc(80px + var(--safe-b));
  min-height: calc(100vh - 56px);
}

/* ── Cards ── */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
  -webkit-user-select: none;
  user-select: none;
}
.card:active { transform: scale(.98); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.card .meta { font-size: .82rem; color: var(--grey-3); }
.card .stat-row {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}
.card .stat {
  background: var(--grey-1);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: .8rem;
  font-weight: 600;
  flex: 1;
  text-align: center;
}
.card .stat span { display: block; font-size: 1.2rem; font-weight: 800; color: var(--blue); }

/* ── Statut badges ── */
.badge-statut {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.badge-actif    { background: #d4edda; color: #155724; }
.badge-planifie { background: #cce5ff; color: #004085; }
.badge-termine  { background: #e2e3e5; color: #383d41; }

/* ── Boutons principaux ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  font-size: .95rem;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  transition: opacity .15s;
  width: 100%;
  margin-bottom: 10px;
}
.btn:active { opacity: .8; }
.btn-blue   { background: var(--blue);   color: #fff; }
.btn-green  { background: var(--green);  color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-red    { background: var(--red);    color: #fff; }
.btn-grey   { background: var(--grey-2); color: var(--text); }
.btn-sm { padding: 8px 14px; font-size: .85rem; width: auto; margin-bottom: 0; }

/* ── Formulaires ── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--grey-3);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1.5px solid var(--grey-2);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: .95rem;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--blue);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group .hint { font-size: .75rem; color: var(--grey-3); margin-top: 4px; }

/* ── Section titre ── */
.section-title {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--grey-3);
  margin: 20px 0 10px;
}

/* ── Contact list ── */
.contact-item {
  background: #fff;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.contact-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-info .name { font-weight: 700; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-info .sub  { font-size: .8rem; color: var(--grey-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  background: var(--grey-1);
  border: none;
  border-radius: 8px;
  width: 36px; height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:active { opacity: .7; }
.icon-btn.converted { background: #d4edda; }

/* ── Zone scan ── */
.scan-zone {
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 4/3;
  width: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-zone video, .scan-zone img { width: 100%; height: 100%; object-fit: cover; }
.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.4);
}
.scan-overlay .scan-msg { color: #fff; font-size: 1rem; font-weight: 600; text-align: center; padding: 16px; }

/* ── Spinner ── */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--grey-2);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-b));
  left: 50%;
  transform: translateX(-50%);
  background: #1a202c;
  color: #fff;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: .9rem;
  font-weight: 600;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
  pointer-events: none;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red);   }

/* ── Alerte inline ── */
.alert {
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .88rem;
  margin-bottom: 12px;
}
.alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid #ffc107; }
.alert-info    { background: #cce5ff; color: #004085; border-left: 4px solid #007bff; }

/* ── Champ résultat Vision ── */
.field-extracted {
  background: var(--grey-1);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.field-extracted .f-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--grey-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  min-width: 80px;
  padding-top: 2px;
}
.field-extracted .f-input {
  flex: 1;
  border: none;
  background: none;
  font-size: .95rem;
  color: var(--text);
  padding: 0;
}
.field-extracted .f-input:focus { outline: none; border-bottom: 1.5px solid var(--blue); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--grey-3);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: .95rem; }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--grey-2);
  margin: 16px 0;
}

/* ── Compteur rapide ── */
.counter-display {
  font-size: 4rem;
  font-weight: 900;
  color: var(--blue);
  text-align: center;
  line-height: 1;
  padding: 20px 0;
}
.counter-sub { text-align: center; font-size: .85rem; color: var(--grey-3); margin-top: 4px; }

/* ── Responsive guard ── */
@media (min-width: 600px) {
  .m-main { max-width: 480px; margin: 0 auto; }
}
