/* Businesspoint Track & Trace - layout & componenten. Kleuren komen uit brand.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--bp-font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--bp-text);
  background: var(--bp-bg);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
a { color: var(--bp-primary); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--bp-text-muted); }
.small { font-size: .8125rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--bp-surface); padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--bp-primary-line); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header { background: var(--bp-surface); box-shadow: 0 2px 8px rgba(0, 0, 0, .06); position: relative; z-index: 2; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand img { height: 32px; width: auto; }
.btn--back { padding: 8px 16px; font-size: .875rem; }

/* ---------- Pagina ---------- */
.page { padding-top: 16px; padding-bottom: 48px; }
.breadcrumb { display: flex; gap: 8px; font-size: .6875rem; text-transform: uppercase; letter-spacing: .02em; color: var(--bp-text-muted); }
.breadcrumb a { color: var(--bp-text); text-decoration: none; }
.breadcrumb a:hover { color: var(--bp-primary); text-decoration: underline; }

.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 44px; margin-top: 28px; align-items: start; }
.page-title { color: var(--bp-primary); font-size: 1.75rem; font-weight: 700; }
.page-lead { margin-top: 6px; color: var(--bp-text-muted); }

/* ---------- Zijbalk (zoals "Alle producten") ---------- */
.sidebar__head { background: var(--bp-primary); color: var(--bp-on-primary); font-weight: 700; font-size: 1rem; padding: 10px 14px; border-radius: var(--bp-radius-sm); }
.sidebar__links { display: grid; gap: 8px; margin-top: 12px; }
.sidebar__title { margin-top: 24px; color: var(--bp-primary); font-weight: 700; font-size: 1rem; }
.faq { margin-top: 8px; border-top: 1px solid var(--bp-border); }
.faq details { border-bottom: 1px solid var(--bp-border); }
.faq summary { cursor: pointer; list-style: none; padding: 10px 22px 10px 0; font-size: .8125rem; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 2px; top: 8px; color: var(--bp-primary); font-weight: 700; font-size: 1rem; }
.faq details[open] summary::after { content: "–"; }
.faq summary:hover { color: var(--bp-primary); }
.faq details p { padding: 0 0 12px; font-size: .8125rem; color: var(--bp-text-muted); }

/* ---------- Knoppen ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--bp-radius-sm);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
  padding: 8px 14px; transition: background-color .15s, border-color .15s, color .15s;
}
.btn--lg { padding: 0 22px; min-height: 48px; font-size: 1rem; }
.btn--sm { padding: 5px 10px; font-size: .8125rem; }
.btn--block { width: 100%; }
.btn--primary { background: var(--bp-primary); color: var(--bp-on-primary); }
.btn--primary:hover { background: var(--bp-primary-hover); }
.btn--primary:disabled { opacity: .7; cursor: progress; }
.btn--outline { background: var(--bp-surface); border-color: var(--bp-primary); color: var(--bp-primary); font-size: .8125rem; }
.btn--outline:hover { background: var(--bp-primary-soft); }
.btn--ghost { background: transparent; border-color: var(--bp-border); color: var(--bp-primary); }
.btn--ghost:hover { border-color: var(--bp-primary); background: var(--bp-primary-soft); }
.icon-btn { display: inline-flex; padding: 6px; border: 0; border-radius: var(--bp-radius-sm); background: transparent; color: var(--bp-text-muted); cursor: pointer; }
.icon-btn:hover { background: var(--bp-primary-soft); color: var(--bp-primary); }

/* ---------- Zoekformulier ---------- */
.card {
  background: var(--bp-surface); border: 1px solid var(--bp-border);
  border-radius: var(--bp-radius); box-shadow: var(--bp-shadow); padding: 22px;
}
.card__title { font-size: .8125rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bp-primary); font-weight: 600; margin-bottom: 18px; }

.search { margin-top: 20px; background: var(--bp-subtle); box-shadow: none; }
.search__row { display: grid; grid-template-columns: 1fr 170px auto; gap: 12px; align-items: end; }
.search__hint { margin-top: 10px; font-size: .8125rem; color: var(--bp-text-muted); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field__label { font-size: .8125rem; font-weight: 700; }
.field__optional { font-weight: 400; color: var(--bp-text-muted); }
.field__input {
  width: 100%; font: inherit; color: var(--bp-text);
  border: 1px solid var(--bp-border-strong); border-radius: var(--bp-radius-sm); background: #fff;
  padding: 0 14px; transition: border-color .15s, box-shadow .15s;
}
.field__input--lg { min-height: 48px; font-size: 1.0625rem; letter-spacing: .02em; }
#code { text-transform: uppercase; font-weight: 600; }
#code::placeholder, #postcode::placeholder { text-transform: none; font-weight: 400; letter-spacing: 0; }
.field__input:focus { outline: none; border-color: var(--bp-primary); box-shadow: 0 0 0 3px var(--bp-primary-soft); }
.field__input[aria-invalid="true"] { border-color: var(--bp-danger); }

/* ---------- Resultaten ---------- */
.results { margin-top: 20px; }
.results:empty { display: none; }

.dashboard { display: grid; gap: 16px; animation: fade-in .25s ease-out; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.status-card { border-top: 4px solid var(--bp-primary); }
.status-card__top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: flex-start; }
.status-card__number { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.status-card__number strong { font-size: 1.0625rem; letter-spacing: .04em; word-break: break-all; color: var(--bp-text-strong); }
.status-card__refresh { display: flex; align-items: center; gap: 10px; }
.status-card__status { margin-top: 18px; }
.status-card__title { font-size: clamp(1.375rem, 2.6vw, 1.75rem); margin-top: 10px; color: var(--bp-primary); }
.status-card__desc { margin-top: 4px; color: var(--bp-text-muted); }

.badge { display: inline-block; font-size: .6875rem; font-weight: 700; padding: 3px 9px; border-radius: var(--bp-radius-sm); letter-spacing: .04em; }
.badge--carrier { background: #ffcc00; color: #d40511; } /* DHL-herkenning */
.badge--carrier[data-carrier="demo"] { background: var(--bp-primary-soft); color: var(--bp-primary); }

.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 4px 10px; border-radius: var(--bp-radius-pill); background: var(--bp-info-soft); color: var(--bp-info); }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-pill[data-status="delivered"] { background: var(--bp-success-soft); color: var(--bp-success); }
.status-pill[data-status="exception"] { background: var(--bp-danger-soft); color: var(--bp-danger); }
.status-pill[data-status="out_for_delivery"] { background: var(--bp-warning-soft); color: var(--bp-warning); }
.status-pill[data-status="in_transit"]::before, .status-pill[data-status="out_for_delivery"]::before { animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.stale-warning { margin-top: 16px; padding: 10px 14px; border-radius: var(--bp-radius-sm); background: var(--bp-warning-soft); color: var(--bp-warning); font-size: .875rem; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; box-shadow: none; }
.kpi__label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bp-primary); }
.kpi__value { font-size: 1.125rem; color: var(--bp-text-strong); }
.kpi__sub { font-size: .8125rem; color: var(--bp-text-muted); }

/* ---------- Voortgang (6 mijlpalen) ---------- */
.progress { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); }
.progress__step { position: relative; text-align: center; padding: 0 4px; }
.progress__step::before {
  content: ""; position: absolute; top: 17px; left: -50%; width: 100%; height: 3px;
  background: var(--bp-border); z-index: 0;
}
.progress__step:first-child::before { display: none; }
.progress__step.is-done::before { background: var(--bp-primary); }
.progress__dot {
  position: relative; z-index: 1; margin: 0 auto; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--bp-surface); border: 2px solid var(--bp-border); color: var(--bp-text-muted); font-size: .8125rem; font-weight: 700;
}
.progress__step.is-done .progress__dot { background: var(--bp-primary); border-color: var(--bp-primary); color: var(--bp-on-primary); }
.progress__step.is-current .progress__dot { box-shadow: 0 0 0 6px var(--bp-primary-soft); }
.progress__step.is-current.is-final .progress__dot { background: var(--bp-success); border-color: var(--bp-success); box-shadow: 0 0 0 6px var(--bp-success-soft); }
.progress__step.is-current.is-exception .progress__dot { background: var(--bp-danger); border-color: var(--bp-danger); box-shadow: 0 0 0 6px var(--bp-danger-soft); }
.progress__label { display: block; margin-top: 10px; font-size: .8125rem; font-weight: 700; color: var(--bp-text-strong); }
.progress__step:not(.is-done) .progress__label { color: var(--bp-text-muted); font-weight: 400; }
.progress__time { display: block; font-size: .75rem; color: var(--bp-text-muted); }

/* ---------- Tijdlijn (alle events) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__day { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--bp-primary); margin: 18px 0 8px; }
.timeline__day:first-child { margin-top: 0; }
.timeline__item { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 0 0 16px 0; }
.timeline__item::before { content: ""; position: absolute; left: 73px; top: 14px; bottom: -4px; width: 2px; background: var(--bp-border); }
.timeline__item:last-child::before, .timeline__item.is-last-of-day::before { bottom: 8px; }
.timeline__time { font-size: .875rem; color: var(--bp-text-muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.timeline__body { position: relative; padding-left: 22px; }
.timeline__body::before {
  content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bp-surface); border: 2px solid var(--bp-primary-line);
}
.timeline__item.is-latest .timeline__body::before { background: var(--bp-primary); border-color: var(--bp-primary); }
.timeline__item[data-status="delivered"] .timeline__body::before { background: var(--bp-success); border-color: var(--bp-success); }
.timeline__item[data-status="exception"] .timeline__body::before { background: var(--bp-danger); border-color: var(--bp-danger); }
.timeline__desc { font-weight: 700; color: var(--bp-text-strong); }
.timeline__item:not(.is-latest) .timeline__desc { font-weight: 400; color: var(--bp-text); }
.timeline__loc { font-size: .8125rem; color: var(--bp-text-muted); }

/* ---------- Foutmeldingen ---------- */
.notice { display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start; animation: fade-in .2s ease-out; }
.notice__icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--bp-warning-soft); color: var(--bp-warning); font-size: 1.375rem; font-weight: 700; }
.notice__icon::before { content: "!"; }
.notice[data-kind="info"] .notice__icon { background: var(--bp-primary-soft); color: var(--bp-primary); }
.notice[data-kind="info"] .notice__icon::before { content: "?"; }
.notice[data-kind="error"] .notice__icon { background: var(--bp-danger-soft); color: var(--bp-danger); }
.notice__title { font-size: 1.125rem; color: var(--bp-primary); }
.notice__text { margin-top: 6px; color: var(--bp-text-muted); }
.notice__actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.notice__actions:empty { display: none; }

/* ---------- Laden ---------- */
.skeleton__line, .skeleton__grid > div {
  height: 14px; border-radius: 4px; margin-top: 12px;
  background: linear-gradient(90deg, #f1f1f3 25%, #e6e6ea 50%, #f1f1f3 75%); background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
.skeleton__line:first-child { margin-top: 0; }
.skeleton__line--lg { height: 26px; width: 45%; }
.skeleton__line:nth-child(2) { width: 70%; }
.skeleton__line--bar { height: 36px; width: 100%; margin-top: 24px; }
.skeleton__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 12px; }
.skeleton__grid > div { height: 56px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--bp-text); color: #fff; padding: 10px 16px; border-radius: var(--bp-radius-sm); font-size: .875rem;
  box-shadow: var(--bp-shadow); z-index: 20;
}

/* ---------- Footer ---------- */
.site-footer { padding: 22px 0; border-top: 1px solid var(--bp-border); background: var(--bp-subtle); font-size: .8125rem; color: var(--bp-text-muted); }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

/* ---------- Embed (iframe): alleen zoeken + resultaat ---------- */
.is-embed [data-hide-in-embed] { display: none; }
.is-embed .layout { grid-template-columns: 1fr; margin-top: 0; }
.is-embed .page { padding-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; gap: 28px; }
  .sidebar { order: 2; }          /* hulp onder het resultaat */
  .sidebar__links { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .search__row { grid-template-columns: 1fr 1fr; }
  .field--code { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .brand img { height: 26px; }
  .btn--back span { display: none; }   /* alleen pijl + tooltip op kleine schermen */
  .btn--back::after { content: "Webshop"; }
  .page-title { font-size: 1.5rem; }
  .search { padding: 16px; }
  .search__row { grid-template-columns: 1fr; }
  .search__submit { width: 100%; }
  .card { padding: 16px; }
  .kpis { gap: 10px; }
  .kpi { padding: 12px; }
  .kpi__value { font-size: 1rem; }

  /* Mijlpalen verticaal op mobiel */
  .progress { grid-template-columns: 1fr; }
  .progress__step { display: grid; grid-template-columns: 36px 1fr; column-gap: 14px; text-align: left; padding: 0 0 16px; align-items: center; }
  .progress__step::before { top: -50%; left: 16px; width: 3px; height: 100%; }
  .progress__dot { margin: 0; grid-row: span 2; }
  .progress__label { margin-top: 0; }
  .skeleton__grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
