/* JO Safety Skiltsøgning — brandfarver: JO Rød #AF272E, JO Mørkegrå #333F48 */
:root {
  --jo-red: #AF272E;
  --jo-dark: #333F48;
  --jo-dark-10: #EBEDEE;
  --jo-dark-20: #D6DADC;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Roboto", Arial, sans-serif;
  color: var(--jo-dark);
  background: #fff;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--jo-dark-20);
}
.logo { height: 34px; display: block; }

.main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

h1 {
  font-family: "Roboto Condensed", "Roboto", Arial, sans-serif;
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.15;
  margin: 8px 0 4px;
}
h1 em { color: var(--jo-red); font-style: normal; }

.lead { font-size: 1.05rem; line-height: 1.5; margin: 0 0 28px; }

.capture-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 18px 24px;
  background: var(--jo-red);
  color: #fff;
  font-family: "Roboto", Arial, sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.capture-btn:active { background: #8e1f25; }

.link-btn {
  display: block;
  margin: 18px auto 0;
  background: none;
  border: none;
  color: var(--jo-dark);
  font-family: inherit;
  font-size: 0.95rem;
  text-decoration: underline;
  cursor: pointer;
}

.privacy {
  margin-top: 32px;
  font-size: 0.82rem;
  color: #6b757d;
  text-align: center;
}

/* Loading */
.loading { text-align: center; padding-top: 12px; }
.preview {
  max-width: 70%;
  max-height: 40vh;
  border-radius: 8px;
  border: 1px solid var(--jo-dark-20);
}
.spinner {
  width: 40px;
  height: 40px;
  margin: 28px auto 12px;
  border: 4px solid var(--jo-dark-10);
  border-top-color: var(--jo-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Resultater */
.results-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}
.query-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--jo-dark-20);
}
.results-head h2 {
  font-family: "Roboto Condensed", "Roboto", Arial, sans-serif;
  font-size: 1.4rem;
  margin: 0 0 2px;
}
.results-head .link-btn { margin: 0; text-align: left; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
/* Desktop: samme kortstørrelse og luft som josafety.dk's søgeside */
@media (min-width: 700px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
    gap: 16px;
  }
  .card img { padding: 24px; }
  .card-body { padding: 0 14px 16px; }
}

/* Resultatkort — matcher produktkortene på josafety.dk */
.card {
  display: flex;
  flex-direction: column;
  border: 1px solid #E2E2E2;
  border-radius: 0;
  text-decoration: none;
  color: var(--jo-dark);
  background: #fff;
  text-align: center;
}
.card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  padding: 14px;
  background: #fff;
}
.card-body {
  padding: 0 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.sku {
  font-size: 11px;
  color: #565656;
  margin-bottom: 2px;
}
.card-body h3 {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0 0 8px;
}
.price {
  font-size: 16px;
  font-weight: 700;
  color: var(--jo-dark);
  margin: 0 0 10px;
}
.cta {
  margin-top: auto;
  display: block;
  background: #00955C;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  border-radius: 3px;
  padding: 9px 6px;
}

.no-match-hint {
  margin-top: 24px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #55606a;
}
.no-match-hint a { color: var(--jo-red); }

/* Fejl */
.error { text-align: center; padding-top: 32px; }
.error p { margin-bottom: 24px; }

.footer {
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--jo-dark-20);
  font-size: 0.82rem;
  color: #6b757d;
  text-align: center;
}
.footer a { color: inherit; }
.footer p { margin: 0; }

/* Embed-tilstand (iframe på josafety.dk): siden udenom leverer logo og intro,
   og iframen følger indholdets højde — så appen hverken brander eller scroller selv */
.embedded body { min-height: 0; }
.embedded .header,
.embedded .footer,
.embedded #intro h1,
.embedded #intro .lead { display: none; }
.embedded .main { padding-top: 8px; padding-bottom: 16px; max-width: none; }
/* Resultaterne må fylde sidens fulde bredde; kamera-/fejlsektioner holdes læsbare */
.embedded #intro,
.embedded #loading,
.embedded #error { max-width: 640px; margin: 0 auto; }
