/* ═══════════════════════════════════════════════════════
   TraceFlow — main.css  v1.0.4  Palette: Terra & Tradizione
═══════════════════════════════════════════════════════ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:ital,wght@0,600;1,400&display=swap');

:root {
  /* Verde oliva — accent principale */
  --accent:    #6b8c42;
  --accent-lt: #8fad5a;
  --accent-dk: #3d2b1f;

  /* Terracotta — accent secondario / pulsanti */
  --terra:     #c4703f;
  --terra-lt:  #d9896a;
  --terra-dk:  #8f4e25;

  /* Crema — sfondi */
  --bg:        #f5f0e8;
  --bg2:       #fffdf7;
  --amber:     #d4a017;

  /* Testi */
  --text:      #2c1810;
  --text-lt:   #7a6652;

  /* UI */
  --border:    #e0d5c5;
  --radius:    8px;
  --shadow:    0 2px 12px rgba(44,24,16,.08);
  --shadow-lg: 0 8px 32px rgba(44,24,16,.14);
  --green:     #6b8c42;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-lt); }
img { max-width: 100%; display: block; }

/* ── LANG SWITCHER ── */
.lang-switcher { display: flex; align-items: center; gap: .3rem; }
.lang-btn {
  font-size: 1.3rem; line-height: 1; border-radius: 4px;
  padding: .1rem .25rem; opacity: .5; transition: opacity .15s, transform .15s;
  text-decoration: none;
}
.lang-btn:hover { opacity: .9; transform: scale(1.15); }
.lang-btn.active { opacity: 1; outline: 2px solid var(--accent-lt); }

/* ── TOPBAR PUBBLICA ── */
.pub-topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--accent-dk);
  padding: .7rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.pub-brand {
  display: flex; align-items: center; gap: .7rem;
  color: #fff; font-weight: 600; font-size: 1.05rem; text-decoration: none;
}
.pub-brand img { height: 36px; width: 36px; object-fit: contain; border-radius: 50%; }
.pub-brand-ico { font-size: 1.5rem; }

/* ── PAGINA FILIERA PUBBLICA ── */
.filiera-wrap { max-width: 780px; margin: 2rem auto; padding: 0 1rem 4rem; }
.filiera-header {
  background: var(--bg2); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 2rem; margin-bottom: 2rem;
}
.filiera-header-top {
  display: flex; align-items: center; gap: 1.2rem; margin-bottom: 1.2rem;
}
.produttore-logo { width: 80px; height: 80px; object-fit: contain; border-radius: var(--radius); border: 1px solid var(--border); flex-shrink: 0; }
.produttore-logo-ph { width: 80px; height: 80px; background: var(--accent); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: white; font-size: 2rem; flex-shrink: 0; }
.filiera-titolo { font-family: 'Playfair Display', serif; font-size: clamp(1.5rem,4vw,2.1rem); color: var(--accent-dk); line-height: 1.2; }
.filiera-prodotto { font-size: .82rem; color: var(--text-lt); letter-spacing: .08em; text-transform: uppercase; margin-bottom: .3rem; }
.produttore-info { font-size: .88rem; color: var(--text-lt); line-height: 1.7; }
.produttore-info strong { color: var(--text); }
.filiera-meta { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.meta-pill {
  background: var(--bg); border: 1px solid var(--border); border-radius: 20px;
  padding: .25rem .8rem; font-size: .78rem; color: var(--text-lt);
  display: flex; align-items: center; gap: .3rem;
}
.meta-pill a { color: var(--accent); }
.prodotto-foto { display: flex; gap: .8rem; margin-top: 1.2rem; }
.prodotto-foto img { flex: 1; height: 160px; object-fit: cover; border-radius: var(--radius); }

/* ── TIMELINE FASI ── */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: ''; position: absolute; left: .6rem; top: 0; bottom: 0;
  width: 2px; background: linear-gradient(to bottom, var(--accent-lt), var(--accent-dk));
  border-radius: 2px;
}
.fase-card {
  position: relative; background: var(--bg2); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.4rem; margin-bottom: 1.5rem;
}
.fase-card::before {
  content: ''; position: absolute; left: -1.85rem; top: 1.4rem;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent-lt); border: 3px solid var(--bg2);
  box-shadow: 0 0 0 2px var(--accent);
}
.fase-data { font-size: .75rem; color: var(--text-lt); letter-spacing: .08em; text-transform: uppercase; margin-bottom: .4rem; }
.fase-titolo { font-weight: 600; font-size: 1.05rem; color: var(--accent-dk); margin-bottom: .5rem; }
.fase-desc { font-size: .9rem; color: var(--text-lt); line-height: 1.65; margin-bottom: 1rem; }
.fase-foto { display: flex; gap: .6rem; margin-bottom: 1rem; }
.fase-foto img { flex: 1; height: 140px; object-fit: cover; border-radius: 6px; cursor: pointer; transition: transform .2s; }
.fase-foto img:hover { transform: scale(1.02); }
.fase-params { display: flex; flex-wrap: wrap; gap: .5rem; }
.param-chip {
  background: #e8f5e9; border: 1px solid #a5d6a7; border-radius: 20px;
  padding: .2rem .75rem; font-size: .78rem; color: var(--accent-dk);
}

/* ── QR BLOCK ── */
.qr-block { text-align: center; margin: 2rem 0; padding: 1.5rem; background: var(--bg2); border-radius: var(--radius); box-shadow: var(--shadow); }
.qr-block img { width: 160px; height: 160px; margin: 0 auto .6rem; border: 6px solid white; box-shadow: var(--shadow); border-radius: 4px; }
.qr-slug { font-size: .78rem; color: var(--text-lt); letter-spacing: .1em; }

/* ── AUTH ── */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--accent-dk), var(--accent)); }
.auth-box { background: white; border-radius: var(--radius); padding: 2.4rem 2rem; width: 380px; max-width: 95vw; box-shadow: var(--shadow-lg); }
.auth-logo { text-align: center; margin-bottom: 1.4rem; }
.auth-logo img { height: 70px; margin: 0 auto .6rem; }
.auth-logo h1 { font-size: 1.4rem; color: var(--accent-dk); }
.auth-logo p  { font-size: .82rem; color: var(--text-lt); }

/* ── LIGHTBOX ── */
.lb-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 999; align-items: center; justify-content: center; }
.lb-overlay.open { display: flex; }
.lb-overlay img { max-width: 90vw; max-height: 90vh; border-radius: var(--radius); }
.lb-close { position: absolute; top: 1rem; right: 1.5rem; font-size: 2rem; color: white; cursor: pointer; background: none; border: none; line-height: 1; }

/* ── FORM ── */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .78rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em; color: var(--text-lt); margin-bottom: .35rem; }
.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=email],
.form-group input[type=number],
.form-group input[type=date],
.form-group input[type=url],
.form-group select,
.form-group textarea {
  width: 100%; padding: .6rem .85rem;
  border: 1.5px solid var(--border); border-radius: 6px;
  font-family: inherit; font-size: .92rem; color: var(--text);
  background: white; transition: border-color .2s, box-shadow .2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none; border-color: var(--accent-lt);
  box-shadow: 0 0 0 3px rgba(82,183,136,.15);
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }

/* ── BTN ── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem 1.3rem; border-radius: 6px; font-family: inherit; font-size: .88rem; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: all .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.btn-primary   { background: var(--terra);    color: white; }
.btn-primary:hover { background: var(--terra-dk); }
.btn-success   { background: #6b8c42; color: white; }
.btn-danger    { background: #dc3545; color: white; }
.btn-secondary { background: #9e8b7a; color: white; }
.btn-outline   { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: white; }
.btn-sm { padding: .35rem .85rem; font-size: .78rem; }
.btn-xs { padding: .2rem .6rem;  font-size: .72rem; }

/* ── ALERT ── */
.alert { padding: .75rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: .88rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error   { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info    { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ── BADGE ── */
.badge { display: inline-block; padding: .18rem .65rem; border-radius: 20px; font-size: .7rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
.badge-green  { background: #d4edda; color: #155724; border: 1px solid #a3d9b1; }
.badge-yellow { background: #fff3cd; color: #856404; border: 1px solid #ffc107; }
.badge-gray   { background: #e9ecef; color: #495057; border: 1px solid #ced4da; }

/* ── PARAM ROW ── */
.param-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.param-row input { flex: 1; }
.param-row select { width: 120px; }
.param-row .param-unit { width: 80px; }

/* ── FOTO PREVIEW ── */
.foto-preview { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .5rem; }
.foto-prev-item { position: relative; }
.foto-prev-item img { width: 100px; height: 80px; object-fit: cover; border-radius: 6px; border: 2px solid var(--border); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .fase-foto { flex-direction: column; }
  .fase-foto img { height: 200px; }
  .prodotto-foto { flex-direction: column; }
}

/* ── CONTENT LANG SWITCHER (form produttore) ── */
.content-lang-switcher {
  display: flex; align-items: center; gap: .4rem;
  background: #f0f2f5; border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .8rem;
  margin-bottom: 1.2rem;
}
.clang-btn {
  font-size: 1.4rem; line-height: 1;
  background: white; border: 2px solid var(--border);
  border-radius: 6px; padding: .25rem .5rem;
  cursor: pointer; opacity: .55;
  transition: opacity .15s, border-color .15s, transform .1s;
}
.clang-btn:hover { opacity: .85; transform: scale(1.08); }
.clang-btn.active {
  opacity: 1; border-color: var(--accent-lt);
  box-shadow: 0 0 0 3px rgba(82,183,136,.2);
}

/* Fieldset per lingua — nascosto di default, visibile se .lang-active */
.lang-fields { display: none; }
.lang-fields.lang-active { display: block; }

