/* ═══════════════════════════════════════════════════════════════
   NutriPatient — Espace Patient CSS
   ═══════════════════════════════════════════════════════════════ */

:root {
  --npp-green:   #2c5530;
  --npp-sage:    #52b788;
  --npp-foam:    #d8f3dc;
  --npp-ink:     #1b2d3e;
  --npp-slate:   #475569;
  --npp-bg:      #f0f4f1;
  --npp-white:   #ffffff;
  --npp-border:  #e2e8f0;
  --npp-radius:  12px;
}

/* ── Reset ── */
.npp-wrap * { box-sizing: border-box; margin: 0; padding: 0; }
.npp-wrap { font-family: 'DM Sans', 'Outfit', system-ui, sans-serif;
            background: var(--npp-bg); min-height: 100vh; color: var(--npp-ink); }

/* ── Header ── */
.npp-header { background: var(--npp-green); color: white; padding: 0 20px; }
.npp-header-inner { max-width: 900px; margin: 0 auto; display: flex;
                    align-items: center; justify-content: space-between;
                    height: 56px; }
.npp-brand { display: flex; align-items: center; gap: 8px; font-weight: 700;
             font-size: 1rem; color: white; text-decoration: none; }
.npp-brand-icon { font-size: 1.3rem; }
.npp-patient-id { display: flex; align-items: center; gap: 8px; }
.npp-patient-avatar { width: 32px; height: 32px; border-radius: 50%;
                      background: rgba(255,255,255,.2); display: flex;
                      align-items: center; justify-content: center;
                      font-size: .75rem; font-weight: 700; color: white; }
.npp-patient-name { font-size: .85rem; color: rgba(255,255,255,.9); }

/* ── Nav ── */
.npp-nav { background: white; border-bottom: 1px solid var(--npp-border);
           overflow-x: auto; -webkit-overflow-scrolling: touch; }
.npp-nav-inner { max-width: 900px; margin: 0 auto; display: flex; }
.npp-nav-item { display: flex; flex-direction: column; align-items: center;
                gap: 2px; padding: 10px 16px; text-decoration: none;
                color: var(--npp-slate); font-size: .78rem; font-weight: 500;
                border-bottom: 2px solid transparent; white-space: nowrap;
                transition: all .15s; }
.npp-nav-item:hover { color: var(--npp-green); }
.npp-nav-active { color: var(--npp-green) !important;
                  border-bottom-color: var(--npp-green) !important;
                  font-weight: 700 !important; }
.npp-nav-icon { font-size: 1.2rem; }

/* ── Main ── */
.npp-main { max-width: 900px; margin: 0 auto; padding: 24px 16px 60px; }

/* ── Footer ── */
.npp-footer { text-align: center; padding: 20px; font-size: .8rem;
              color: var(--npp-slate); border-top: 1px solid var(--npp-border);
              background: white; margin-top: 40px; }
.npp-footer a { color: var(--npp-green); text-decoration: none; }

/* ── Boutons ── */
.npp-btn { display: inline-flex; align-items: center; gap: 6px;
           padding: 10px 20px; border-radius: 8px; font-weight: 600;
           font-size: .9rem; cursor: pointer; border: none;
           font-family: inherit; text-decoration: none; transition: all .2s; }
.npp-btn-primary { background: var(--npp-green); color: white; }
.npp-btn-primary:hover { background: #1e3a22; color: white; }
.npp-btn-outline { background: white; color: var(--npp-green);
                   border: 1.5px solid var(--npp-green); }
.npp-btn-outline:hover { background: var(--npp-foam); }
.npp-btn-sm { padding: 6px 12px; font-size: .82rem; }

/* ── Dashboard ── */
.npp-dashboard-hero { background: var(--npp-green); color: white;
                      border-radius: var(--npp-radius); padding: 24px;
                      margin-bottom: 20px; }
.npp-dashboard-hero h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 4px; }
.npp-dashboard-hero p  { font-size: .9rem; opacity: .75; }

.npp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
             gap: 12px; margin-bottom: 20px; }
.npp-card { background: white; border: 1px solid var(--npp-border);
            border-radius: var(--npp-radius); padding: 16px;
            text-align: center; text-decoration: none; color: var(--npp-ink); }
.npp-card-link:hover { border-color: var(--npp-green); background: var(--npp-foam); }
.npp-card-icon { font-size: 1.8rem; margin-bottom: 6px; }
.npp-card-val  { font-size: 1.6rem; font-weight: 800; color: var(--npp-green); }
.npp-card-label{ font-size: .78rem; color: var(--npp-slate); margin-top: 2px; }
.npp-card-sub  { font-size: .72rem; color: #94a3b8; margin-top: 2px; }

.npp-next-rdv { background: #eff6ff; border: 1px solid #bfdbfe;
                border-radius: var(--npp-radius); padding: 16px;
                display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.npp-next-rdv-icon { font-size: 2rem; flex-shrink: 0; }
.npp-next-rdv-label{ font-size: .75rem; color: #1d4ed8; font-weight: 700;
                     text-transform: uppercase; letter-spacing: .06em; }
.npp-next-rdv-date { font-size: 1rem; font-weight: 700; color: var(--npp-ink); }
.npp-next-rdv-type { font-size: .82rem; color: var(--npp-slate); margin-top: 2px; }

/* ── Saisie rapide ── */
.npp-quick-mesure { background: white; border-radius: var(--npp-radius);
                    border: 1px solid var(--npp-border); padding: 20px; }
.npp-quick-mesure h2 { font-size: 1rem; font-weight: 700; margin-bottom: 14px; }
.npp-quick-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px,1fr));
                    gap: 10px; margin-bottom: 14px; }
.npp-quick-field label { display: block; font-size: .72rem; font-weight: 600;
                          color: var(--npp-slate); text-transform: uppercase;
                          letter-spacing: .06em; margin-bottom: 4px; }
.npp-quick-field input { width: 100%; padding: 8px 10px; border: 1.5px solid var(--npp-border);
                          border-radius: 8px; font-size: .9rem; outline: none;
                          font-family: inherit; transition: border-color .15s; }
.npp-quick-field input:focus { border-color: var(--npp-green); }

/* ── Section générique ── */
.npp-section h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.npp-intro { color: var(--npp-slate); margin-bottom: 20px; font-size: .9rem; }

/* ── Formulaire mesures ── */
.npp-form-card { background: white; border-radius: var(--npp-radius);
                 border: 1px solid var(--npp-border); padding: 24px; margin-bottom: 28px; }
.npp-form-card h2 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; }
.npp-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
                 gap: 14px; margin-bottom: 16px; }
.npp-form-field { display: flex; flex-direction: column; gap: 5px; }
.npp-form-field-full { grid-column: 1 / -1; }
.npp-form-field label { font-size: .72rem; font-weight: 700; color: var(--npp-slate);
                        text-transform: uppercase; letter-spacing: .06em; }
.npp-form-field input,
.npp-form-field textarea { padding: 9px 12px; border: 1.5px solid var(--npp-border);
                            border-radius: 8px; font-size: .9rem; outline: none;
                            font-family: inherit; transition: border-color .15s; }
.npp-form-field input:focus,
.npp-form-field textarea:focus { border-color: var(--npp-green); }

/* ── Tableau mesures ── */
.npp-mesures-table { overflow-x: auto; background: white; border-radius: var(--npp-radius);
                     border: 1px solid var(--npp-border); }
.npp-mesures-table table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.npp-mesures-table th { padding: 12px 14px; text-align: left; font-size: .72rem;
                        font-weight: 700; color: var(--npp-slate); text-transform: uppercase;
                        letter-spacing: .06em; border-bottom: 1px solid var(--npp-border);
                        background: #f8fafc; }
.npp-mesures-table td { padding: 12px 14px; border-bottom: 1px solid #f8fafc;
                        vertical-align: middle; }
.npp-mesures-table tr:last-child td { border-bottom: none; }
.npp-notes-cell { max-width: 200px; color: var(--npp-slate); font-size: .82rem; }

/* Badges IMC */
.npp-imc-badge { display: inline-block; padding: 2px 8px; border-radius: 6px;
                 font-size: .78rem; font-weight: 600; white-space: nowrap; }
.npp-imc-low  { background: #dbeafe; color: #1d4ed8; }
.npp-imc-ok   { background: #dcfce7; color: #166534; }
.npp-imc-warn { background: #fef9c3; color: #92400e; }
.npp-imc-high { background: #fee2e2; color: #991b1b; }

/* ── Chart ── */
.npp-chart-wrap { background: white; border-radius: var(--npp-radius);
                  border: 1px solid var(--npp-border); padding: 16px;
                  margin-bottom: 16px; }

/* ── Recommandations ── */
.npp-reco-card { background: white; border-radius: var(--npp-radius);
                 border: 1px solid var(--npp-border); margin-bottom: 20px;
                 overflow: hidden; }
.npp-reco-header { display: flex; align-items: center; justify-content: space-between;
                   padding: 18px 20px 14px; border-bottom: 1px solid var(--npp-border); }
.npp-reco-header h2 { font-size: 1rem; font-weight: 700; }
.npp-reco-date { font-size: .78rem; color: var(--npp-slate); }

/* Tabs recommandations */
.npp-tabs-nav { display: flex; gap: 4px; padding: 12px 16px 0;
                border-bottom: 1px solid var(--npp-border); background: #f8fafc; }
.npp-tab-btn { padding: 8px 16px; border: none; background: none; cursor: pointer;
               font-family: inherit; font-size: .85rem; font-weight: 600;
               color: var(--npp-slate); border-radius: 6px 6px 0 0;
               border-bottom: 2px solid transparent; transition: all .15s; }
.npp-tab-btn.active { background: white; color: var(--tab-color, var(--npp-green));
                      border-bottom-color: var(--tab-color, var(--npp-green)); }
.npp-tab-content { display: none; padding: 20px; }
.npp-tab-content.active { display: block; }
.npp-reco-html { font-size: .9rem; line-height: 1.7; color: var(--npp-ink); }
.npp-reco-html h3 { font-size: 1rem; margin: 16px 0 8px; color: var(--npp-green); }
.npp-reco-html ul { padding-left: 20px; margin: 8px 0; }
.npp-reco-html li { margin-bottom: 4px; }
.npp-reco-html p  { margin-bottom: 10px; }

/* ── Documents ── */
.npp-docs-grid { display: flex; flex-direction: column; gap: 10px; }
.npp-doc-card { background: white; border-radius: var(--npp-radius);
                border: 1px solid var(--npp-border); padding: 14px 16px;
                display: flex; align-items: center; gap: 14px; }
.npp-doc-icon { font-size: 1.8rem; flex-shrink: 0; }
.npp-doc-info { flex: 1; min-width: 0; }
.npp-doc-name { font-weight: 600; font-size: .9rem;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.npp-doc-desc { font-size: .82rem; color: var(--npp-slate); margin-top: 2px; }
.npp-doc-meta { font-size: .75rem; color: #94a3b8; margin-top: 2px; }

/* ── Aliments ── */
.npp-alim-search { display: flex; gap: 10px; margin-bottom: 20px; }
.npp-alim-input { flex: 1; padding: 12px 16px; border: 1.5px solid var(--npp-border);
                  border-radius: 10px; font-size: 1rem; outline: none; font-family: inherit; }
.npp-alim-input:focus { border-color: var(--npp-green); }

.npp-alim-card { background: white; border-radius: var(--npp-radius);
                 border: 1px solid var(--npp-border); padding: 14px 16px;
                 margin-bottom: 8px; display: flex; align-items: center;
                 gap: 12px; transition: all .15s; }
.npp-alim-card:hover { border-color: var(--npp-sage); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.npp-alim-card-main { flex: 1; min-width: 0; }
.npp-alim-card-name  { font-weight: 600; font-size: .9rem; }
.npp-alim-card-groupe{ font-size: .75rem; color: var(--npp-slate); margin-top: 2px; }
.npp-alim-card-etiquette { display: flex; gap: 10px; flex-wrap: wrap; }
.npp-etiq-item { text-align: center; min-width: 45px; }
.npp-etiq-val  { display: block; font-weight: 700; font-size: .88rem; color: var(--npp-ink); }
.npp-etiq-unit { display: block; font-size: .65rem; color: var(--npp-slate); }
.npp-alim-card-arrow { font-size: 1.2rem; color: #cbd5e1; flex-shrink: 0; }

/* Étiquette détail */
.npp-etiquette { background: white; border: 2px solid var(--npp-ink);
                 border-radius: var(--npp-radius); padding: 20px; max-width: 440px; }
.npp-etiq-title { margin-bottom: 8px; }
.npp-etiq-title strong { font-size: 1rem; font-weight: 800; }
.npp-etiq-groupe { display: block; font-size: .78rem; color: var(--npp-slate); margin-top: 2px; }
.npp-etiq-header { background: var(--npp-ink); color: white; padding: 6px 10px;
                   font-size: .75rem; font-weight: 600; border-radius: 4px;
                   margin-bottom: 8px; }
.npp-etiq-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.npp-etiq-table td { padding: 5px 0; border-bottom: 1px solid #f1f5f9; }
.npp-etiq-table td:last-child { text-align: right; font-weight: 600; }
.npp-etiq-main td { font-weight: 800; font-size: 1rem; border-bottom: 3px solid var(--npp-ink); }
.npp-etiq-sub td { color: var(--npp-slate); padding-left: 12px; }
.npp-etiq-highlight td { color: #0369a1; background: #f0f9ff; border-radius: 4px; }

/* ── États ── */
.npp-empty { text-align: center; padding: 60px 24px; color: var(--npp-slate); }
.npp-empty-icon { font-size: 3rem; margin-bottom: 12px; }
.npp-empty-small { text-align: center; padding: 24px; color: var(--npp-slate);
                   background: white; border-radius: var(--npp-radius); }
.npp-loading { text-align: center; padding: 24px; color: var(--npp-slate);
               animation: npp-pulse 1.5s ease-in-out infinite; }
@keyframes npp-pulse { 0%,100% { opacity:1 } 50% { opacity:.4 } }

/* ── Messages feedback ── */
.npp-msg-ok  { background: #dcfce7; color: #166534; border-radius: 8px;
               padding: 10px 14px; font-size: .88rem; margin-top: 12px; font-weight: 500; }
.npp-msg-err { background: #fee2e2; color: #991b1b; border-radius: 8px;
               padding: 10px 14px; font-size: .88rem; margin-top: 12px; font-weight: 500; }

/* ── Login ── */
.npp-login-wrap { min-height: 100vh; display: flex; align-items: center;
                  justify-content: center; padding: 24px; background: var(--npp-bg); }
.npp-login-box  { background: white; border-radius: 16px; padding: 40px;
                  max-width: 420px; width: 100%; text-align: center;
                  box-shadow: 0 4px 20px rgba(0,0,0,.08); }
.npp-login-logo { font-size: 3rem; margin-bottom: 16px; }
.npp-login-box h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 10px; color: var(--npp-ink); }
.npp-login-box p  { color: var(--npp-slate); font-size: .9rem; line-height: 1.6; margin-bottom: 20px; }
.npp-login-info { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 10px;
                  padding: 14px; display: flex; align-items: flex-start; gap: 12px;
                  text-align: left; font-size: .85rem; color: #1e40af; }
.npp-info-icon  { font-size: 1.3rem; flex-shrink: 0; }

/* ── Responsive ── */
@media (max-width: 600px) {
  .npp-cards { grid-template-columns: repeat(2, 1fr); }
  .npp-alim-card-etiquette { display: none; }
  .npp-quick-fields { grid-template-columns: 1fr 1fr; }
  .npp-doc-card { flex-wrap: wrap; }
}
/* Ajouts JS inline */

/* ── Bandeau mode démo ─────────────────────────────────────── */
.npp-demo-banner {
  background: #f59e0b;
  color: #1c1917;
  text-align: center;
  padding: 8px 16px;
  font-size: .82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.npp-demo-banner strong { font-weight: 800; }
.npp-demo-back {
  background: rgba(0,0,0,.12);
  color: #1c1917;
  padding: 3px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  font-size: .78rem;
  white-space: nowrap;
}
.npp-demo-back:hover { background: rgba(0,0,0,.2); }
