/* ===========================
   Suivi Bébé - Style global
   Responsive + Mobile-first
   =========================== */

/* Reset simple & variables */
:root{
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --brand: #3b82f6;
  --brand-700: #2563eb;
  --accent: #10b981;
  --danger: #ef4444;
  --radius: 12px;
  --shadow: 0 1px 6px rgba(0,0,0,.06);
  --space: 16px;
  --space-lg: 24px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}

/* Liens / boutons */
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid transparent; background: var(--brand); color: #fff;
  font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1;
  min-height: 44px; /* cible tactile */
}
.btn:hover { background: var(--brand-700); text-decoration: none; }
.btn.ghost {
  background: #fff; color: var(--text); border: 1px solid var(--border);
}
.btn.ghost:hover { background: #f9fafb; }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #dc2626; }

/* Inputs */
.input, select, input[type="date"], input[type="time"], input[type="number"], input[type="email"], input[type="password"], input[type="text"], textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 12px 12px;
  min-height: 44px; /* cible tactile */
  outline: none;
  font-size: 16px; /* évite zoom iOS */
}
textarea { min-height: 120px; resize: vertical; }

/* Layout principal */
.page-content { padding: 16px; padding-bottom: 80px; } /* bottom padding pour la tabbar mobile */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* Header / Navbar */
header.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(1.2) blur(8px);
  background: rgba(255,255,255,.8);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.nav .brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.nav .logo {
  width: 36px; height: 36px; border-radius: 10px;
  display:flex; align-items:center; justify-content:center;
  background: var(--brand); color: #fff; font-weight: 800;
}
.nav-links { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap; overflow-x: auto; }
.nav-links a { padding: 8px 10px; border-radius: 8px; white-space: nowrap; }

/* Sections */
.page-section { margin: 10px 0 24px; }

/* Dashboard */
.dashboard-layout {
  display: flex; gap: 24px; max-width: 1200px; margin: 0 auto;
}
.sidebar {
  flex: 0 0 260px;
}
.main-content {
  flex: 1;
}

/* Tabs */
.tab-btn {
  background: #f3f4f6; color: #111;
  border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 10px;
  font-weight: 600; min-height: 40px;
}
.tab-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Footer */
footer[role="contentinfo"]{
  margin: 24px auto 90px; /* espace pour tabbar mobile */
  max-width: 1200px; padding: 20px; display:flex; align-items:center; justify-content: space-between; gap: 16px;
  color: var(--muted);
}
footer .text-muted { color: var(--muted); }

/* ======================
   MOBILE FIRST (≤ 900px)
   ====================== */
@media (max-width: 900px){
  .dashboard-layout { flex-direction: column; }
  .sidebar { flex: 1 1 auto; }
  .card { padding: 16px; }
  .nav { padding: 10px 12px; }
  .nav .logo { width: 32px; height: 32px; }
  .nav-links { gap: 6px; }
  .page-content { padding: 12px; padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  footer[role="contentinfo"]{ flex-direction: column; align-items: flex-start; margin-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .dashboard-nav { overflow-x: auto; padding-bottom: 4px; }
}

/* ==========================
   Barre d’onglets mobile fix
   ========================== */
.mobile-tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: none; /* caché par défaut (desktop) */
  background: rgba(255,255,255,.95);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(8px);
  padding: 8px max(12px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-right));
}
.mobile-tabbar .tabs {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px;
}
.mobile-tabbar a {
  display:flex; align-items:center; justify-content:center;
  gap:6px; padding: 10px 8px; border-radius: 10px; border: 1px solid var(--border);
  background:#fff; color: #111; text-decoration: none; font-weight: 600;
  min-height: 44px;
}
.mobile-tabbar a.active {
  background: var(--brand); color: #fff; border-color: var(--brand);
}

@media (max-width: 900px){
  .mobile-tabbar { display: block; }
}

/* ==========================
   Card sur Login.PHP
   ========================== */
.auth-card {
  max-width: 440px;
  margin: 60px auto;
  padding: 40px 32px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.05);
  text-align: center;
}

.auth-card h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text);
}

.auth-card p {
  color: var(--muted);
  margin-bottom: 24px;
  font-size: 15px;
  line-height: 1.5;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tab-content { display:none; }
.tab-content.active { display:block; }
.tab-btn {
  background:#f3f4f6;
  border:none;
  padding:8px 14px;
  border-radius:8px;
  cursor:pointer;
  transition:0.2s;
  text-decoration:none;
  display:inline-block;
}
.tab-btn.active { background:#3b82f6; color:#fff; }

/* --- Barre d’onglets mobile : cachée par défaut --- */
.mobile-tabbar{
  display:none;
  position:fixed; left:0; right:0; bottom:0; z-index:60;
  background:rgba(255,255,255,.95);
  border-top:1px solid #e5e7eb;
  backdrop-filter: blur(8px);
  padding:8px 12px calc(8px + env(safe-area-inset-bottom)) 12px;
}
.mobile-tabbar .tabs{
  display:grid; grid-template-columns:repeat(5,1fr); gap:8px; /* 5 onglets visibles */
}
.mobile-tabbar a{
  display:flex; align-items:center; justify-content:center;
  gap:6px; padding:10px 8px; border-radius:10px;
  border:1px solid #e5e7eb; background:#fff; color:#111; text-decoration:none; font-weight:600;
  min-height:44px;
}
.mobile-tabbar a.active{ background:#3b82f6; color:#fff; border-color:#3b82f6; }

@media (max-width:900px){
  .mobile-tabbar{ display:block; }
  .page-content{ padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
}
@media (min-width:901px){
  .mobile-tabbar{ display:none !important; }
}
/* ===== Timeline par heure (Vue d’ensemble) ===== */
.tl-grid{
  display:grid;
  grid-template-columns: repeat(24, minmax(28px, 1fr));
  gap:8px;
  padding:10px;
  border:1px solid #e5e7eb;
  border-radius:12px;
  background:#fff;
  overflow-x:auto;
}
.tl-hour{
  display:flex; flex-direction:column; align-items:center;
}
.tl-hour-label{
  font-size:11px; color:#6b7280; margin-bottom:6px;
}
.tl-pit{
  min-height:42px;
  width:100%;
  background:linear-gradient(to bottom, #f9fafb, #f3f4f6);
  border:1px dashed #e5e7eb;
  border-radius:10px;
  display:flex; flex-wrap:wrap;
  align-content:flex-start; justify-content:center;
  gap:4px; padding:4px;
}

/* icônes (emoji) avec pastilles colorées */
.tl-ico{
  font-size:14px; line-height:1;
  display:inline-flex; align-items:center; justify-content:center;
  width:22px; height:22px; border-radius:6px;
  border:1px solid transparent; cursor:default;
}

/* couleurs par type */
.tl-bottle{ background:#e0f2fe; border-color:#bae6fd; }   /* bleu clair */
.tl-wet   { background:#e0f2fe; border-color:#bae6fd; }   /* même que biberon */
.tl-dirty { background:#fde68a; border-color:#fcd34d; }   /* jaune */
.tl-weight{ background:#dcfce7; border-color:#bbf7d0; }   /* vert */
.tl-height{ background:#e9d5ff; border-color:#d8b4fe; }   /* violet */
.tl-temp  { background:#fee2e2; border-color:#fecaca; }   /* rouge */

/* pastilles de légende */
.tl-legend{ display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; }
.tl-pill{
  display:inline-flex; align-items:center; gap:6px;
  font-size:12px; padding:6px 8px; border-radius:999px; border:1px solid #e5e7eb; background:#fff;
}
.tl-pill.tl-bottle{ background:#e0f2fe; border-color:#bae6fd; }
.tl-pill.tl-wet   { background:#e0f2fe; border-color:#bae6fd; }
.tl-pill.tl-dirty { background:#fde68a; border-color:#fcd34d; }
.tl-pill.tl-weight{ background:#dcfce7; border-color:#bbf7d0; }
.tl-pill.tl-height{ background:#e9d5ff; border-color:#d8b4fe; }
.tl-pill.tl-temp  { background:#fee2e2; border-color:#fecaca; }

/* Responsive: sur mobile, fais défiler horizontalement 24 colonnes */
@media (max-width:900px){
  .tl-grid{ grid-template-columns: repeat(24, 44px); }
}
/* ===== Jour/Nuit pour la timeline ===== */

/* icône soleil/lune dans l’entête d’heure */
.tl-sky{
  display:inline-flex; align-items:center; justify-content:center;
  width:18px; height:18px; border-radius:999px; margin-right:4px;
  font-size:11px; line-height:1;
}
.tl-sky.tl-day  { background:#fef9c3; border:1px solid #fde68a; } /* jaune pâle */
.tl-sky.tl-night{ background:#e0e7ff; border:1px solid #c7d2fe; } /* bleu/violet pâle */

/* teinte de fond différente dans la “fosse” (case) */
.tl-hour.day   .tl-pit{ background:linear-gradient(to bottom, #fffdf3, #fff6d1);
                        border-color:#fde68a; }
.tl-hour.night .tl-pit{ background:linear-gradient(to bottom, #eef2ff, #e0e7ff);
                        border-color:#c7d2fe; }

/* légende jour/nuit */
.tl-pill.tl-day  { background:#fef9c3; border-color:#fde68a; }
.tl-pill.tl-night{ background:#e0e7ff; border-color:#c7d2fe; }
	
/* ===== Quick Add (boutons + mini formulaires) ===== */
.qa-wrap{
  margin-top:14px; background:#fff; border:1px solid #e5e7eb; border-radius:12px;
  padding:12px; box-shadow:0 1px 4px rgba(0,0,0,.04);
}
.qa-buttons{
  display:flex; flex-wrap:wrap; gap:8px; margin-bottom:8px;
}

/* >>> fix couleurs : on surpasse .btn et on reset opacité/filtres */
.qa-buttons .btn.qa-btn{
  -webkit-appearance:none; appearance:none;
  background:#f8fafc !important;
  color:#111827 !important;
  border:1px solid #e5e7eb !important;
  border-radius:10px;
  padding:8px 10px;
  font-weight:600;
  cursor:pointer;
  box-shadow:none !important;
  opacity:1 !important;
  filter:none !important;
  transition:background .15s, border-color .15s, color .15s;
}
.qa-buttons .btn.qa-btn:hover{
  background:#eef2ff !important;
  border-color:#c7d2fe !important;
}
.qa-buttons .btn.qa-btn.active{
  background:#2563eb !important;
  border-color:#2563eb !important;
  color:#ffffff !important;
}

/* formulaires */
.qa-forms{ position:relative; }
.qa-form{
  display:none; gap:10px; align-items:flex-end; flex-wrap:wrap;
  padding-top:6px; border-top:1px dashed #e5e7eb;
}
.qa-form.show{ display:flex; }
.qa-form label{
  font-size:12px; color:#374151; display:flex; flex-direction:column; gap:4px;
}
.qa-form input{
  height:36px; padding:6px 8px; border:1px solid #e5e7eb; border-radius:8px;
}
.qa-form .btn{ height:36px; }


/* ===== Notes de la journée ===== */
.day-notes{
  margin-top:14px;
  background:#fff;
  border:1px solid #e5e7eb;
  border-radius:16px;
  padding:14px;
  box-shadow:0 4px 18px rgba(0,0,0,.04);
}

.notes-header{
  display:flex; align-items:baseline; justify-content:space-between; gap:10px; margin-bottom:8px;
}
.notes-title{ display:flex; align-items:center; gap:8px; }
.notes-title .emoji{ font-size:22px; }
.notes-title h3{ margin:0; font-size:18px; }
.notes-sub{ color:#6b7280; font-size:13px; }

.note-form{
  display:flex; gap:10px; align-items:flex-end; flex-wrap:wrap;
  background:#f9fafb; border:1px dashed #e5e7eb; border-radius:12px; padding:10px;
}
.note-form label{
  font-size:12px; color:#374151; display:flex; flex-direction:column; gap:4px;
}
.note-form input[type="date"],
.note-form input[type="time"],
.note-form textarea{
  border:1px solid #e5e7eb; border-radius:8px; padding:8px; background:#fff;
}
.note-form .grow{ flex:1 1 280px; }
.note-form .primary{ background:#3b82f6; color:#fff; }

.notes-list{
  list-style:none; padding:0; margin:12px 0 0 0; display:flex; flex-direction:column; gap:10px;
}
.note-item{
  display:flex; flex-direction:column; gap:8px;
  padding:12px; border:1px solid #f3f4f6; border-radius:12px; background:#fbfbfb;
}
.note-read{ display:grid; grid-template-columns:auto 1fr auto; gap:10px; align-items:start; }
.note-time-badge{
  background:#111827; color:#fff; font-weight:700; font-size:12px;
  border-radius:999px; padding:6px 10px; min-width:54px; text-align:center;
}
.note-text{ white-space:pre-wrap; color:#111827; padding-top:2px; }
.note-actions{ display:flex; gap:8px; }
.note-actions .small{ height:32px; padding:6px 10px; }

.note-edit{
  display:grid; grid-template-columns:140px 120px 1fr; gap:10px; align-items:end;
  background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:10px;
}
.note-edit label{ font-size:12px; color:#374151; display:flex; flex-direction:column; gap:4px; }
.note-edit input[type="date"],
.note-edit input[type="time"],
.note-edit textarea{ border:1px solid #e5e7eb; border-radius:8px; padding:8px; }
.note-edit .grow{ flex:1; }
.edit-actions{ display:flex; gap:8px; align-items:center; }
.edit-actions .primary{ background:#10b981; color:#fff; }
.note-cancel-btn{ background:#f3f4f6; }

.empty-notes{ margin-top:6px; }

@media (max-width:700px){
  .note-read{ grid-template-columns:auto 1fr; }
  .note-actions{ grid-column:1 / -1; }
  .note-edit{ grid-template-columns:1fr; }
}