/* =============================================================
   atlas-edn · chrono session — 11ème rail partagé
   ============================================================= */

/* Bouton dans la modes-bar */
.chrono-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 1.05rem;
  line-height: 1;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 8px;
  opacity: .65;
  transition: opacity .15s ease, transform .15s ease, background .15s ease;
  position: relative;
}
.chrono-toggle:hover { opacity: 1; background: rgba(0,0,0,.06); }
.chrono-toggle.is-running { opacity: 1; }
.chrono-toggle.is-running::after {
  content: "";
  position: absolute;
  top: 4px; right: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, .7);
  animation: chrono-pulse 1.8s ease-out infinite;
}
@keyframes chrono-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, .55); }
  70%  { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* Affichage permanent du temps */
.chrono-display {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  background: rgba(15, 23, 42, .92);
  color: #f8fafc;
  font: 600 13px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .03em;
  padding: 8px 12px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  cursor: pointer;
  user-select: none;
  display: none; /* affiché via JS si actif ou cumul > 0 */
  transition: transform .15s ease, background .25s ease, color .25s ease;
}
.chrono-display:hover { transform: scale(1.04); }
.chrono-display.is-running { background: rgba(22, 163, 74, .95); }
.chrono-display.is-above-avg { color: #fde047; }
.chrono-display.is-paused { background: rgba(71, 85, 105, .92); }

/* Popover détails */
.chrono-popover {
  position: fixed;
  top: 54px;
  right: 14px;
  z-index: 9999;
  width: 260px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, .12);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .14);
  padding: 14px 14px 12px;
  font: 13px/1.45 system-ui, -apple-system, sans-serif;
  color: #0f172a;
  display: none;
}
.chrono-popover.is-open { display: block; }
.chrono-popover h4 {
  margin: 0 0 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  font-weight: 700;
}
.chrono-popover .row {
  display: flex; justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(15, 23, 42, .08);
}
.chrono-popover .row:last-child { border-bottom: 0; }
.chrono-popover .row b {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.chrono-popover .badges {
  margin-top: 10px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.chrono-popover .badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
}
.chrono-popover .badge.is-unlocked {
  background: #fef3c7;
  color: #92400e;
}
.chrono-popover .actions {
  margin-top: 12px;
  display: flex; gap: 6px;
}
.chrono-popover .actions button {
  flex: 1;
  appearance: none;
  border: 1px solid rgba(15, 23, 42, .12);
  background: #f8fafc;
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: #0f172a;
}
.chrono-popover .actions button:hover { background: #e2e8f0; }
.chrono-popover .actions .danger {
  color: #b91c1c;
  border-color: rgba(185, 28, 28, .25);
}

/* Toast badge milestone (apparition fugace) */
.chrono-toast {
  position: fixed;
  top: 70px;
  right: 14px;
  z-index: 10000;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  color: #422006;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, .35);
  animation: chrono-toast-in .3s ease, chrono-toast-out .4s ease 3.6s forwards;
  pointer-events: none;
}
@keyframes chrono-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes chrono-toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-8px); }
}

/* Mode nuit */
body.dark-mode .chrono-popover {
  background: #1e293b; color: #f1f5f9;
  border-color: rgba(255,255,255,.08);
}
body.dark-mode .chrono-popover h4 { color: #94a3b8; }
body.dark-mode .chrono-popover .row { border-color: rgba(255,255,255,.08); }
body.dark-mode .chrono-popover .actions button {
  background: #334155; color: #f1f5f9;
  border-color: rgba(255,255,255,.08);
}
body.dark-mode .chrono-popover .actions button:hover { background: #475569; }
body.dark-mode .chrono-popover .badge { background: #334155; color: #94a3b8; }
body.dark-mode .chrono-popover .badge.is-unlocked { background: #78350f; color: #fde68a; }
