/* ============================================================
   Simulateur de calcul des heures · bac a sable pour valider les
   regles de paie (assets/time-rules.js) sans creer de vrais punchs.
   Tokens du design system uniquement.
   ============================================================ */

/* ===== Entete ===== */
.sim-head {
  display: flex; align-items: flex-start; gap: var(--space-base);
  margin-bottom: var(--space-lg);
}
.sim-back {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; flex-shrink: 0;
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
  background: var(--canvas);
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}
.sim-back:hover { background: var(--surface-soft); border-color: var(--ink); }
.sim-back svg { width: 16px; height: 16px; }
.sim-head-main { flex: 1; min-width: 0; }
.sim-head-main h1 {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 400; letter-spacing: -0.5px;
  color: var(--ink); margin: 0 0 4px;
}
.sim-head-main p {
  font-size: 13px; color: var(--muted); margin: 0; line-height: 1.5;
  max-width: 620px;
}
.sim-reset {
  flex-shrink: 0;
  height: 36px; padding: 0 14px;
  background: var(--canvas); color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  font-family: var(--font-body); font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sim-reset:hover { background: var(--surface-soft); border-color: var(--ink); }

/* ===== Carte des regles ===== */
.sim-rules {
  background: var(--surface-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--r-lg);
  padding: var(--space-base) var(--space-lg);
  margin-bottom: var(--space-lg);
}
.sim-rules-title {
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: var(--space-xs);
}
.sim-rules ul { margin: 0; padding-left: 18px; }
.sim-rules li {
  font-size: 13px; color: var(--body); line-height: 1.6;
  margin-bottom: 4px;
}
.sim-rules li:last-child { margin-bottom: 0; }
.sim-rules strong { color: var(--ink); }

/* ===== Grille des jours ===== */
.sim-days {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-base);
  margin-bottom: var(--space-lg);
}

.sim-day {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: var(--space-base);
  display: flex; flex-direction: column; gap: var(--space-sm);
}
/* Jour sans punch valide · attenue pour que l'oeil aille aux jours actifs */
.sim-day.is-empty { background: var(--surface-soft); }

.sim-day-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-sm);
}
.sim-day-name {
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.sim-day-total {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 15px; font-weight: 600; color: var(--ink);
}
.sim-day.is-empty .sim-day-total { color: var(--muted-soft); }

/* ===== Lignes de punch ===== */
.sim-punches { display: flex; flex-direction: column; gap: 6px; }
.sim-punch {
  display: flex; align-items: center; gap: 6px;
}
.sim-punch input[type="time"] {
  flex: 1; min-width: 0;
  height: 34px; padding: 0 8px;
  border: 1px solid var(--hairline);
  background: var(--input-bg);
  border-radius: var(--r-sm);
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 13px; color: var(--ink);
  outline: none;
}
.sim-punch input[type="time"]:focus { border-color: var(--primary); }
.sim-punch-arrow { color: var(--muted-soft); font-size: 12px; flex-shrink: 0; }
.sim-punch-dur {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 12px; color: var(--muted);
  min-width: 46px; text-align: right; flex-shrink: 0;
}
.sim-punch-dur.is-bad { color: var(--semantic-down); font-weight: 600; }
.sim-punch-del {
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--canvas); color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.sim-punch-del:hover { color: var(--semantic-down); border-color: var(--semantic-down); }
.sim-punch-del svg { width: 12px; height: 12px; }

.sim-add-punch {
  align-self: flex-start;
  height: 30px; padding: 0 10px;
  background: transparent; color: var(--primary);
  border: 1px dashed var(--hairline);
  border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.sim-add-punch:hover { border-color: var(--primary); background: var(--primary-soft); }

/* ===== Cases pause / diner ===== */
.sim-flags {
  display: flex; flex-direction: column; gap: 4px;
  padding-top: var(--space-xs);
  border-top: 1px solid var(--hairline-soft);
}
.sim-flags-hint {
  font-size: 10px; color: var(--muted-soft);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.sim-flag {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--body);
  cursor: pointer;
}
.sim-flag input { width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }

/* ===== Bloc explication ===== */
.sim-explain {
  background: var(--surface-soft);
  border-radius: var(--r-md);
  padding: var(--space-sm);
  display: flex; flex-direction: column; gap: 3px;
}
.sim-day.is-empty .sim-explain { background: var(--canvas); }
.sim-line {
  font-size: 12px; line-height: 1.5; color: var(--body);
  display: flex; gap: 6px;
}
.sim-line-dot { color: var(--muted-soft); flex-shrink: 0; }
.sim-line.k-muted  { color: var(--muted); }
.sim-line.k-minus  { color: var(--semantic-down); font-weight: 600; }
.sim-line.k-plus   { color: var(--semantic-up); font-weight: 600; }
.sim-line.k-warn   { color: var(--accent-yellow); font-weight: 600; }
.sim-line.k-total {
  color: var(--ink); font-weight: 700;
  border-top: 1px solid var(--hairline);
  margin-top: 4px; padding-top: 5px;
}
.sim-line .num {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
}

/* ===== Total semaine ===== */
.sim-week {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-base);
  background: var(--ink); color: var(--canvas);
  border-radius: var(--r-lg);
  padding: var(--space-base) var(--space-lg);
  margin-bottom: var(--space-lg);
}
.sim-week-label { font-size: 14px; font-weight: 600; }
.sim-week-value {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  font-size: 24px; font-weight: 600;
}

/* ===== Apercu du rapport ===== */
.sim-preview {
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.sim-preview-head {
  padding: var(--space-base) var(--space-lg);
  border-bottom: 1px solid var(--hairline-soft);
}
.sim-preview-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.sim-preview-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
/* Scroll horizontal propre sur mobile · le tableau ne casse pas la page */
.sim-preview-body { padding: var(--space-lg); overflow-x: auto; }

.sim-rp {
  width: 100%; border-collapse: collapse;
  font-size: 12px; min-width: 620px;
}
.sim-rp th {
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  text-align: center; padding: 6px 4px;
  border-bottom: 1px solid var(--hairline);
}
.sim-rp th.c-addr { text-align: left; }
.sim-rp td {
  padding: 7px 4px; text-align: center;
  border-bottom: 1px solid var(--hairline-soft);
  font-family: var(--font-mono); font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.sim-rp td.c-addr {
  text-align: left; font-family: var(--font-body); font-weight: 500;
}
.sim-rp td.c-lbl {
  text-align: left; font-family: var(--font-body);
  font-size: 10px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.sim-rp .cell-empty { color: var(--muted-soft); }
.sim-rp tr.rp-total td {
  font-weight: 700; background: var(--surface-soft);
  border-top: 1px solid var(--hairline);
}
.sim-rp tr.rp-info td { border-bottom: none; padding: 4px; }
.sim-rp .rp-plus  { color: var(--semantic-up); font-weight: 700; }
.sim-rp .rp-minus { color: var(--semantic-down); font-weight: 700; }
.sim-rp .rp-note {
  font-size: 9px; color: var(--muted-soft);
  font-family: var(--font-body); font-weight: 400;
}

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .sim-days { grid-template-columns: 1fr; }
  .sim-head { flex-wrap: wrap; }
  .sim-head-main h1 { font-size: 22px; }
  .sim-week-value { font-size: 20px; }
}
