/* trace.css — F.A.S. public lot-trace page */
:root {
  --ink: #14241a; --green: #1f3624; --green-2: #2c4a33;
  --gold: #c9a227; --gold-light: #e8c96a; --gold-deep: #9a7a1a;
  --cream: #f6f1e7; --cream-2: #efe7d6; --white: #fdfcf9;
  --ok: #2e7d43; --bad: #b03a3a;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-sans); background: var(--cream); color: var(--ink); line-height: 1.6; -webkit-font-smoothing: antialiased; }
html[lang="ar"] body { font-family: 'Amiri', var(--font-sans); }
h1, h2 { font-family: var(--font-serif); color: var(--green); }
html[lang="ar"] h1, html[lang="ar"] h2 { font-family: 'Amiri', var(--font-serif); }
img { max-width: 100%; }
a { color: var(--gold-deep); }

.tr-header {
  background: var(--green); padding: .9rem clamp(1rem, 4vw, 2.5rem);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.tr-header img { height: 40px; width: auto; filter: brightness(0) invert(1) sepia(.15); display: block; }
.tr-langs { display: flex; gap: .4rem; }
.tr-langs button {
  background: rgba(255,255,255,.1); color: var(--cream); border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px; padding: .35rem .8rem; cursor: pointer; font-weight: 600; font-size: .82rem;
}
.tr-langs button.active { background: var(--gold); border-color: var(--gold); color: #241d05; }

.tr-main { max-width: 880px; margin: 0 auto; padding: clamp(1.6rem, 5vw, 3.5rem) clamp(1rem, 4vw, 2rem) 4rem; }

.tr-loading { text-align: center; padding: 5rem 0; }
.tr-spinner {
  width: 46px; height: 46px; margin: 0 auto 1.2rem; border-radius: 50%;
  border: 3px solid rgba(201,162,39,.25); border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.tr-search, .tr-notfound { text-align: center; padding: 4rem 0; }
.tr-search h1, .tr-notfound h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin-bottom: .6rem; }
.tr-search p, .tr-notfound p { max-width: 520px; margin: 0 auto 1.6rem; opacity: .8; }
.tr-nf-icon { font-size: 2.6rem; display: block; margin-bottom: .6rem; color: var(--bad); }
.tr-search form, .tr-notfound form { display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.tr-search input, .tr-notfound input {
  font-family: ui-monospace, monospace; font-size: 1rem; letter-spacing: .05em;
  padding: .8rem 1.2rem; border: 1.5px solid rgba(20,36,26,.25); border-radius: 999px;
  min-width: min(320px, 80vw); outline: none; text-transform: uppercase;
}
.tr-search input:focus, .tr-notfound input:focus { border-color: var(--gold); }
.tr-search button, .tr-notfound button, #printBtn {
  background: linear-gradient(120deg, var(--gold-light), var(--gold)); border: none; cursor: pointer;
  padding: .8rem 1.8rem; border-radius: 999px; font-weight: 700; font-size: .95rem; color: #241d05;
}

.tr-kicker { letter-spacing: .25em; text-transform: uppercase; font-size: .72rem; font-weight: 600; color: var(--gold-deep); }
.tr-lotid { font-family: ui-monospace, monospace; font-size: clamp(1.5rem, 5vw, 2.4rem); letter-spacing: .04em; margin: .3rem 0 1rem; }

.tr-banner {
  border-radius: 14px; padding: .95rem 1.3rem; font-weight: 600; margin-bottom: 1.6rem;
  display: flex; align-items: center; gap: .7rem;
}
.tr-banner.ok { background: rgba(46,125,67,.12); border: 1.5px solid var(--ok); color: var(--ok); }
.tr-banner.bad { background: rgba(176,58,58,.1); border: 1.5px solid var(--bad); color: var(--bad); }

.tr-selfverify {
  display: grid; grid-template-columns: 1fr auto; gap: .5rem 1.6rem; align-items: center;
  background: linear-gradient(120deg, rgba(201,162,39,.1), rgba(201,162,39,.04));
  border: 1.5px dashed var(--gold); border-radius: 16px;
  padding: 1.2rem 1.5rem; margin-bottom: 1.8rem;
}
.tr-sv-text h2 { font-size: 1.15rem; margin-bottom: .25rem; }
.tr-sv-text p { font-size: .85rem; opacity: .78; }
#svBtn {
  background: var(--green); color: var(--cream); border: none; cursor: pointer;
  padding: .85rem 1.6rem; border-radius: 999px; font-weight: 700; font-size: .92rem;
  transition: transform .3s, box-shadow .3s; white-space: nowrap;
}
#svBtn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(31,54,36,.35); }
#svBtn:disabled { opacity: .6; cursor: wait; }
.tr-sv-result { grid-column: 1 / -1; font-weight: 600; font-size: .92rem; min-height: 1.3em; }
.tr-sv-result.ok { color: var(--ok); }
.tr-sv-result.bad { color: var(--bad); }
.sv-badge {
  font-size: .68rem; font-weight: 700; color: var(--ok);
  border: 1px solid var(--ok); border-radius: 999px; padding: .15rem .6rem;
  animation: svPop .35s ease;
}
.sv-badge.bad { color: var(--bad); border-color: var(--bad); }
@keyframes svPop { from { transform: scale(.6); opacity: 0; } }
@media (max-width: 640px) { .tr-selfverify { grid-template-columns: 1fr; } }

.tr-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.4rem; margin-bottom: 2.4rem; }
.tr-card { background: var(--white); border-radius: 18px; padding: 1.6rem; box-shadow: 0 10px 34px rgba(20,36,26,.1); }
.tr-product h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.tr-facts div { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed rgba(20,36,26,.15); }
.tr-facts div:last-child { border-bottom: none; }
.tr-facts dt { opacity: .6; font-size: .88rem; }
.tr-facts dd { font-weight: 600; text-align: end; }
.tr-qr { text-align: center; }
.tr-qr h2 { font-size: 1.1rem; margin-bottom: .8rem; }
.tr-qr img { border: 1px solid rgba(20,36,26,.15); border-radius: 12px; background: #fff; padding: 6px; }
.tr-qr p { font-size: .8rem; opacity: .7; margin: .8rem 0 1rem; }
.tr-coa { display: inline-block; margin-top: .9rem; font-size: .85rem; font-weight: 600; color: var(--gold-deep); }
.tr-coa[hidden] { display: none; }

.tr-timeline-wrap h2 { font-size: 1.4rem; margin-bottom: 1.4rem; }
.tr-timeline { list-style: none; position: relative; padding-inline-start: 2rem; }
.tr-timeline::before {
  content: ''; position: absolute; inset-block: 8px; inset-inline-start: 9px;
  width: 2px; background: linear-gradient(var(--gold), var(--green-2));
}
.tr-event { position: relative; margin-bottom: 1.3rem; background: var(--white); border-radius: 16px; padding: 1.2rem 1.4rem; box-shadow: 0 8px 26px rgba(20,36,26,.08); }
.tr-event::before {
  content: ''; position: absolute; inset-inline-start: -2rem; top: 1.45rem;
  width: 12px; height: 12px; border-radius: 50%; background: var(--gold);
  border: 3px solid var(--cream); margin-inline-start: 3px;
}
.tr-ev-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.tr-ev-head h3 { font-family: var(--font-serif); color: var(--green); font-size: 1.1rem; }
.tr-ev-head time { font-size: .82rem; opacity: .65; }
.tr-data { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .4rem 1.4rem; margin-top: .7rem; }
.tr-data div { font-size: .88rem; display: flex; justify-content: space-between; gap: .6rem; border-bottom: 1px dotted rgba(20,36,26,.12); padding: .25rem 0; }
.tr-data dt { opacity: .6; }
.tr-data dd { font-weight: 600; text-align: end; }
.tr-hash {
  margin-top: .8rem; font-family: ui-monospace, monospace; font-size: .68rem;
  color: var(--gold-deep); word-break: break-all; cursor: copy;
}
.tr-hash span { opacity: .55; }

.tr-footer { text-align: center; padding: 2rem 1rem; font-size: .82rem; opacity: .75; }

@media (max-width: 720px) {
  .tr-grid { grid-template-columns: 1fr; }
}

@media print {
  .tr-header, .tr-langs, .tr-footer, #printBtn, .tr-timeline-wrap { display: none !important; }
  body { background: #fff; }
  .tr-card { box-shadow: none; border: 1px solid #ccc; }
}
