@import url("tokens.css");

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

/* ---------- Layout ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--container-padding);
  padding-top: calc(var(--space-2) + var(--safe-top));
  background: var(--color-background);
  transition: box-shadow 0.2s ease;
}

.app-header--elevated {
  box-shadow: 0 4px 16px rgba(122, 16, 48, 0.06);
}

.app-header__identity {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.app-header__avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 2px solid var(--color-primary-fixed);
}

.app-header__eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-variant);
  margin: 0 0 2px;
}

.app-header__title {
  font-size: 20px;
  color: var(--color-primary);
  line-height: 1.2;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-variant);
  transition: background-color 0.2s ease;
}

.icon-button:hover {
  background: var(--color-surface-variant);
}

.icon-button:active {
  transform: scale(0.94);
}

main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-3) var(--container-padding) calc(96px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--color-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: 0 -4px 20px rgba(122, 16, 48, 0.08);
  padding: var(--space-1) var(--space-1) calc(var(--space-1) + var(--safe-bottom));
}

.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  border-radius: var(--radius-sm);
  color: var(--color-text-variant);
  transition: transform 0.15s ease, color 0.15s ease;
}

.bottom-nav__item svg {
  width: 24px;
  height: 24px;
}

.bottom-nav__item span {
  font-size: 10px;
  font-weight: 600;
}

.bottom-nav__item:active {
  transform: scale(0.92);
}

.bottom-nav__item.is-active {
  color: var(--color-primary);
}

.bottom-nav__scan {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-top: -28px;
}

.bottom-nav__scan-button {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  border: 4px solid var(--color-background);
}

.bottom-nav__scan-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-primary);
}

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-4);
}

.card-hover {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.card-hover:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.section-title {
  font-size: 20px;
  color: var(--color-primary);
}

.section-subtitle {
  color: var(--color-text-variant);
  font-size: 14px;
  margin-top: 2px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-full);
  padding: 14px 28px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: none;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 6px 20px rgba(122, 16, 48, 0.25);
}

.btn-primary:hover {
  opacity: 0.92;
}

.btn-secondary {
  background: transparent;
  color: var(--color-secondary);
  border: 1.5px solid var(--color-secondary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-secondary);
  padding: 14px 12px;
}

.btn-block {
  width: 100%;
}

/* ---------- Progress ---------- */
.progress-track {
  width: 100%;
  height: 8px;
  background: var(--color-surface-variant);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-track--thin {
  height: 6px;
}

.progress-track__fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.6s ease;
}

.progress-track__fill--secondary {
  background: var(--color-secondary);
}

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: var(--color-secondary-fixed);
  color: var(--color-secondary);
}

.chip--primary {
  background: var(--color-primary-fixed);
  color: var(--color-primary);
}

/* ---------- Utility ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.text-center {
  text-align: center;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
}

@media (min-width: 560px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---------- Historique (liste réutilisée sur plusieurs écrans) ---------- */
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.history-list__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--color-border);
}

.history-list__item:first-child {
  border-top: none;
}

.history-list__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--color-primary-fixed);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-list__body {
  flex: 1;
  min-width: 0;
}

.history-list__title {
  font-weight: 600;
  font-size: 14px;
}

.history-list__meta {
  font-size: 12px;
  color: var(--color-text-variant);
}

.history-list__points {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 14px;
  white-space: nowrap;
}

/* Motif décoratif "goutte" en filigrane, jamais littéral/médical */
.drop-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.06;
  pointer-events: none;
}
