/* ============================================================
   INDEX.CSS — Tableau IgG Only
   (Design 100% restauré, ancien style fidèle)
   ============================================================ */

/* -------------------------
   MENU AVANCÉ (tri / risques / admin / dev)
------------------------- */
.top-menu {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  margin-top: 4px;
}

.top-menu::-webkit-scrollbar {
  height: 4px;
}

.top-menu::-webkit-scrollbar-thumb {
  background: rgba(120, 180, 230, 0.8);
  border-radius: 999px;
}

.menu-pill {
  flex: 0 0 auto;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 6px 10px;
  border-radius: 999px;

  font-size: 0.75rem;

  border: 1px solid rgba(130, 190, 240, 0.4);
  background: rgba(5, 15, 30, 0.94);
  color: var(--lw-text-soft);

  cursor: pointer;
  transition: 0.15s;
}

.menu-pill:hover {
  border-color: var(--lw-accent);
  box-shadow: 0 0 10px var(--lw-accent-soft);
  color: var(--lw-text);
}

.select-pill select {
  background: transparent;
  border: none;
  color: var(--lw-text-soft);

  font-size: 0.75rem;
  padding-left: 4px;

  outline: none;
  cursor: pointer;
}

.select-pill option {
  background: #050b14;
}

/* DEV button active */
.neon-dev-btn.active,
body.dev-mode #dev-btn {
  border-color: var(--lw-accent);
  color: var(--lw-text);
  background: rgba(20, 40, 60, 0.9);
  box-shadow: 0 0 12px var(--lw-accent-soft);
}


/* -------------------------
   INTRO BLOCK
------------------------- */
.intro {
  margin-top: 14px;
  padding: 12px 14px;

  font-size: 0.9rem;
  color: var(--lw-text-soft);
}

.page-switch {
  margin-top: 10px;

  display: flex;
  justify-content: center;
  gap: 12px;

  padding: 10px;
  border-radius: 10px;
}

.page-switch a {
  padding: 6px 14px;
  border-radius: 8px;

  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);

  transition: 0.2s;
}

.page-switch a.active {
  background: var(--lw-accent);
  color: #041018;
  box-shadow: 0 0 10px var(--lw-accent-soft);
}

/* -------------------------
   FILTRES
------------------------- */
.filters {
  margin-top: 14px;
  padding: 12px 16px 14px;
  border-radius: 16px;
}

.filters-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.filters-title {
  font-size: 0.95rem;
  font-weight: 600;
}

.filters-hint {
  font-size: 0.75rem;
  opacity: 0.6;
  color: var(--lw-text-soft);
}

.filters-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filters-row::-webkit-scrollbar {
  height: 5px;
}

.filters-row::-webkit-scrollbar-thumb {
  background: rgba(100, 160, 220, 0.7);
  border-radius: 999px;
}

/* Chips */
.filter-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;

  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: 999px;

  background: rgba(20, 30, 45, 0.85);
  border: 1px solid rgba(150, 200, 255, 0.5);
  color: var(--lw-text-soft);

  white-space: nowrap;
  cursor: pointer;

  transition: 0.2s;
}

.filter-chip::before {
  content: "🔹";
  opacity: 0.7;
}

.filter-chip.active {
  background: var(--lw-accent);
  box-shadow: 0 0 12px var(--lw-accent-soft);

  color: #041018;
  border-color: var(--lw-accent);
}

.filter-chip.active::before {
  content: "✨";
}

/* -------------------------
   SECTION BLOCKS
------------------------- */
.section-block {
  margin-top: 18px;
}

.section-header {
  margin: 0 4px 8px;
}

.section-header h2 {
  font-size: 1.1rem;
  margin-bottom: 2px;
}

.section-sub {
  font-size: 0.8rem;
  color: var(--lw-text-soft);
}

/* -------------------------
   GRID
------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  padding: 4px;
}

@media (min-width: 1440px) {
  .card-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}


/* -------------------------
   FOOD CARD
------------------------- */
.food-card {
  position: relative;
  border-radius: 14px;

  background: rgba(10, 18, 30, 0.9);
  border: 1px solid rgba(120, 180, 230, 0.55);

  padding: 10px 10px 10px 14px;

  display: flex;
  flex-direction: column;
  gap: 6px;

  min-height: 120px;
  overflow: hidden;
}

/* Couleur niveau (barre gauche) */
.food-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  border-radius: 14px 0 0 14px;
}

.level-green::before {
  background: #53f29a;
}

.level-yellow::before {
  background: #ff7300;
}

.level-red::before {
  background: #ff0000;
}

/* Header */
.card-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-icon {
  width: 30px;
  height: 30px;

  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ffffff, transparent 55%);
  box-shadow: 0 0 10px rgba(66, 226, 255, 0.3);

  display: flex;
  justify-content: center;
  align-items: center;

  font-size: 1.2rem;
}

.name-block {
  flex: 1;
}

.food-name {
  font-size: 0.98rem;
  font-weight: 600;
}

.food-category {
  font-size: 0.78rem;
  color: var(--lw-text-soft);
}

/* Type pill */
.type-pill {
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: 999px;

  border: 1px solid rgba(140, 210, 255, 0.5);
  background: rgba(15, 30, 50, 0.8);

  color: var(--lw-text-soft);

  display: inline-block;
}

.type-intol {
  border-color: #46e2ff;
}

.type-allergy {
  border-color: #ff6f8b;
}

/* Edit pill admin */
.edit-pill {
  position: absolute;
  top: 6px;
  right: 7px;

  font-size: 0.7rem;
  padding: 2px 7px;

  border-radius: 999px;
  border: 1px solid rgba(160, 220, 255, 0.5);

  background: rgba(5, 15, 30, 0.95);
  color: var(--lw-text-soft);

  cursor: pointer;
  transition: 0.2s;
}

.edit-pill:hover {
  background: var(--lw-accent);
  color: #041018;
  border-color: var(--lw-accent);
  box-shadow: 0 0 10px var(--lw-accent-soft);
  transform: scale(1.1);
}

.value-main {
  font-size: 0.9rem;
  font-weight: 600;
}

.value-sub {
  color: var(--lw-text-soft);
}

/* Levels text */
.level-text-1 {
  color: #53f29a;
  font-weight: 600;
}

.level-text-2 {
  color: #ffd966;
  font-weight: 600;
}

.level-text-3 {
  color: #ff4b6a;
  font-weight: 600;
}

/* IgG dots */
.igg-scale {
  font-size: 0.95rem;
  letter-spacing: 2px;
}

/* Tags */
.tags {
  margin-top: 2px;
}

.tag {
  display: inline-block;
  margin-right: 4px;
  margin-bottom: 2px;

  padding: 2px 6px;
  border-radius: 999px;

  font-size: 0.68rem;

  border: 1px solid rgba(140, 210, 255, 0.3);
  color: var(--lw-text);
}

/* -------------------------
   CARD ACTIONS
------------------------- */
.card-actions {
  margin-top: 4px;
  display: flex;
  justify-content: flex-end;
}

.btn.tiny {
  padding: 3px 7px;
  font-size: 0.7rem;
}

/* -------------------------
   RESPONSIVE — index only
------------------------- */
@media (min-width: 700px) {
  .top-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .top-actions {
    align-items: center;
    justify-content: space-between;
  }

  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  }
}

@media (min-width: 980px) {
  .app-shell {
    padding-top: 16px;
  }

  .intro,
  .filters,
  .section-block,
  .explanations,
  .footer {
    margin-left: 2px;
    margin-right: 2px;
  }
}




/* Modal d'historique fix */
#history-modal {
  position: fixed !important;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(1, 4, 12, 0.75);
  backdrop-filter: blur(10px);
  z-index: 9999 !important;
}

.history-modal-box {
  width: 90%;
  max-width: 480px;
  background: rgba(8, 16, 30, 0.98);
  border: 1px solid var(--lw-border);
  padding: 22px 20px;
  border-radius: 14px;
  box-shadow: 0 0 24px rgba(0, 0, 0, 0.8);
  position: relative;
}

#history-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
}



/* === THRESHOLDS MODAL === */
#thresholds-modal {
  position: fixed !important;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(1, 4, 12, 0.75);
  backdrop-filter: blur(10px);
  z-index: 9999;
}

#thresholds-modal .modal-box {
  width: 100%;
  max-width: 420px !important;
  padding: 20px 22px;
  background: rgba(8, 16, 30, 0.98);
  border: 1px solid var(--lw-border);
  border-radius: 16px;
  box-shadow: 0 0 22px rgba(0, 0, 0, 0.8);
}

/* Header */
.thresholds-header {
  display: grid;
  grid-template-columns: 1fr 70px 70px 70px;
  gap: 10px;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(150, 210, 255, 0.3);
  text-align: center;
  color: var(--lw-text-soft);
}

/* Rows */
.threshold-edit-row {
  display: grid;
  grid-template-columns: 1fr 70px 70px 70px;
  gap: 10px;
  align-items: center;
}

.threshold-edit-row input {
  width: 100%;
  padding: 6px;
  text-align: center;
  border-radius: 8px;
  border: 1px solid rgba(140, 190, 255, 0.45);
  background: rgba(5, 10, 25, 0.95);
  color: var(--lw-text);
}

.thresholds-edit-list {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}



/* Tags rapides dans la modale */
.tag-predef {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(20, 30, 45, 0.9);
  border: 1px solid rgba(140, 210, 255, 0.45);
  color: var(--lw-text);
  cursor: pointer;
  font-size: 0.78rem;
  transition: 0.15s;
}

.tag-predef:hover {
  border-color: var(--lw-accent);
  box-shadow: 0 0 8px var(--lw-accent-soft);
}

.tag-predef.active {
  background: var(--lw-accent);
  color: #041018;
  border-color: var(--lw-accent);
  box-shadow: 0 0 12px var(--lw-accent-soft);
}