/* InsuLink — finishing touches sur Tailwind */

:root {
  color-scheme: light;
  --safe-bottom: env(safe-area-inset-bottom);
}

* { -webkit-tap-highlight-color: transparent; }

html, body { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
body { overscroll-behavior-y: none; }

/* Touch targets minimum 44px */
button, a.btn, [role="button"] { min-height: 44px; }
input, select, textarea { font-size: 16px; } /* Pas de zoom iOS */

/* Composants */
.card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 2px 6px rgba(15,23,42,.04);
}
.card-hero {
  background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%);
  color: #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 12px 30px rgba(14,165,233,.25);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 12px;
  font-weight: 600; font-size: 15px;
  transition: all .15s ease;
  border: 1px solid transparent;
}
.btn-primary { background: #0ea5e9; color: #fff; }
.btn-primary:hover { background: #0284c7; }
.btn-primary:active { transform: scale(.98); }
.btn-secondary { background: #fff; color: #0f172a; border-color: #e2e8f0; }
.btn-secondary:hover { background: #f8fafc; }
.btn-ghost { background: transparent; color: #0ea5e9; }
.btn-ghost:hover { background: #e0f2fe; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-lg { padding: 16px 28px; font-size: 17px; border-radius: 14px; min-height: 56px; }
.btn-block { width: 100%; }

.field-label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.field-input,
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], input[type="datetime-local"], select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #fff;
  font-size: 16px;
  color: #0f172a;
  transition: border-color .15s, box-shadow .15s;
}
.field-input:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14,165,233,.18);
}
.field-help { font-size: 12px; color: #64748b; margin-top: 4px; }

.divider { display: flex; align-items: center; gap: 12px; color: #94a3b8; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: #e2e8f0; }

.dose-display {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: -.04em;
  line-height: 1;
}

.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-blue { background: #e0f2fe; color: #0369a1; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-rose { background: #ffe4e6; color: #be123c; }
.badge-emerald { background: #d1fae5; color: #065f46; }

.nutri-a { background: #16a34a; color: #fff; }
.nutri-b { background: #65a30d; color: #fff; }
.nutri-c { background: #ca8a04; color: #fff; }
.nutri-d { background: #ea580c; color: #fff; }
.nutri-e { background: #dc2626; color: #fff; }

/* Skeleton loader */
.skel { background: linear-gradient(90deg,#f1f5f9,#e2e8f0,#f1f5f9); background-size: 200% 100%; animation: skel 1.4s infinite; border-radius: 8px; }
@keyframes skel { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* Toast / Snackbar */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(80px + var(--safe-bottom));
  background: #0f172a; color: #fff; padding: 12px 16px; border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25); z-index: 60;
  font-size: 14px;
}

/* Scan overlay */
.scan-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.92); z-index: 70;
  display: grid; place-items: center;
}
.scan-frame {
  width: min(80vw, 320px); aspect-ratio: 1; border: 3px solid #0ea5e9; border-radius: 20px;
  position: relative; overflow: hidden;
}
.scan-frame::before {
  content: ''; position: absolute; inset: 0; background: linear-gradient(transparent, rgba(14,165,233,.3));
  animation: scanLine 1.6s ease-in-out infinite;
}
@keyframes scanLine {
  0%, 100% { transform: translateY(-100%); }
  50% { transform: translateY(100%); }
}

/* Pull-to-refresh visual */
@media (prefers-reduced-motion: no-preference) {
  .anim-pop { animation: pop .35s ease both; }
}
@keyframes pop { 0% { transform: scale(.96); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Tablet+ */
@media (min-width: 768px) {
  .card { padding: 24px; }
  .card-hero { padding: 32px; }
}

/* Interactions polish */
.btn:active { transform: scale(0.98); }
.card { transition: box-shadow .2s ease, transform .15s ease; }
a.card:active, button.card:active { transform: scale(0.98); }

/* Ripple effect sur boutons */
.btn-primary { position: relative; overflow: hidden; }
.btn-primary::after {
  content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.3);
  border-radius: inherit; opacity: 0; transition: opacity .2s ease;
  pointer-events: none;
}
.btn-primary:active::after { opacity: 1; transition-duration: 0s; }

/* Page transition */
main { animation: pageIn .25s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Scroll smoother */
html { scroll-behavior: smooth; }

/* Inputs : feedback tactile */
input:active, select:active, textarea:active { transform: scale(0.998); }

/* Focus visible accessible */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

/* Spinner subtle */
.spinner {
  width: 1em; height: 1em; border: 2px solid currentColor; border-bottom-color: transparent;
  border-radius: 50%; display: inline-block; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Pull-to-refresh look */
.shimmer { background: linear-gradient(90deg, transparent, rgba(14,165,233,.15), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
