/* transcripts.css — version complète */

:root {
  --purple:      #6554C0;
  --purple-dim:  rgba(101,84,192,0.10);
  --purple-dark: #5243A3;
}

/* ── Header icon ── */
.gc-header-icon--purple {
  background: var(--purple-dim);
  border: 1px solid rgba(101,84,192,0.25);
  color: var(--purple);
}

/* ══════════════════════════════════════════
   LAYOUT global
══════════════════════════════════════════ */

/* Chaîne de hauteur verrouillée — CRITIQUE pour empêcher l'extension vers le bas
   Surcharge shared.css qui a min-height:100vh sans overflow:hidden             */
html {
  height: 100%;
  overflow: hidden;
}
body {
  height: 100%;
  min-height: unset !important;   /* annule le min-height:100vh de shared.css */
  overflow: hidden;
}

/* gc-app : hauteur exacte de la fenêtre — NE PAS utiliser min-height ici */
#gc-app {
  height: 100vh !important;
  min-height: unset !important;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* tab-export : prend tout l'espace sous le header + tab-bar */
#tab-export {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;      /* permet au flex-child de réduire sous sa taille naturelle */
  overflow: hidden;
}

/* ══════════════════════════════════════════
   LAYOUT 3 COLONNES
   sidebar(280) | detail(flex) | console(300)
══════════════════════════════════════════ */
.tr-layout {
  display: flex;
  flex: 1;
  height: 100%;       /* prend toute la hauteur disponible du parent */
  min-height: 0;      /* permet la réduction flex */
  overflow: hidden;
}

/* ── Sidebar gauche (contrôles) ── */
.tr-sidebar {
  width: 280px;
  min-width: 280px;
  max-width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex-shrink: 0;
  /* Hauteur bornée — la sidebar scroll en interne, ne s'étend pas */
  height: 100%;
  min-height: 0;
}

/* ── Panneau central ── */
.tr-detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;      /* permet la réduction dans le flex parent */
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.tr-detail-header {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.tr-detail-count {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
  font-weight: 400;
}
.tr-detail-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* Liste conversations (gauche du panneau central) */
.tr-conv-list {
  width: 320px;
  min-width: 320px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface);
  flex-shrink: 0;
}
.tr-conv-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .1s;
}
.tr-conv-item:hover { background: var(--surface2); }
.tr-conv-item.active {
  background: var(--purple-dim);
  border-left: 3px solid var(--purple);
  padding-left: 11px;
}
.tr-conv-item-id {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tr-conv-item-date { font-size: 11px; color: var(--text3); margin-top: 2px; }
.tr-conv-item-badges { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.tr-badge { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.tr-badge--ok   { background: var(--green-dim); color: var(--green); }
.tr-badge--none { background: var(--surface3);  color: var(--text3); }
.tr-badge--err  { background: var(--red-dim);   color: var(--red); }

/* Vue transcript (droite du panneau central) */
.tr-transcript-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface2);
  min-width: 0;
}
.tr-transcript-info {
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tr-transcript-info-row { display: flex; gap: 14px; flex-wrap: wrap; }
.tr-info-chip {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text2); font-family: var(--mono);
}
.tr-info-chip strong { color: var(--text); }
.tr-transcript-content { flex: 1; overflow-y: auto; padding: 14px 18px; }
.tr-transcript-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--text3); font-size: 13px; text-align: center; gap: 8px;
}
.tr-transcript-empty svg { width: 32px; height: 32px; opacity: .3; }

/* Phrases */
.tr-phrase {
  display: flex; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 13px; line-height: 1.6; align-items: flex-start;
}
.tr-phrase:last-child { border-bottom: none; }
.tr-phrase-ts {
  font-family: var(--mono); font-size: 10px; color: var(--text3);
  white-space: nowrap; flex-shrink: 0; padding-top: 3px; width: 56px;
}
.tr-phrase-channel {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
  white-space: nowrap; flex-shrink: 0; height: fit-content; margin-top: 2px;
  min-width: 72px; text-align: center;
}
.tr-phrase-channel--AGENT,
.tr-phrase-channel--INTERNAL  { background: var(--blue-dim);        color: var(--blue); }
.tr-phrase-channel--CUSTOMER,
.tr-phrase-channel--EXTERNAL  { background: var(--green-dim);       color: var(--green); }
.tr-phrase-channel--IVR,
.tr-phrase-channel--ivr       { background: var(--gc-orange-dim2);  color: var(--gc-orange); }
.tr-phrase-channel--UNKNOWN,
.tr-phrase-channel--unknown   { background: var(--surface3);        color: var(--text3); }
.tr-phrase-text { flex: 1; color: var(--text); }

/* Barre de téléchargement */
.tr-transcript-dl-bar {
  padding: 8px 16px; border-top: 1px solid var(--border);
  background: var(--surface); display: flex; gap: 8px; align-items: center; flex-shrink: 0;
}
.tr-dl-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px;
  border-radius: var(--radius); background: var(--purple-dim);
  border: 1px solid rgba(101,84,192,.25); color: var(--purple);
  font-size: 11px; font-weight: 600; cursor: pointer; font-family: var(--font);
  transition: all .15s;
}
.tr-dl-btn svg { width: 11px; height: 11px; }
.tr-dl-btn:hover { background: var(--purple); color: #fff; }

/* ── Console droite ── */
.tr-console-panel {
  width: 300px;
  min-width: 300px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;      /* permet la réduction dans le flex parent */
  background: var(--surface);
  transition: width .25s ease, min-width .25s ease, max-width .25s ease;
  overflow: hidden;
}
.tr-console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
  gap: 6px;
  /* Quand la console est réduite (40px), le header devient vertical */
  min-width: 0;
  overflow: hidden;
}
.tr-ch-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}
.tr-ch-left span { white-space: nowrap; }
.tr-ch-left button {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 8px;
  font-size: 10px;
  color: var(--text3);
  cursor: pointer;
  font-family: var(--font);
  transition: all .15s;
  white-space: nowrap;
}
.tr-ch-left button:hover { border-color: var(--gc-orange); color: var(--gc-orange); }

/* Bouton toggle — toujours visible, même quand console réduite */
#btn-toggle-console {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--purple-dim);
  border: 1.5px solid rgba(101,84,192,0.3);
  border-radius: var(--radius);
  color: var(--purple);
  cursor: pointer;
  transition: all .15s;
  padding: 0;
}
#btn-toggle-console svg {
  width: 12px;
  height: 12px;
  transition: transform .25s ease;
  flex-shrink: 0;
}
#btn-toggle-console:hover {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

/* Quand la console est réduite : header en colonne, bouton centré */
.tr-console-panel--collapsed .tr-console-header {
  flex-direction: column;
  padding: 10px 6px;
  justify-content: flex-start;
  gap: 10px;
}
.tr-console-panel--collapsed #btn-toggle-console {
  width: 28px;
  height: 28px;
}
.tr-console {
  flex: 1;
  min-height: 0;      /* critical : permet à overflow-y de fonctionner dans un flex */
  overflow-y: auto;
  padding: 10px 12px;
  font-family: var(--mono); font-size: 11px; line-height: 1.65;
  background: #F7F9FC;
}
.tr-log { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 1px; }
.tr-log-ts { color: var(--text3); white-space: nowrap; flex-shrink: 0; font-size: 10px; padding-top: 1px; }
.tr-log-msg { flex: 1; word-break: break-all; }
.tr-log--info    .tr-log-msg { color: var(--text2); }
.tr-log--success .tr-log-msg { color: var(--green); }
.tr-log--warning .tr-log-msg { color: #8a5500; }
.tr-log--error   .tr-log-msg { color: var(--red); }

/* ══════════════════════════════════════════
   SIDEBAR — Contrôles
══════════════════════════════════════════ */
.tr-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  overflow: hidden;
}
.tr-card-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; color: var(--text3);
}
.tr-field { display: flex; flex-direction: column; gap: 4px; }
.tr-field label { font-size: 11px; font-weight: 600; color: var(--text2); }
.tr-field .gc-input { font-size: 12px; padding: 7px 9px; }
.tr-field--row { flex-direction: row; align-items: center; justify-content: space-between; }
.tr-field--row label { flex: 1; font-size: 11px; color: var(--text2); min-width: 0; }
.tr-hint { font-size: 10px; color: var(--text3); line-height: 1.5; margin-top: -3px; }

/* Spinbox workers */
.tr-spin-wrap {
  display: flex; align-items: center;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  overflow: hidden; flex-shrink: 0;
}
.tr-spin-wrap button {
  width: 24px; height: 26px; background: var(--surface); border: none;
  color: var(--text2); font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: var(--font); transition: background .1s;
}
.tr-spin-wrap button:hover { background: var(--gc-orange-dim); color: var(--gc-orange); }
.tr-spin-wrap span {
  width: 28px; text-align: center; font-size: 13px; font-weight: 700;
  font-family: var(--mono); color: var(--text); background: var(--surface2); line-height: 26px;
}

/* Radio format */
.tr-radio-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text2); cursor: pointer;
}
.tr-radio-label input { accent-color: var(--purple); }

/* Boutons action */
.tr-actions { display: flex; gap: 7px; }
.tr-actions .gc-btn-primary {
  flex: 1; font-size: 12px; padding: 9px 10px;
  background: var(--purple);
  box-shadow: 0 2px 6px rgba(101,84,192,.28);
  min-width: 0;
}
.tr-actions .gc-btn-primary:hover:not(:disabled) { background: var(--purple-dark); }

.tr-btn-stop {
  display: flex; align-items: center; gap: 5px; padding: 9px 11px;
  background: var(--red-dim); border: 1.5px solid rgba(222,53,11,.3);
  border-radius: var(--radius); color: var(--red);
  font-family: var(--font); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .15s; white-space: nowrap; flex-shrink: 0;
}
.tr-btn-stop svg { width: 12px; height: 12px; }
.tr-btn-stop:disabled { opacity: .4; cursor: not-allowed; }
.tr-btn-stop:not(:disabled):hover { background: var(--red); color: #fff; border-color: var(--red); }

/* Progress card — no overflow */
.tr-progress-card {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 9px;
  min-width: 0; overflow: hidden;
}
.tr-progress-label {
  font-size: 11px; color: var(--text2); font-family: var(--mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tr-progress-track { height: 5px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.tr-progress-bar   { height: 100%; background: var(--purple); border-radius: 3px; transition: width .3s; }

/* Stats 2×2 */
.tr-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; min-width: 0; }
.tr-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 7px 6px; text-align: center; display: flex; flex-direction: column; gap: 2px;
  min-width: 0; overflow: hidden;
}
.tr-stat span {
  font-size: 20px; font-weight: 800; font-family: var(--mono);
  color: var(--text); letter-spacing: -1px;
}
.tr-stat small {
  font-size: 8px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Bouton télécharger ZIP */
.tr-btn-download {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 9px; background: var(--green); border: none;
  border-radius: var(--radius); color: #fff;
  font-family: var(--font); font-size: 12px; font-weight: 700;
  cursor: pointer; transition: all .15s; box-shadow: 0 2px 6px rgba(0,166,81,.28);
}
.tr-btn-download svg { width: 13px; height: 13px; }
.tr-btn-download:hover { filter: brightness(1.08); }

/* ══════════════════════════════════════════
   ULTRAWIDE — 3440×1440 et au-delà
══════════════════════════════════════════ */
@media (min-width: 2200px) {
  .tr-sidebar       { width: 320px; min-width: 320px; max-width: 320px; }
  .tr-conv-list     { width: 400px; min-width: 400px; }
  .tr-console-panel { width: 380px; min-width: 380px; max-width: 380px; }
  .tr-phrase        { font-size: 14px; }
  .tr-phrase-ts     { font-size: 11px; }
  .tr-phrase-channel { font-size: 11px; min-width: 80px; }
}
@media (min-width: 3000px) {
  .tr-sidebar       { width: 360px; min-width: 360px; max-width: 360px; }
  .tr-conv-list     { width: 480px; min-width: 480px; }
  .tr-console-panel { width: 420px; min-width: 420px; max-width: 420px; }
}

/* Responsive mobile */
@media (max-width: 768px) {
  .tr-layout        { flex-direction: column; }
  .tr-sidebar       { width: 100%; min-width: unset; max-width: unset; height: auto; max-height: 50vh; }
  .tr-detail-body   { flex-direction: column; }
  .tr-conv-list     { width: 100%; min-width: unset; border-right: none; border-bottom: 1px solid var(--border); max-height: 200px; }
  .tr-console-panel { width: 100%; min-width: unset; max-width: unset; }
}

/* ── Timezone selector ── */
.gc-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238C96AA' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px !important;
  cursor: pointer;
}
.tr-tz-utc {
  font-size: 9px;
  font-family: var(--mono);
  font-weight: 400;
  color: var(--text3);
  margin-left: 4px;
}
