:root {
  --primary: #d6180b;
  --primary-dark: #a41208;
  --bg: #f5f5f5;
  --text: #222;
  --muted: #777;
  --card-bg: #ffffff;
  --radius-lg: 18px;
  --shadow-soft: 0 10px 25px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  justify-content: center;
}

.app {
  width: 100%;
  max-width: 480px;
  min-height: 100vh;
  padding: 16px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 4px;
}

header .title {
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

header .subtitle {
  font-size: 0.75rem;
  color: var(--muted);
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 14px 14px 16px;
  box-shadow: var(--shadow-soft);
}

/* --------- Carte recherche --------- */

.search-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.field-row input[type='text'] {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.95rem;
  outline: none;
  background: #fafafa;
}

.field-row input[type='text']:focus {
  border-color: var(--primary);
  background: #fff;
}

.mic-btn {
  border: none;
  border-radius: 999px;
  width: 95px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  font-size: 2rem;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(214, 24, 11, 0.4);
}

.mic-btn:active {
  transform: scale(0.96);
  background: var(--primary-dark);
}

.mic-btn.disabled {
  background: #ccc;
  box-shadow: none;
}

.helper-text {
  font-size: 0.75rem;
  color: var(--muted);
}

.helper-text strong {
  color: var(--primary-dark);
  font-weight: 600;
}

.status {
  font-size: 0.8rem;
  color: var(--muted);
}

.status.listening {
  color: var(--primary);
  font-weight: 500;
}

/* --------- Carte résultat --------- */

.result-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
  gap: 14px;
  padding-left: 0;
  padding-right: 0;
}

.result-empty {
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* conteneur du résultat (caché au début) */
#resultContent {
  display: none;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

/* ligne avec gros code + noms */
.result-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.code-large {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--primary-dark);
  letter-spacing: 0.1em;
}

.names-block {
  display: flex;
  flex-direction: column;
}

.country-fr {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.country-en {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

/* barcode bien visible et centré */
#barcode-container {
  align-self: center;
  background: #fff;
  padding: 6px 10px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
  width: 100%;
  max-width: 100%;
  display: flex;
  justify-content: center;
}

#barcode {
  width: 100%;
  height: 300px;
}

.small-note {
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 380px) {
  .code-large {
    font-size: 2.2rem;
  }
  .country-fr {
    font-size: 1.2rem;
  }
  #barcode {
    height: 100px;
  }
}

/* ---- LOGO HEADER ---- */

.logo-img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

/* bouton info en bas à droite (discret) */
.info-button {
  position: fixed;
  right: 12px;
  bottom: 12px;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.08);
  color: #555;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: 0.2s ease;
  z-index: 900;
  opacity: 0.55;
}

.info-button:hover {
  opacity: 0.9;
  background: rgba(0, 0, 0, 0.12);
}

/* modal */
.info-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.info-modal.show {
  display: flex;
}

.info-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.info-modal-content {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 16px 18px 14px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  z-index: 1001;
  font-size: 0.85rem;
}

.info-modal-content h2 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 1.05rem;
}

#statsContent {
  max-height: 260px;
  overflow-y: auto;
  margin: 8px 0 12px;
}

.info-modal-content button {
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  background: #d6180b;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-block;
}
