/* ===================================================================
   FRIPE·SCAN — feuille de style
   Direction : étiquette de vêtement / ticket de friperie.
   Palette : papier pierre, encre tailleur, jaune étiquette-prix,
             vert "rentable", rouille "à vérifier".
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;800&family=Space+Mono:wght@400;700&family=Inter:wght@400;500;600&display=swap');

:root{
  --paper:      #E7E2D6;
  --paper-dim:  #DCD6C7;
  --card:       #F3EFE5;
  --ink:        #1F2A24;
  --ink-soft:   #4A554C;
  --tag-yellow: #D9A62E;
  --tag-yellow-deep: #B8871E;
  --profit:     #3B6255;
  --profit-bg:  #E4EBE3;
  --warn:       #B5482C;
  --warn-bg:    #F1E2DA;
  --line:       #C9C2AF;

  --font-display: 'Barlow Condensed', sans-serif;
  --font-mono:    'Space Mono', monospace;
  --font-body:    'Inter', sans-serif;

  --radius: 14px;
}

*{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
}

body{
  min-height: 100dvh;
  display: flex;
  justify-content: center;
}

.app{
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  background: var(--paper);
  padding: 20px 18px 40px;
  position: relative;
}

/* ---------- Header ---------- */
.app__header{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
}
.app__title{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1;
}
.app__title span{ color: var(--tag-yellow-deep); }
.app__subtitle{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---------- Signature element : la photo en étiquette suspendue ---------- */
.tag-wrap{
  display: flex;
  justify-content: center;
  margin: 26px 0 30px;
}

.tag{
  position: relative;
  width: 78%;
  aspect-ratio: 3 / 4;
  background: var(--card);
  transform: rotate(-3deg);
  border-radius: 10px 26px 10px 10px;
  box-shadow: 0 10px 22px rgba(31,42,36,0.16);
  border: 1.5px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: transform .18s ease;
}
.tag:active{ transform: rotate(-3deg) scale(0.98); }

.tag::before{
  /* punch hole */
  content: "";
  position: absolute;
  top: 14px;
  left: 22px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--ink);
  z-index: 3;
}
.tag::after{
  /* string */
  content: "";
  position: absolute;
  top: -14px;
  left: 29px;
  width: 2px;
  height: 26px;
  background: var(--ink-soft);
  transform: rotate(18deg);
  transform-origin: top center;
}

.tag img{
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tag__placeholder{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  padding: 20px;
  text-align: center;
}
.tag__placeholder svg{ width: 40px; height: 40px; opacity: 0.7; }
.tag__placeholder span{
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.capture-actions{
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 8px;
}
.btn{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border: none;
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn--primary{ background: var(--ink); color: var(--paper); }
.btn--ghost{ background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn:disabled{ opacity: 0.4; cursor: not-allowed; }
.btn--full{ width: 100%; justify-content: center; }

input[type="file"]{ display: none; }

/* ---------- Statut analyse ---------- */
.status-line{
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  min-height: 18px;
  margin: 4px 0 18px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.status-line.is-active::before{
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--tag-yellow-deep);
  animation: pulse 1s infinite ease-in-out;
}
@keyframes pulse{
  0%,100%{ opacity: 1; transform: scale(1); }
  50%{ opacity: .35; transform: scale(0.7); }
}

/* ---------- Fiche produit : bande d'étiquette imprimée ---------- */
.label-strip{
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 20px;
  overflow: hidden;
}
.label-strip__title{
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 10px 16px 0;
}

.field-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px dashed var(--line);
}
.field-row:last-child{ border-bottom: none; }

.field-row__label{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--ink);
  min-width: 78px;
}

.field-row__value{
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-row__value input{
  flex: 1;
  border: none;
  background: transparent;
  border-bottom: 1.5px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 4px 2px;
  color: var(--ink);
  min-width: 0;
}
.field-row__value input::placeholder{ color: #9a927e; }
.field-row__value input:focus{ outline: none; border-bottom-color: var(--tag-yellow-deep); }

.confidence-dot{
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.confidence-dot--high{ background: var(--profit); }
.confidence-dot--medium{ background: var(--tag-yellow-deep); }
.confidence-dot--none{ background: var(--line); border: 1px solid var(--ink-soft); }

.legend{
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-soft);
  padding: 10px 16px 14px;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.legend span{ display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Bloc prix : ticket de caisse ---------- */
.receipt{
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 16px 16px 18px;
  position: relative;
}
.receipt__title{
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.receipt-row{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 7px 0;
  border-bottom: 1px dotted var(--line);
}
.receipt-row:last-of-type{ border-bottom: none; }
.receipt-row__platform{ color: var(--ink-soft); text-transform: uppercase; letter-spacing: .5px; }
.receipt-row__price{ font-weight: 700; }
.receipt-row__price.is-empty{ color: #9a927e; font-weight: 400; }

.receipt-total{
  margin-top: 14px;
  padding-top: 14px;
  border-top: 2px solid var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.receipt-total__label{
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
}
.receipt-total__value{
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 22px;
}

.verdict{
  margin-top: 12px;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  text-align: center;
}
.verdict--profit{ background: var(--profit-bg); color: var(--profit); }
.verdict--warn{ background: var(--warn-bg); color: var(--warn); }

.price-empty-note{
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 10px;
  line-height: 1.5;
}

.field-row__value select{
  flex: 1;
  border: none;
  background: transparent;
  border-bottom: 1.5px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 4px 2px;
  color: var(--ink);
  min-width: 0;
}
.field-row__value select:focus{ outline: none; border-bottom-color: var(--tag-yellow-deep); }

.history-block{ margin-top: 6px; }

.sold-form{
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
.sold-form input[type="number"]{
  flex: 1;
  border: none;
  background: transparent;
  border-bottom: 1.5px solid var(--ink);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 4px 2px;
  color: var(--ink);
}
.sold-form input:focus{ outline: none; border-bottom-color: var(--tag-yellow-deep); }
.sold-form .btn{ margin-top: 10px; }

/* ---------- Divers ---------- */
.hidden{ display: none !important; }

.footnote{
  margin-top: 26px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-soft);
  text-align: center;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce){
  .status-line.is-active::before{ animation: none; }
}

/* ---------- Résultats enrichis : prix, confiance et traçabilité ---------- */
.receipt-subtitle{
  margin: 14px 0 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.price-summary{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
  margin: 0 0 12px;
}
.price-summary__item{
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px;
  background:rgba(255,255,255,.18);
}
.price-summary__label,.backend-note__label{
  display:block;
  font-family:var(--font-mono);
  font-size:10px;
  color:var(--ink-soft);
  text-transform:uppercase;
  letter-spacing:.7px;
}
.price-summary strong{
  display:block;
  margin-top:4px;
  font-family:var(--font-mono);
  font-size:18px;
}
.source-details{ margin-top:14px; padding-top:4px; border-top:1px dashed var(--line); }
.source-list{ display:grid; gap:6px; margin-top:8px; }
.source-item{
  display:flex; justify-content:space-between; gap:12px; align-items:baseline;
  padding:7px 0; border-bottom:1px dotted var(--line);
  font-family:var(--font-mono); font-size:11px;
}
.source-item__name{ color:var(--ink-soft); }
.source-item__detail{ text-align:right; }
.source-item a{ color:var(--profit); }
.backend-note{
  margin-top:14px; padding:10px 12px; border-left:3px solid var(--tag-yellow-deep);
  background:var(--paper-dim); font-family:var(--font-mono); font-size:11px;
}
.backend-note strong{ margin-right:6px; }
.backend-note__detail{ color:var(--ink-soft); }
