/* ═══════════════════════════════════════
   Test Discovery — Découverte libre 1 heure
═══════════════════════════════════════ */

/* ─── Page ─────────────────────────────────────────────────── */
.page-test {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 1100px;
}

/* ─── Top bar ───────────────────────────────────────────────── */
.td-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.td-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.td-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

/* ── Badge online / offline ── */
.td-online-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px 3px 6px;
  border-radius: 20px;
  white-space: nowrap;
  transition: background .3s, color .3s;
}
.td-online-badge::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .3s;
}
.td-online-badge.online {
  background: #DCFCE7; color: #16A34A;
}
.td-online-badge.online::before {
  background: #22C55E;
  animation: td-pulse 1.4s ease-in-out infinite;
}
.td-online-badge.offline {
  background: #F3F4F6; color: #6B7280;
}
.td-online-badge.offline::before {
  background: #9CA3AF;
}
.td-online-badge.waiting {
  background: #FFF7ED; color: #D97706;
}
.td-online-badge.waiting::before {
  background: #F59E0B;
  animation: td-pulse 2s ease-in-out infinite;
}

@keyframes td-pulse {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.5; transform:scale(1.35); }
}

.td-top-actions { display: flex; gap: 8px; align-items: center; }

/* ─── Bannière mode observateur ────────────────────────────── */
.td-observer-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #EFF6FF;
  border: 1.5px solid #BFDBFE;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  color: #1D4ED8;
  font-weight: 600;
}
.td-observer-banner .td-obs-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #3B82F6;
  animation: td-pulse 1.6s ease-in-out infinite;
  flex-shrink: 0;
}
.td-observer-banner .td-obs-label { flex: 1; }
.td-observer-banner .td-obs-hint {
  font-weight: 400; color: #3B82F6; font-size: 12px;
}

/* ─── Timer bar ─────────────────────────────────────────────── */
.td-timer-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  flex-wrap: wrap;
}

.td-clock {
  font-size: 42px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  min-width: 120px;
  line-height: 1;
}
.td-clock.idle    { color: var(--text-muted); }
.td-clock.running { color: var(--primary); }
.td-clock.locked  { color: #6B7280; }
.td-clock.paused  { color: #D97706; }
.td-clock.urgent  { color: #DC2626; animation: td-blink 0.9s ease-in-out infinite; }

@keyframes td-blink { 0%,100%{opacity:1} 50%{opacity:.45} }

.td-timer-status { font-size: 15px; font-weight: 700; color: var(--text); }
.td-timer-hint   { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.td-locked-badge {
  background: #FEF2F2; color: #DC2626;
  border: 1px solid #FECACA;
  padding: 6px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 700;
}

.td-chips { display: flex; gap: 8px; }
.td-chip {
  font-size: 13px; font-weight: 700;
  padding: 5px 11px; border-radius: 20px;
}
.td-chip.bug { background: #FEF2F2; color: #DC2626; }
.td-chip.ami { background: #F0FDF4; color: #16A34A; }
.td-chip.wtf { background: #FFFBEB; color: #D97706; }

/* ─── Toolbar ───────────────────────────────────────────────── */
.td-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ─── Cards grid ────────────────────────────────────────────── */
.td-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}
.td-empty-msg {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  padding: 8px 0;
}

/* ─── New card form ─────────────────────────────────────────── */
.td-new-card-form {
  width: 260px;
  background: var(--surface);
  border: 2px dashed var(--primary);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 6px;
  align-items: center;
}
.td-new-title-input {
  flex: 1;
  font-family: inherit; font-size: 14px; font-weight: 600;
  border: none; outline: none; background: none;
  color: var(--text);
  min-width: 0;
}
.td-new-title-input::placeholder { color: #C0C0C0; font-weight: 400; }
.td-new-ok {
  background: var(--primary); color: #fff; border: none;
  width: 28px; height: 28px; border-radius: 6px;
  cursor: pointer; font-size: 16px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.td-new-ok:hover { background: var(--primary-dark); }
.td-new-cancel {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 18px;
  flex-shrink: 0; line-height: 1;
}

/* ─── Card ──────────────────────────────────────────────────── */
.td-card {
  width: 260px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.td-card:hover { box-shadow: 0 4px 14px rgba(107,33,168,0.1); border-color: #D8B4FE; }
.td-card.expanded { border-color: var(--primary); }

.td-card-hd {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 11px 12px;
  cursor: pointer;
  user-select: none;
}

.td-card-title {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
  outline: none;
  line-height: 1.4;
  min-height: 18px;
  cursor: text;
}
.td-card-title[contenteditable="true"]:focus {
  text-decoration: underline;
  text-decoration-color: var(--primary);
  text-decoration-style: dashed;
  cursor: text;
}

.td-card-toggle {
  flex-shrink: 0;
  width: 26px; height: 26px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  margin-top: 0;
  line-height: 1;
  padding: 0;
}
.td-card-toggle:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.td-card.expanded .td-card-toggle { transform: rotate(90deg); background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.td-card-del {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 13px; padding: 0;
  flex-shrink: 0; margin-top: 1px;
  opacity: 0.35;
  transition: opacity 0.15s;
  line-height: 1;
}
.td-card-del:hover { opacity: 1; color: #DC2626; }

/* ─── Card body ─────────────────────────────────────────────── */
.td-card-body {
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
}

.td-section { margin-bottom: 8px; }
.td-section:last-child { margin-bottom: 0; }

.td-section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.td-section-row { display: flex; gap: 5px; align-items: flex-start; }

.td-ta {
  flex: 1;
  font-family: inherit; font-size: 12px; color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px;
  resize: none; min-height: 48px;
  background: var(--bg);
  line-height: 1.45;
  transition: border-color 0.15s;
}
.td-ta:focus { outline: none; border-color: var(--primary); background: #fff; }
.td-ta[readonly] { background: #F3F4F6; cursor: default; }
.td-ta[readonly]:focus { border-color: var(--border); background: #F3F4F6; }
.td-ta::placeholder { color: #D0D0D0; }

.td-mic {
  flex-shrink: 0;
  width: 30px; height: 30px;
  background: none; border: 1px solid var(--border);
  border-radius: 7px; cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  margin-top: 1px;
}
.td-mic:hover { border-color: var(--primary); background: var(--primary-light); }
.td-mic.active {
  background: #FEF2F2; border-color: #DC2626;
  animation: td-blink 0.7s ease-in-out infinite;
}

/* ─── Panels (nav log + stats) ──────────────────────────────── */
.td-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.td-panel-hd {
  padding: 11px 16px;
  font-size: 13px; font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

/* Nav log */
.td-nav-log {
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 42px;
}
.td-nav-entry {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px; font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
}
.td-nav-time { font-weight: 400; opacity: 0.65; font-size: 10px; }
.td-nav-empty { color: var(--text-muted); font-size: 12px; font-style: italic; }

/* Stats */
.td-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  padding: 14px 16px;
}
.td-stat { display: flex; flex-direction: column; gap: 5px; }
.td-stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.td-stat-input {
  font-family: inherit; font-size: 26px; font-weight: 900;
  color: var(--primary);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; background: var(--bg);
  width: 100%;
  transition: border-color 0.15s;
}
.td-stat-input:focus { outline: none; border-color: var(--primary); background: #fff; }
.td-stat-input[readonly] { cursor: default; background: #F3F4F6; }
.td-stat-computed {
  font-size: 26px; font-weight: 900;
  color: var(--text-muted);
  padding: 8px 0 4px;
}

/* ─── Historique des sessions ─────────────────────────────────── */
.td-hist-section {
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.td-hist-section-title {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 4px 0 6px;
}
.td-hist-item {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.td-hist-hd {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; cursor: pointer;
  user-select: none; flex-wrap: wrap;
}
.td-hist-hd:hover { background: var(--primary-light); }
.td-hist-chevron {
  font-size: 18px; color: var(--text-muted); font-weight: 700;
  transform: rotate(0deg); transition: transform 0.2s;
  display: inline-block; flex-shrink: 0;
}
.td-hist-chevron.open { transform: rotate(90deg); }
.td-hist-title {
  font-size: 14px; font-weight: 700; color: var(--text); flex: 1;
}
.td-hist-date {
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.td-hist-chips { display: flex; gap: 6px; flex-shrink: 0; }
.td-hist-body {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: #FAFAFA;
}
.td-hist-stats-row {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.td-hist-stat {
  display: flex; flex-direction: column; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 14px; min-width: 90px;
}
.td-hist-stat-label { font-size: 11px; color: var(--text-muted); }
.td-hist-stat-val { font-size: 22px; font-weight: 900; color: var(--text); }
.td-hist-cards-hd {
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 8px;
}
.td-hist-del {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 13px; padding: 2px 5px;
  flex-shrink: 0;
  opacity: 0.35;
  border-radius: 5px;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  line-height: 1;
  margin-left: 4px;
}
.td-hist-del:hover { opacity: 1; color: #DC2626; background: #FEF2F2; }

/* ─── Buttons ───────────────────────────────────────────────── */
.td-btn-start {
  background: var(--primary); color: #fff; border: none;
  padding: 10px 22px; border-radius: 9px;
  font-weight: 700; font-size: 14px; cursor: pointer;
  white-space: nowrap;
}
.td-btn-start:hover { background: var(--primary-dark); }

.td-btn-pause {
  background: #FFF7ED; color: #D97706; border: 1.5px solid #FDE68A;
  padding: 8px 16px; border-radius: 9px;
  font-weight: 700; font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
.td-btn-pause:hover { background: #FEF3C7; border-color: #D97706; }

.td-btn-resume {
  background: var(--primary); color: #fff; border: none;
  padding: 8px 16px; border-radius: 9px;
  font-weight: 700; font-size: 13px; cursor: pointer;
  white-space: nowrap;
}
.td-btn-resume:hover { background: var(--primary-dark); }

.td-btn-add {
  background: var(--primary-light); color: var(--primary);
  border: 1.5px dashed var(--primary);
  padding: 8px 14px; border-radius: 8px;
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.td-btn-add:hover { background: #DDD6FE; }

.td-btn-ghost {
  background: none; color: var(--primary);
  border: 1px solid var(--primary);
  padding: 7px 14px; border-radius: 8px;
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.td-btn-ghost:hover { background: var(--primary-light); }

.td-btn-danger {
  background: none; color: #DC2626;
  border: 1px solid #FECACA;
  padding: 7px 13px; border-radius: 8px;
  font-weight: 600; font-size: 13px; cursor: pointer;
}
.td-btn-danger:hover { background: #FEF2F2; }

/* ─── Sidebar sub-menu ──────────────────────────────────────── */
.menu-parent { position: relative; }
.menu-parent-chev {
  font-size: 13px;
  color: var(--text-muted);
  transition: transform 0.2s;
  display: inline-block;
}
.menu-parent.open .menu-parent-chev { transform: rotate(90deg); }
.menu-sub {
  padding-left: 36px !important;
  display: none;
  font-size: 13px;
}
.menu-sub.visible { display: flex; }
