:root {
  --bg-dark: #f8fafc;        /* Fond de page très clair (Slate 50) */
  --border-color: #e2e8f0;    /* Bordures discrètes (Slate 200) */
  --text-main: #0f172a;      /* Texte principal sombre (Slate 900) */
  --text-muted: #64748b;     /* Texte secondaire adouci (Slate 500) */
  
  /* Color Mapping */
  --color-ambient: #7457ea;   /* Violet / Bleu */
  --color-humidity: #475569;  /* Ardoise sombre pour le mode clair */
  --color-liquid: #e63946;    /* Rouge */
/*ELEMENTS*/
  --card-bg : #f8f8f8;
  --card-color : #1f150c;
}
body {
  /* background-color: var(--bg-dark); */
  color: var(--text-main);
  transition: background-color 0.5s ease;
}

.kombuboard-wrapper {
  position: relative;
  margin-bottom: 100px;
}

header.kbb {
  margin-top: 10px;
  width: 100%;
  height: 50px;
}

#logo {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 20px 0 20px 0;
  color: var(--text-main);
}

.timestamp {
  font-size: 0.875rem;
  color: var(--card-color);
  float: left;
}

.countdown {
  font-weight: 600;
  color: var(--card-color);
  margin-left: 6px;
  width: 70px;
  display: inline-block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(261px, 1fr));
  gap: 25px;
  width: 100%;
  margin-bottom: 32px;
}
/*HIDE LIQUIDE 2 if TEMP OFF*/
#card-liquid2 {
/*display: none;*/
}

.card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
  overflow: hidden;
  transition: box-shadow 0.4s ease, border-color 0.4s ease;
  border: none;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
}
.card-ambient::before { background: var(--color-ambient); }
.card-humidity::before { background: var(--color-humidity); }
.card-liquid::before { background: var(--color-liquid); }

/* Ombres dynamiques de la carte Liquide adaptées au mode clair */
.shadow-active {
  box-shadow: 0 0 20px 2px rgba(249, 115, 22, 0.85), 0 4px 10px -3px rgba(0, 0, 0, 0.7);
  border-color: rgba(249, 115, 22, 0.9);
  animation: pulse-standby 2.5s ease-in-out infinite;
}

.shadow-standby {
  /* Neutre en mode clair */
}

.shadow-alert {
  box-shadow: 0 0 25px 4px rgba(239, 68, 68, 0.2), 0 4px 10px -3px rgba(0, 0, 0, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
  animation: pulse-border 2s infinite;
}

/* Badges indicateurs intégrés */
.indicators-container {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.heat-indicator {
font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 20px;
  background: #FFD786;
  transition: color 0.3s ease;
  color: #F40;
}
.heat-on { color: #dc2626; } /* Orange légèrement plus sombre pour le contraste sur fond clair */
.heat-off { display: none; }

.safety-indicator {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 4px 8px;
  border-radius: 20px;
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  display: none; 
  animation: pulse-text 1.5s infinite;
}

.card .label {
  max-width: 156px;
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card .value {
  font-size: 2rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--card-color);
}

.fermentation-content {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.fermentation-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 20px;
  padding: 0 8px 0 8px;
  border: 1px solid #BBD5DA;
  color: var(--card-color);
}

.fermentation-date {
  background: #D6FB61;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #303841;
}
.fermentation-date-end {
  background: #00E0BA;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #303841;
}
.fermentation-flavor {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--card-color);
}

.chart-card {
  background: var(--card-bg);
  border: none;
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  height: 60vh;
  min-height: 300px;
  max-height: 500px; 
  overflow-x: auto;
}

#chart-container {
  width: 100%;
  height: 100%;
  position: relative;
  min-width: 900px;
}

#offline-banner {
  width: 100%;
  text-align: center;
  height: 40px;
  top: 0;
  position: relative;
  padding: 5px;
  align-content: center;
  background: #FF0087;
  color: #ffffff;
  font-weight: bold;
}

#flip {
position: fixed;
  z-index: -99999;
  width: 40%;
  left: -140px;
  bottom: -110px;
  opacity: 0.02;
}


@keyframes pulse-text {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

@keyframes pulse-border {
  0% { box-shadow: 0 0 25px 4px rgba(239, 68, 68, 0.2), 0 4px 10px -3px rgba(0, 0, 0, 0.1); }
  50% { box-shadow: 0 0 12px 2px rgba(239, 68, 68, 0.05), 0 4px 10px -3px rgba(0, 0, 0, 0.1); }
  100% { box-shadow: 0 0 25px 4px rgba(239, 68, 68, 0.2), 0 4px 10px -3px rgba(0, 0, 0, 0.1); }
}

@keyframes pulse-standby {
  0%, 100% { 
    box-shadow: 0 0 15px 1px rgba(249, 115, 22, 0.15), 0 4px 10px -3px rgba(0, 0, 0, 0.1);
    border-color: rgba(249, 115, 22, 0.3);
  }
  50% { 
    box-shadow: 0 0 28px 5px rgba(249, 115, 22, 0.4), 0 4px 10px -3px rgba(0, 0, 0, 0.1);
    border-color: rgba(249, 115, 22, 0.6);
  }
}

@media (max-width: 640px) {
  h2 { font-size: 1.5rem; }
  .card { padding: 16px; }
  .card .value { font-size: 1.75rem; }
  
  .chart-card {
    padding: 12px;
    height: 50vh;
    overflow-x: auto;
  }
  #chart-container {
    min-width: 900px;
  }
  .timestamp {
    width: 100%;
  }
  #time {
    float: right;
  }
}