/* ─── Lecrat Light — Style ─── */
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:        #1a3a6e;
  --navy-mid:    #2451a3;
  --blue:        #2563eb;
  --blue-hover:  #1d4ed8;
  --blue-pale:   #eff6ff;
  --blue-border: #bfdbfe;
  --amber:       #f59e0b;
  --text:        #0f172a;
  --text-mid:    #475569;
  --text-light:  #94a3b8;
  --bg:          #ffffff;
  --bg-body:     #f1f5f9;
  --bg-alt:      #f8fafc;
  --border:      #e2e8f0;
  --shadow-xs:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm:   0 4px 8px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-md:   0 10px 20px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
  --radius:      8px;
  --radius-lg:   12px;
  --transition:  0.15s ease;
}

html { font-size: 16px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg-body);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--blue-hover); text-decoration: underline; }

.container { max-width: 940px; margin: 0 auto; padding: 0 1.5rem; }

/* ─── Offline badge ─── */
.offline-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 600;
  color: #4ade80;
  letter-spacing: 0.05em;
  margin-right: 0.5rem;
}

/* ─── Header ─── */
.site-header {
  background: var(--navy);
  padding: 0.85rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 4px 16px rgba(0,0,0,.2);
}

.header-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }

.site-title { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.site-title a { color: #fff; }
.site-title a:hover { text-decoration: none; opacity: .9; }
.site-title .light { font-weight: 400; color: var(--amber); }

.site-subtitle { font-size: 0.72rem; color: rgba(255,255,255,.4); margin-top: .1rem; }
.site-subtitle a { color: rgba(255,255,255,.6); text-decoration: underline; text-decoration-color: rgba(255,255,255,.2); }
.site-subtitle a:hover { color: #fff; }

.save-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid rgba(255,255,255,.15); border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.5);
  cursor: pointer; flex-shrink: 0;
  transition: all var(--transition);
}
.save-btn:hover { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.3); }

/* ─── Hero ─── */
.hero {
  background: var(--bg);
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-title {
  font-size: 1.45rem; font-weight: 700;
  color: var(--text); letter-spacing: -0.02em;
  margin-bottom: .25rem;
}

.hero-subtitle { font-size: .875rem; color: var(--text-light); margin-bottom: 1.5rem; }

.search-wrapper { position: relative; max-width: 580px; margin: 0 auto; }

.search-icon {
  position: absolute; left: 1rem; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--text-light);
  pointer-events: none; transition: color var(--transition);
}
.search-wrapper:focus-within .search-icon { color: var(--blue); }

#search-input {
  width: 100%;
  padding: .875rem 1rem .875rem 2.75rem;
  font-size: .95rem;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  outline: none;
  background: var(--bg);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--transition), box-shadow var(--transition);
}
#search-input::placeholder { color: var(--text-light); }
#search-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1), var(--shadow-xs);
}

/* ─── Résultats de recherche ─── */
#search-results { max-width: 580px; margin: .75rem auto 0; text-align: left; }

#search-results .result-item {
  display: flex; flex-wrap: wrap; align-items: center;
  padding: .7rem 1rem; margin-bottom: .3rem;
  border-radius: var(--radius);
  background: var(--bg); border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  gap: .4rem; transition: all var(--transition);
}
#search-results .result-item:hover {
  border-color: var(--blue); box-shadow: var(--shadow-md);
  text-decoration: none; transform: translateY(-1px);
}
#search-results .result-name { font-weight: 600; color: var(--text); font-size: .9rem; }
#search-results .result-noms-com { display: block; width: 100%; font-size: .72rem; color: var(--text-light); margin-top: .1rem; }
#search-results .no-results { padding: 1.5rem 1rem; color: var(--text-light); font-style: italic; text-align: center; }

/* ─── Browse / Collapse ─── */
.browse-toggle { text-align: center; padding: 1rem 0 .5rem; }

.browse-btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem 1rem;
  border: 1px solid var(--border); border-radius: 50px;
  background: var(--bg); color: var(--text-mid);
  font-size: .8rem; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.browse-btn:hover { border-color: var(--blue); color: var(--blue); }

.collapse-btn {
  display: block; margin: 0 auto 1.5rem;
  padding: .35rem 1.2rem;
  border: 1px solid var(--border); border-radius: 50px;
  background: var(--bg); color: var(--text-light);
  font-size: .75rem; font-family: inherit;
  cursor: pointer; transition: all var(--transition);
}
.collapse-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ─── Grille médicaments ─── */
.med-list { padding-bottom: 3rem; }

.med-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .35rem;
}

.med-grid li a {
  display: flex; flex-direction: column;
  padding: .6rem .9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: .875rem; font-weight: 500; color: var(--text);
  transition: all var(--transition);
}
.med-grid li a:hover {
  border-color: var(--blue-border); box-shadow: var(--shadow-sm);
  text-decoration: none; color: var(--blue);
}

.med-grid .noms-com {
  font-size: .7rem; color: var(--text-light);
  margin-top: .15rem; line-height: 1.3; font-weight: 400;
}

/* ─── Fiche individuelle ─── */
.fiche { padding-bottom: 2rem; }

.breadcrumb {
  padding: 1rem 0; font-size: .75rem; color: var(--text-light);
  display: flex; align-items: center; flex-wrap: wrap; gap: .3rem;
}
.breadcrumb a { color: var(--blue); font-weight: 500; }

.fiche article {
  background: var(--bg); border-radius: var(--radius-lg);
  padding: 2rem; border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.fiche-title {
  font-size: 1.55rem; font-weight: 700;
  color: var(--text); letter-spacing: -0.025em;
  line-height: 1.25; margin-bottom: .5rem;
}

.noms-commerciaux {
  font-size: .82rem; color: var(--text-mid);
  background: var(--bg-alt); padding: .5rem .85rem;
  border-radius: var(--radius); margin-bottom: .75rem;
  border-left: 3px solid var(--amber);
}

.date-maj { font-size: .72rem; color: var(--text-light); margin-bottom: 1.5rem; }

.fiche-section { margin-bottom: 1.5rem; }

.fiche-section h2,
.fiche-section h3 {
  font-size: .78rem; font-weight: 600;
  color: var(--text-mid); text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: .75rem; padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.fiche-section ul { margin-left: 1.25rem; margin-bottom: .75rem; }
.fiche-section li { margin-bottom: .4rem; line-height: 1.65; color: var(--text); font-size: .9rem; }
.fiche-section p { margin-bottom: .7rem; line-height: 1.7; color: var(--text); font-size: .9rem; }
.fiche-section strong { color: var(--text); font-weight: 600; }

.liens-croises ul { list-style: none; margin-left: 0; display: flex; flex-direction: column; gap: .2rem; }
.liens-croises li a { display: inline-flex; align-items: center; gap: .3rem; font-size: .875rem; font-weight: 500; padding: .15rem 0; }

.back-link {
  display: inline-flex; align-items: center; gap: .3rem;
  margin: 1.5rem 0 3rem; padding: .4rem 1rem;
  color: var(--text-mid); font-weight: 500; font-size: .82rem;
  border: 1px solid var(--border); border-radius: 50px;
  background: var(--bg); transition: all var(--transition);
}
.back-link:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; }

/* ─── Header fiche + liens CRAT ─── */
.fiche-header {
  display: flex; align-items: flex-start;
  gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem;
}
.fiche-header .fiche-title { flex: 1; margin-bottom: 0; min-width: 200px; }

.crat-links { display: flex; gap: .3rem; flex-wrap: wrap; flex-shrink: 0; margin-top: .35rem; }

.crat-btn {
  display: inline-flex; align-items: center;
  padding: .28rem .75rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text-mid);
  font-size: .72rem; font-weight: 500;
  transition: all var(--transition); white-space: nowrap;
}
.crat-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); text-decoration: none; }

/* ─── Sections colorées (Grossesse / Allaitement / Exposition) ─── */
.section-grossesse {
  background: #fff1f5; border-left: 3px solid #f43f6e;
  padding: 1.25rem 1.4rem; border-radius: var(--radius); margin-bottom: 1.25rem;
}
.section-grossesse > h2 {
  color: #be123c; font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: .75rem; padding-bottom: 0; border-bottom: none;
}

.section-allaitement {
  background: #eff6ff; border-left: 3px solid #3b82f6;
  padding: 1.25rem 1.4rem; border-radius: var(--radius); margin-bottom: 1.25rem;
}
.section-allaitement > h2 {
  color: #1d4ed8; font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: .75rem; padding-bottom: 0; border-bottom: none;
}

.section-exposition {
  background: #f8fafc; border-left: 3px solid #94a3b8;
  padding: 1.25rem 1.4rem; border-radius: var(--radius); margin-bottom: 1.25rem;
}
.section-exposition > h2 {
  color: #64748b; font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: .75rem; padding-bottom: 0; border-bottom: none;
}

/* ─── Badges catégorie ─── */
.cat-badges { display: inline; margin-left: .3rem; }

.cat-badge {
  display: inline-block; font-size: .58rem; font-weight: 600;
  padding: .1rem .45rem; border-radius: 4px;
  vertical-align: middle; line-height: 1.5;
  letter-spacing: .03em; text-transform: uppercase;
}
.cat-grossesse  { background: #fce7f3; color: #be123c; }
.cat-allaitement { background: #dbeafe; color: #1d4ed8; }
.cat-exposition  { background: #f1f5f9; color: #64748b; }

/* ─── Badges type ─── */
.type-badge {
  display: inline-block; font-size: .58rem; font-weight: 600;
  padding: .1rem .5rem; border-radius: 4px;
  vertical-align: middle; line-height: 1.5;
  letter-spacing: .03em; white-space: nowrap;
}
.type-pathologie { background: #dcfce7; color: #166534; }
.type-dependance { background: #fef9c3; color: #854d0e; }
.type-imagerie   { background: #ede9fe; color: #5b21b6; }
.type-vaccin     { background: #dbeafe; color: #1e40af; }
.type-reference  { background: #f1f5f9; color: #475569; }

/* ─── Barre de filtres ─── */
.filter-bar {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: .3rem; margin-top: 1.25rem;
}

.filter-btn {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .32rem .8rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--text-mid);
  font-size: .72rem; font-family: inherit; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
}
.filter-btn:hover,
.filter-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.filter-count { font-size: .62rem; opacity: .65; }
.filter-btn.active .filter-count { opacity: .8; }

/* ─── Accès rapide ─── */
.quick-access { text-align: center; margin-top: 1.25rem; }

.quick-access-label {
  font-size: .65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-light); margin-bottom: .5rem;
}

.quick-access-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: .35rem; }

.pathologie-link {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .4rem .85rem;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); font-size: .8rem; font-weight: 500;
  color: var(--text); transition: all var(--transition);
}
.pathologie-link:hover { border-color: #166534; color: #166534; text-decoration: none; }
.pathologie-link .type-badge { font-size: .55rem; }

/* ─── Footer ─── */
.site-footer {
  margin-top: auto; background: var(--navy);
  color: rgba(255,255,255,.38); padding: 1.25rem 0;
  font-size: .75rem; text-align: center;
}
.site-footer a { color: rgba(255,255,255,.55); text-decoration: underline; text-decoration-color: rgba(255,255,255,.2); }
.site-footer a:hover { color: #fff; }

/* ─── Responsive ─── */
@media (max-width: 640px) {
  .hero { padding: 1.75rem 0 1.25rem; }
  .hero-title { font-size: 1.2rem; }
  #search-input { font-size: .9rem; }
  .fiche article { padding: 1.25rem 1rem; }
  .fiche-title { font-size: 1.25rem; }
  .med-grid { grid-template-columns: 1fr 1fr; }
  .section-grossesse, .section-allaitement, .section-exposition { padding: 1rem; }
  .filter-btn { font-size: .68rem; padding: .28rem .6rem; }
}
