/* app.css — Styles custom (complement DSFR, variables) */

/* Zoom global via variable CSS */
:root {
  --global-font-size: 100%;
}

html {
  font-size: var(--global-font-size);
}

/* --- Login screen --- */

/* Les deux ecrans sont visibles au chargement (pour que le DSFR
   initialise les onglets). app.js masque le bon ecran au boot. */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

#login-screen,
#app-screen {
  /* Eviter le flash : masque tout au chargement, app.js affiche le bon */
}

.hidden {
  display: none !important;
}

.login-card {
  max-width: 400px;
  width: 100%;
}

/* --- Layout principal --- */

.app-main {
  min-height: calc(100vh - 200px);
}

/* --- Modules : masques par defaut sauf actif --- */

.module-section {
  display: none;
}

.module-section.active {
  display: block;
}

/* --- Toast container --- */

#toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 400px;
}

.toast-alert {
  animation: toast-in 0.3s ease-out;
}

.toast-exit {
  animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

/* --- Workspace grid (Phase 1 - split panel) --- */

.ws-grid {
  display: grid;
  grid-template-columns: 0.3fr 8px 0.7fr;
  height: calc(100vh - 280px);
  min-height: 400px;
}

.ws-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: none;
}

.ws-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.ws-divider {
  width: 8px;
  cursor: col-resize;
  background: var(--border-default-grey);
  transition: background 0.15s;
}

.ws-divider:hover {
  background: var(--background-action-high-blue-france);
}

/* --- Workspace header --- */

.ws-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

/* --- Chat messages --- */

.ws-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  min-height: 0;
}

.ws-msg {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.375rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: outline 0.1s;
}

.ws-msg--user {
  background: var(--background-alt-grey);
}

.ws-msg--assistant {
  background: var(--background-contrast-info);
}

.ws-msg--selected {
  outline: 2px solid var(--border-action-high-blue-france);
}

.ws-msg__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.ws-msg__text {
  white-space: pre-wrap;
  word-break: break-word;
}

.ws-msg__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

/* --- Action selector --- */

.ws-action-selector {
  border-top: 1px solid var(--border-default-grey);
  padding: 0.5rem;
  flex-shrink: 0;
}

.ws-selector-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0;
  color: var(--text-mention-grey);
}

.ws-selector-toggle:hover {
  color: var(--text-default-grey);
}

.ws-l1-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.375rem;
  margin-top: 0.375rem;
}

.ws-l2-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.5rem;
  max-height: 8rem;
  overflow-y: auto;
}

/* --- Instruction chips --- */

.ws-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  border-top: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

/* --- Chat input --- */

.ws-input-area {
  border-top: 1px solid var(--border-default-grey);
  padding: 0.5rem;
  flex-shrink: 0;
}

.ws-send-mode {
  color: var(--text-mention-grey);
  margin-bottom: 0.25rem;
}

.ws-input-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
}

.ws-input-text {
  flex: 1;
  resize: none;
}

/* --- Right panel: content tabs --- */

.ws-content-tabs {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

.ws-toolbar {
  margin-left: auto;
  display: flex;
  gap: 0.25rem;
}

.ws-tab-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 0.75rem;
  min-height: 0;
}

/* --- Version navigation --- */

.ws-version-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

/* --- Content textarea --- */

.ws-content-text {
  flex: 1;
  resize: none;
  min-height: 200px;
}

.ws-readonly {
  opacity: 0.7;
  background: var(--background-alt-grey);
}

/* --- Diff view --- */

.ws-diff-view {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  line-height: 1.6;
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
}

.ws-diff-add {
  background: var(--background-contrast-success);
  text-decoration: none;
}

.ws-diff-del {
  background: var(--background-contrast-error);
  text-decoration: line-through;
}

/* --- Structured sections --- */

.ws-sections {
  padding: 0;
}

.ws-section ul {
  padding-left: 1.25rem;
}

/* --- Email fields --- */

.ws-email-fields {
  margin-bottom: 1rem;
}

.ws-extra-fields {
  padding: 0.25rem 0.5rem;
  border-top: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

/* --- Meeting phases : masquees par defaut --- */

.meeting-phase {
  display: none;
}

/* =============================================================================
   MODULE MEETING — Styles
   ============================================================================= */

/* --- Action cards (liste) --- */

.mtg-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.mtg-action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem 1rem;
  border: 1px solid var(--border-default-grey);
  border-radius: 0.5rem;
  background: var(--background-default-grey);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  text-align: center;
}

.mtg-action-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border-color: var(--border-action-high-blue-france);
}

.mtg-action-card__icon {
  font-size: 1.5rem;
}

.mtg-action-card--live .mtg-action-card__icon { color: var(--text-default-error); }
.mtg-action-card--prep .mtg-action-card__icon { color: var(--text-default-warning); }
.mtg-action-card--import .mtg-action-card__icon { color: var(--text-mention-grey); }

.mtg-action-card__title {
  font-weight: 700;
  font-size: 0.875rem;
}

.mtg-action-card__desc {
  font-size: 0.75rem;
  color: var(--text-mention-grey);
}

/* --- Meeting items (liste) --- */

.mtg-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.mtg-item__actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* --- Navigation meeting (retour, titre) --- */

.mtg-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-default-grey);
}

/* --- Prep layout (split chat / donnees) --- */

.mtg-prep-grid {
  display: grid;
  grid-template-columns: 0.45fr 0.55fr;
  gap: 1rem;
  height: calc(100vh - 320px);
  min-height: 400px;
}

.mtg-prep-chat {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
  overflow: hidden;
}

.mtg-prep-chat__header {
  border-bottom: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

.mtg-prep-chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  min-height: 0;
}

.mtg-prep-chat__quick {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding: 0.375rem 0.5rem;
  border-top: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

.mtg-prep-chat__input {
  border-top: 1px solid var(--border-default-grey);
  flex-shrink: 0;
}

.mtg-prep-data {
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
  overflow-y: auto;
}

/* --- Tags participants --- */

.mtg-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.mtg-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  background: var(--background-contrast-info);
  border-radius: 1rem;
  font-size: 0.75rem;
}

.mtg-tag__remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--text-mention-grey);
  font-size: 0.875rem;
  line-height: 1;
}

.mtg-tag__remove:hover {
  color: var(--text-default-error);
}

/* --- Topics list --- */

.mtg-topics {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mtg-topic {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
  font-size: 0.8125rem;
}

.mtg-topic__title {
  flex: 1;
}

.mtg-topic--addressed .mtg-topic__title {
  text-decoration: line-through;
  color: var(--text-mention-grey);
}

.mtg-topic__actions {
  display: flex;
  gap: 0.25rem;
}

.mtg-topic__actions button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.125rem;
  color: var(--text-mention-grey);
  font-size: 0.75rem;
}

.mtg-topic__actions button:hover {
  color: var(--text-default-error);
}

/* --- Chat messages (prep + review) --- */

.mtg-chat-msg {
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.mtg-chat-msg--user {
  background: var(--background-alt-grey);
}

.mtg-chat-msg--assistant {
  background: var(--background-contrast-info);
}

.mtg-chat-msg__role {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-mention-grey);
  margin-bottom: 0.125rem;
}

/* --- Review segments --- */

.mtg-segment {
  padding: 0.5rem;
  border-bottom: 1px solid var(--border-default-grey);
  font-size: 0.8125rem;
}

.mtg-segment__time {
  font-size: 0.6875rem;
  color: var(--text-mention-grey);
  font-weight: 700;
}

.mtg-segment__text {
  white-space: pre-wrap;
}

.mtg-segment--corrected {
  background: var(--background-contrast-success);
}

/* --- Review corrector --- */

.mtg-correction {
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.mtg-correction__original {
  background: var(--background-contrast-error);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
  text-decoration: line-through;
}

.mtg-correction__corrected {
  background: var(--background-contrast-success);
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}

/* --- Quick action pills --- */

.mtg-quick-action {
  font-size: 0.6875rem;
}

/* --- Responsive --- */

@media (max-width: 767px) {
  .mtg-actions-grid {
    grid-template-columns: 1fr;
  }

  .mtg-prep-grid {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    height: auto;
  }
}

/* --- Session timer dans le header --- */

.session-timer {
  font-size: 0.875rem;
  color: var(--text-mention-grey);
}

/* --- Responsive --- */

@media (max-width: 767px) {
  .ws-grid {
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr 8px 1fr;
    height: auto;
  }

  .ws-divider {
    width: 100%;
    height: 8px;
    cursor: row-resize;
  }
}

/* =============================================================================
   MEETING LIVE — Styles Phase 3
   ============================================================================= */

/* --- Badge REC animé --- */

.mtg-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  background: var(--background-flat-error);
  color: #fff;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-left: 0.5rem;
}

.mtg-rec-badge__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  animation: mtg-rec-pulse 1.2s ease-in-out infinite;
}

@keyframes mtg-rec-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* --- Controles live --- */

.mtg-live-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.mtg-live-controls__sep {
  display: inline-block;
  width: 1px;
  height: 1.5rem;
  background: var(--border-default-grey);
  margin: 0 0.25rem;
}

/* --- Body split (transcription | synthese) --- */

.mtg-live-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  height: calc(100vh - 420px);
  min-height: 300px;
}

/* --- Panneau transcription --- */

.mtg-live-transcript {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
  overflow: hidden;
}

.mtg-live-transcript__header {
  border-bottom: 1px solid var(--border-default-grey);
  flex-shrink: 0;
  background: var(--background-alt-grey);
}

.mtg-live-transcript__scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  min-height: 0;
}

/* --- Panneau synthese --- */

.mtg-live-synthesis {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
  overflow: hidden;
}

.mtg-live-synth-tabs {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.mtg-live-synth-tabs .fr-tabs__panel {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* --- Synthesis items --- */

.mtg-synthesis-item {
  border: 1px solid var(--border-default-grey);
  border-radius: 0.25rem;
  padding: 0.75rem;
}

.mtg-synthesis-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mtg-synthesis-item__text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* --- Timeline --- */

.mtg-live-timeline {
  margin-top: 0.75rem;
  padding: 0.5rem 0;
}

.mtg-timeline__bar {
  position: relative;
  height: 6px;
  background: var(--background-alt-grey);
  border-radius: 3px;
  overflow: visible;
}

.mtg-timeline__bar-fill {
  height: 100%;
  background: var(--background-action-high-blue-france);
  border-radius: 3px;
  width: 0%;
  transition: width 1s linear;
}

.mtg-timeline__markers {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;
}

.mtg-timeline__marker {
  position: absolute;
  top: -3px;
  width: 4px;
  height: 12px;
  border-radius: 2px;
  transform: translateX(-50%);
}

.mtg-timeline__marker--segment {
  background: var(--background-flat-success);
}

.mtg-timeline__marker--synthesis {
  background: var(--background-flat-warning);
}

.mtg-timeline__labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
}

/* --- Responsive live --- */

@media (max-width: 767px) {
  .mtg-live-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    height: auto;
  }

  .mtg-live-controls {
    overflow-x: auto;
    flex-wrap: nowrap;
  }
}
