/* ============================================================
   OCTEO — Interview Platform
   Fonts : Instrument Sans (display) · DM Sans (body)
   Sections : [interview] [login] [admin]
============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700&display=swap');

/* ------------------------------------------------------------
   TOKENS
------------------------------------------------------------ */
:root {
  /* Brand */
  --octeo-blue:      #1f3d66;
  --octeo-blue-dark: #173154;
  --octeo-blue-ink:  #0d1f38;
  --octeo-orange:    #ff9f1c;
  --octeo-green:     #22c069;
  --octeo-cyan:      #2fb1c7;

  /* Surfaces */
  --bg-page:   #efecea;
  --bg-card:   #ffffff;

  /* Text */
  --text-primary: #18243a;
  --text-muted:   #68748a;
  --text-hint:    #9ca5b3;

  /* Borders */
  --border:       #e2e6ef;
  --border-hover: #c5cde0;

  /* Typography */
  --font-display: 'Instrument Sans', sans-serif;
  --font-body:    'DM Sans', sans-serif;

  /* Elevations */
  --shadow-xs: 0 1px 2px rgba(18,36,60,.05);
  --shadow-sm: 0 2px 8px rgba(18,36,60,.07), 0 1px 3px rgba(18,36,60,.04);
  --shadow-md: 0 6px 24px rgba(18,36,60,.10), 0 2px 6px rgba(18,36,60,.05);
  --shadow-lg: 0 20px 60px rgba(18,36,60,.14), 0 6px 18px rgba(18,36,60,.07);

  /* Radius */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;

  /* Transitions */
  --t-fast:   150ms ease;
  --t-base:   250ms ease;
  --t-spring: 350ms cubic-bezier(.4,0,.2,1);

  /* Legacy compat (used by login/admin) */
  --octeo-light:  #f5f7fb;
  --octeo-text:   #333333;
  --octeo-muted:  #6f7785;
  --octeo-border: #dde4ee;
  --white:        #ffffff;
  --danger:       #c94040;
}

/* ------------------------------------------------------------
   RESET + BASE
------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  background: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ------------------------------------------------------------
   PAGE SHELL
------------------------------------------------------------ */
.page-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   APP HEADER
============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(0,0,0,.04);

  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  height: 64px;
}

.header-logo {
  flex-shrink: 0;
  height: 34px;
  display: flex;
  align-items: center;
}

.header-logo img {
  height: 100%;
  width: auto;
  display: block;
}

.header-sep {
  width: 1px;
  height: 26px;
  background: var(--border);
  flex-shrink: 0;
}

.header-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.header-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--octeo-orange);
  line-height: 1;
}

.app-header h1 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: var(--octeo-blue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.header-greeting {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.header-greeting strong {
  color: var(--text-primary);
  font-weight: 600;
}

.header-logout {
  display: inline-flex;
  align-items: center;
  color: var(--octeo-blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  white-space: nowrap;
  transition: all var(--t-fast);
}

.header-logout:hover {
  background: var(--octeo-blue);
  color: white;
  border-color: var(--octeo-blue);
}

.header-switch-contrat {
  color: #2fb1c7;
  border-color: #2fb1c7;
}

.header-switch-contrat:hover {
  background: #2fb1c7;
  border-color: #2fb1c7;
}

/* ============================================================
   INTERVIEW LAYOUT
============================================================ */
.interview-layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 24px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 28px 56px;
  align-items: start;
}

/* ============================================================
   INTERVIEW STAGE (left)
============================================================ */
.interview-stage {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============================================================
   AVATAR CONTAINER
============================================================ */
#avatar-container {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow:
    0 32px 80px rgba(13,31,56,.22),
    0 8px 24px rgba(13,31,56,.10);
}

/* Accent line at bottom — lights up when session active */
#avatar-container::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--octeo-orange), var(--octeo-cyan) 65%, transparent);
  opacity: 0;
  z-index: 30;
  transition: opacity var(--t-base);
  pointer-events: none;
}

#avatar-container.session-active::after {
  opacity: 1;
}

/* ============================================================
   LIVEKIT STAGE
============================================================ */
#livekit-stage {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(148deg, #0d1f38 0%, #162d4a 55%, #0e2438 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

/* Ambient light on empty state */
#livekit-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 45% at 22% 65%, rgba(47,177,199,.08) 0%, transparent 60%),
    radial-gradient(ellipse 45% 40% at 78% 28%, rgba(255,159,28,.06) 0%, transparent 60%);
  pointer-events: none;
}

.avatar-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ============================================================
   INTRO MESSAGE (placeholder avant démarrage)
============================================================ */
#avatar-placeholder.intro-message {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 52px 40px;
  max-width: 560px;
}

.intro-message h2 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 16px;
  letter-spacing: -.015em;
  line-height: 1.1;
}

.intro-message p {
  font-size: 1rem;
  color: rgba(255,255,255,.6);
  line-height: 1.72;
  margin: 0;
}

/* ============================================================
   OVERLAYS SUR VIDÉO
============================================================ */

/* Score — top right */
.score-overlay {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 25;

  display: flex;
  align-items: center;
  gap: 8px;

  background: rgba(13,31,56,.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-sm);
  padding: 8px 14px;

  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.45);
}

.score-overlay::before {
  content: "Score";
  font-size: 10px;
  font-weight: 600;
  opacity: .65;
  letter-spacing: .1em;
}

.score-overlay #score-total {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: #4ade80;
  letter-spacing: -.01em;
  line-height: 1;
  text-shadow: 0 0 16px rgba(74,222,128,.55);
}

.score-overlay small {
  font-size: 11px;
  font-weight: 400;
  color: rgba(255,255,255,.4);
  text-transform: lowercase;
  letter-spacing: 0;
  align-self: flex-end;
  padding-bottom: 2px;
}

/* Countdown — bottom left */
.session-countdown {
  position: absolute;
  bottom: 18px;
  left: 18px;
  z-index: 25;

  display: flex;
  align-items: center;
  gap: 8px;

  background: rgba(13,31,56,.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--r-sm);
  padding: 8px 14px;

  font-size: 13px;
  font-weight: 500;
  color: rgba(255,255,255,.75);
}

.session-countdown strong {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: .04em;
}

.session-countdown.warning {
  border-color: rgba(255,159,28,.45);
  color: #fbbf24;
}

.session-countdown.danger {
  border-color: rgba(239,68,68,.45);
  color: #f87171;
  animation: countdownPulse .8s infinite alternate;
}

/* Feedback score toast (via scoring.js) */
#livekit-stage #feedback-score {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(18px);
  z-index: 100;

  width: max-content;
  max-width: min(82%, 620px);
  min-width: 260px;

  padding: 12px 22px;
  border-radius: 14px;

  background: rgba(34,192,105,.93);
  color: #ffffff;

  font-weight: 600;
  font-size: .93rem;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  overflow-wrap: break-word;

  opacity: 0;
  pointer-events: none;

  backdrop-filter: blur(8px);
  box-shadow: 0 12px 32px rgba(0,0,0,.28);
}

#livekit-stage #feedback-score.visible {
  animation: scoreFloatUp 3.5s ease-out forwards;
}

/* ============================================================
   STATUS BAR
============================================================ */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  color: var(--text-muted);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-base);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c4cdd8;
  flex-shrink: 0;
  transition: background var(--t-base), box-shadow var(--t-base);
}

.status-dot.user-turn {
  background: var(--octeo-green);
  box-shadow: 0 0 0 3px rgba(34,192,105,.22);
  animation: pulse-dot 1.4s ease-in-out infinite;
}

/* ============================================================
   CONTROLS
============================================================ */
.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.session-limit-notice {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 8px;
  color: #664d03;
  font-size: 0.9rem;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.controls-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.controls-message {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  border: 0;
  border-radius: var(--r-sm);
  padding: 12px 18px;

  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-align: center;

  cursor: pointer;
  transition: all var(--t-fast);
}

.btn:focus-visible {
  outline: 2px solid var(--octeo-cyan);
  outline-offset: 3px;
}

.btn:disabled {
  opacity: .4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary — bleu OCTEO */
.btn-primary {
  background: var(--octeo-blue);
  color: white;
  box-shadow: 0 3px 12px rgba(31,61,102,.28), 0 1px 3px rgba(31,61,102,.18);
}

.btn-primary:hover:not(:disabled) {
  background: var(--octeo-blue-dark);
  box-shadow: 0 5px 18px rgba(31,61,102,.36), 0 2px 6px rgba(31,61,102,.16);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(31,61,102,.22);
}

/* Secondary — micro (ghost vert) */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--octeo-green);
  color: var(--octeo-green);
  background: rgba(34,192,105,.06);
  transform: translateY(-1px);
}

.btn-secondary.user-turn {
  background: var(--octeo-green);
  color: white;
  border-color: var(--octeo-green);
  box-shadow: 0 4px 14px rgba(34,192,105,.4);
  animation: pulse-mic 1.5s ease-out infinite;
}

/* Danger — terminer */
.btn-danger {
  background: var(--bg-card);
  color: var(--danger);
  border: 1px solid rgba(201,64,64,.22);
  box-shadow: var(--shadow-xs);
}

.btn-danger:hover:not(:disabled) {
  background: #fff3f3;
  border-color: rgba(201,64,64,.38);
  transform: translateY(-1px);
}

/* Outline — envoyer */
.btn-outline {
  background: transparent;
  color: var(--octeo-blue);
  border: 1px solid var(--octeo-blue);
  align-self: flex-end;
}

.btn-outline:hover:not(:disabled) {
  background: var(--octeo-blue);
  color: white;
  transform: translateY(-1px);
}

/* ============================================================
   TEXTAREA
============================================================ */
textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-card);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}

textarea:focus {
  outline: none;
  border-color: var(--octeo-cyan);
  box-shadow: 0 0 0 3px rgba(47,177,199,.14);
}

textarea::placeholder {
  color: var(--text-hint);
}

/* ============================================================
   PANNEAU SCORE DÉTAIL
============================================================ */
.score-detail-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.notion-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.notion-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.notion-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--octeo-blue);
}

.notion-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.notion-track {
  height: 5px;
  background: #e8edf5;
  border-radius: 999px;
  overflow: hidden;
}

.notion-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--octeo-cyan), var(--octeo-green));
  border-radius: 999px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
  min-width: 0;
}

/* ============================================================
   HELP PANEL (right column)
============================================================ */
.help-panel {
  position: sticky;
  top: 92px;
}

.info-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--octeo-blue);
  border-radius: var(--r-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-md);
}

.info-card h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--octeo-blue);
  margin: 0 0 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
  line-height: 1.2;
}

.step {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.step span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--octeo-orange);
  color: white;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}

.step p {
  margin: 5px 0 0;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
}

.step p strong {
  color: var(--text-primary);
  font-weight: 600;
}

.note {
  margin-top: 20px;
  padding: 13px 15px;
  border-radius: 4px 10px 10px 4px;
  border-left: 3px solid var(--octeo-cyan);
  background: rgba(47,177,199,.07);
  font-size: 13px;
  color: var(--octeo-blue-dark);
  line-height: 1.55;
}

/* ============================================================
   SESSION ENDED MESSAGE (affiché dans #livekit-stage)
============================================================ */
.session-ended-message {
  text-align: center;
  padding: 32px 32px 24px;
}

.session-ended-message h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-weight: 800;
  color: white;
  margin: 0 0 10px;
}

.session-ended-message p {
  color: rgba(255,255,255,.72);
  font-size: .98rem;
  line-height: 1.6;
  margin: 0 0 14px;
}

.session-ended-message strong {
  color: white;
  font-size: 1.1rem;
}

.score-resume {
  font-size: 1rem;
  color: rgba(255,255,255,.7);
  margin: 14px 0 18px;
}

/* ============================================================
   SCORE CIRCLES (écran de fin)
============================================================ */
.scores-circles-container {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 24px;
  justify-content: center;
  align-items: flex-start;
}

.score-circle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.circle-inner {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.circle-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.circle-bg {
  fill: none;
  stroke: rgba(255,255,255,.12);
  stroke-width: 6;
}

.circle-progress {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
  transition: stroke-dashoffset .7s cubic-bezier(.4,0,.2,1);
}

.circle-text {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.circle-percent {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.circle-label {
  font-size: 11px;
  color: rgba(255,255,255,.6);
  text-align: center;
  max-width: 90px;
  word-break: break-word;
  line-height: 1.3;
  margin-top: 6px;
}

/* ============================================================
   QUEUE MESSAGE
============================================================ */
.queue-message {
  margin: 12px 0;
  padding: 14px 18px;
  border-radius: var(--r-sm);
  background: #fff9ed;
  border: 1px solid rgba(255,159,28,.3);
  color: #7a4a00;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 4px 14px rgba(255,165,0,.1);
}

.queue-message strong {
  display: block;
  margin-bottom: 4px;
  color: #c47700;
  font-weight: 700;
}

.queue-message.hidden { display: none !important; }

/* ============================================================
   DEBUG
============================================================ */
#debug {
  margin: 16px 28px;
  background: var(--octeo-blue-ink);
  color: #7fffd4;
  padding: 14px 18px;
  border-radius: var(--r-sm);
  white-space: pre-wrap;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  min-height: 44px;
}

/* ============================================================
   TRANSCRIPT
============================================================ */
.transcript-list {
  max-width: 100%;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.transcript-item {
  max-width: 76%;
  padding: 12px 16px;
  border-radius: 16px;
  line-height: 1.5;
  font-size: 13.5px;
  box-shadow: var(--shadow-xs);
}

.transcript-avatar {
  align-self: flex-start;
  background: #f3f5f8;
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.transcript-user {
  align-self: flex-end;
  background: var(--octeo-blue);
  color: white;
  border-bottom-right-radius: 4px;
}

.transcript-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  opacity: .8;
}

.transcript-meta span {
  white-space: nowrap;
  font-weight: 400;
}

.transcript-text {
  font-size: 13.5px;
}

.transcript-user .transcript-meta  { color: rgba(255,255,255,.88); }
.transcript-avatar .transcript-meta { color: var(--text-muted); }

@media (max-width: 700px) {
  .transcript-item { max-width: 90%; }
  .transcript-meta { flex-direction: column; gap: 2px; }
}

/* ============================================================
   DEBRIEF MANAGER
============================================================ */

.debrief-card {
  margin-top: 24px;
  border-left: 4px solid var(--octeo-blue);
}

.debrief-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--octeo-blue);
  margin-bottom: 14px;
}

.debrief-content {
  line-height: 1.75;
  color: var(--text-primary);
  font-size: 0.94rem;
}

.debrief-content p {
  margin: 0 0 12px;
}

.debrief-content p:last-child {
  margin-bottom: 0;
}

.debrief-content strong {
  color: #1f3d66;
  font-weight: 700;
}

.debrief-content u {
  text-decoration: underline;
  text-decoration-color: #ff9f1c;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.debrief-unavailable {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Vue utilisateur (index.php) */
.debrief-user-panel {
  margin-top: 16px;
}

.debrief-loading {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 4px 0;
}

/* ============================================================
   UTILITIES
============================================================ */
.hidden { display: none !important; }

/* ============================================================
   ANIMATIONS
============================================================ */
@keyframes pulse-dot {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%       { transform: scale(1.7); opacity: .5; }
}

@keyframes pulse-mic {
  0%   { box-shadow: 0 0 0 0    rgba(34,192,105,.7), 0 4px 14px rgba(34,192,105,.4); }
  70%  { box-shadow: 0 0 0 12px rgba(34,192,105,0),  0 4px 14px rgba(34,192,105,.4); }
  100% { box-shadow: 0 0 0 0    rgba(34,192,105,0),  0 4px 14px rgba(34,192,105,.4); }
}

@keyframes countdownPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.03); }
}

@keyframes scoreFloatUp {
  0%   { opacity: 0; transform: translateX(-50%) translateY(20px); }
  15%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  70%  { opacity: 1; transform: translateX(-50%) translateY(-12px); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-28px); }
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1080px) {
  .interview-layout {
    grid-template-columns: 1fr;
    padding: 20px 20px 48px;
  }

  .help-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 0 16px;
    height: 56px;
    gap: 12px;
  }

  .header-sep,
  .header-eyebrow {
    display: none;
  }

  .app-header h1 {
    font-size: 12.5px;
  }

  .interview-layout {
    padding: 14px 14px 36px;
    gap: 14px;
  }

  .controls-actions {
    grid-template-columns: 1fr 1fr;
  }

  .controls-actions #stop-avatar {
    grid-column: 1 / -1;
  }

  .info-card {
    padding: 20px 18px;
    border-radius: var(--r-md);
  }

  #avatar-placeholder.intro-message {
    padding: 32px 20px;
  }

  .intro-message h2 { font-size: 1.35rem; }
  .intro-message p  { font-size: .9rem; }

  .score-overlay {
    top: 12px;
    right: 12px;
    padding: 6px 10px;
  }

  .session-countdown {
    bottom: 12px;
    left: 12px;
    padding: 6px 10px;
  }
}


/* ============================================================
   MODAL D'INTRODUCTION
============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(13, 31, 56, 0.68);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  animation: modalFadeIn .18s ease;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  max-width: 520px;
  width: 100%;
  overflow: hidden;
}

.modal-close-x {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-hint);
  line-height: 1;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  transition: color var(--t-fast), background var(--t-fast);
}

.modal-close-x:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, .06);
}

.modal-header {
  padding: 32px 32px 0;
}

.modal-eyebrow {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--octeo-orange);
  margin-bottom: 10px;
  line-height: 1;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 800;
  color: var(--octeo-blue);
  margin: 0;
  line-height: 1.15;
  letter-spacing: -.018em;
}

.modal-body {
  padding: 18px 32px 28px;
}

.modal-body p {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.72;
  margin: 0;
}

.modal-footer {
  padding: 0 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-limit-notice {
  padding: 12px 14px;
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: var(--r-sm);
  color: #664d03;
  font-size: 0.88rem;
  margin: 0;
  line-height: 1.5;
}

.modal-footer .btn {
  width: 100%;
  padding: 14px;
  font-size: 14px;
}

@media (max-width: 640px) {
  .modal-card    { border-radius: var(--r-lg); }
  .modal-header  { padding: 24px 22px 0; }
  .modal-body    { padding: 14px 22px 22px; }
  .modal-footer  { padding: 0 22px 24px; }
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PAGE LOGIN
============================================================ */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.login-card {
  width: min(100%, 440px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 180px;
  margin: 0 auto 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.login-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.login-brand .eyebrow,
.login-brand .header-eyebrow {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.login-intro {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.5;
  font-size: 0.93rem;
}

.login-alert {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(184,74,74,.3);
  background: rgba(184,74,74,.08);
  color: #8a2a2a;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}

.login-form {
  display: grid;
  gap: 16px;
}

.form-group {
  display: grid;
  gap: 6px;
}

.form-group label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.form-group input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 14.5px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: #fafbfc;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.form-group input:focus {
  outline: none;
  border-color: var(--octeo-cyan);
  box-shadow: 0 0 0 3px rgba(47,177,199,.15);
}

.login-submit {
  width: 100%;
  margin-top: 6px;
  padding: 13px 18px;
  font-size: 15px;
}

.login-footer {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-footer a {
  color: var(--octeo-blue);
  font-weight: 600;
  text-decoration: none;
}

.login-footer a:hover { color: var(--octeo-orange); }

.register-success {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  border: 1px solid rgba(34,192,105,.3);
  background: rgba(34,192,105,.08);
  color: #1a7a48;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
}

@media (max-width: 480px) {
  .login-card { padding: 24px 20px; border-radius: var(--r-lg); }
  .login-logo  { width: 150px; }
}


/* ============================================================
   ADMIN
============================================================ */

.admin-page {
  background: var(--bg-page);
}

.admin-main {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 28px 64px;
}

/* Admin nav inside app-header */
.admin-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  padding: 0 12px;
}

.admin-nav a {
  padding: 5px 11px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--t-base), color var(--t-base);
}

.admin-nav a:hover {
  background: rgba(31,61,102,.08);
  color: var(--octeo-blue);
}

.admin-page .header-info { flex: none; }

/* Hamburger toggle — masqué par défaut (desktop) */
.admin-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  transition: background var(--t-base);
}
.admin-nav-toggle:hover { background: rgba(31,61,102,.06); }
.admin-nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--octeo-blue);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease;
  transform-origin: center;
}
.admin-nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.admin-nav-toggle.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.admin-nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Content card */
.admin-container {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 32px 36px;
  color: var(--text-primary);
}

.admin-card {
  background: #f7f8fb;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
}

.admin-card h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.admin-card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 10px;
}

/* Titles */
.admin-container h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.admin-container h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 28px 0 16px;
}

/* Paragraphs */
.admin-container p {
  margin-bottom: 14px;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.55;
}

.admin-container a,
.admin-container a:visited {
  color: var(--octeo-blue);
  font-weight: 600;
  text-decoration: none;
}

.admin-container a:hover { color: var(--octeo-orange); }

/* Tables */
.admin-container table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 13.5px;
}

.admin-container th {
  background: var(--octeo-blue);
  color: white;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .04em;
  padding: 11px 14px;
  text-align: left;
  border: none;
}

.admin-container th:first-child { border-radius: var(--r-sm) 0 0 0; }
.admin-container th:last-child  { border-radius: 0 var(--r-sm) 0 0; }

.admin-container td {
  padding: 11px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-primary);
}

.admin-container tbody tr:last-child td { border-bottom: none; }
.admin-container tbody tr:hover td     { background: #f6f8fb; }

.admin-container td small {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* Forms */
.admin-container label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
}

.admin-container input[type="text"],
.admin-container input[type="email"],
.admin-container input[type="password"],
.admin-container input[type="number"],
.admin-container select,
.admin-container textarea {
  width: 100%;
  max-width: 640px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-family: var(--font-body);
  color: var(--text-primary);
  background: #fafbfc;
  box-sizing: border-box;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}

.admin-container input[type="checkbox"] {
  width: auto;
  max-width: none;
  accent-color: var(--octeo-blue);
}

.admin-container input:focus,
.admin-container select:focus,
.admin-container textarea:focus {
  outline: none;
  border-color: var(--octeo-cyan);
  box-shadow: 0 0 0 3px rgba(47,177,199,.15);
}

.admin-container textarea { resize: vertical; }

.admin-container button {
  padding: 9px 20px;
  background: var(--octeo-blue);
  color: white;
  border: none;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background var(--t-base), color var(--t-base);
}

.admin-container button[type="button"] {
  background: #f1f3f7;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.admin-container button:hover             { background: var(--octeo-blue-dark); color: white; }
.admin-container button[type="button"]:hover { background: #e2e8f0; color: var(--text-primary); }

.admin-container small { color: var(--text-muted); font-size: 12.5px; }

.admin-container hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

@media (max-width: 960px) {
  .admin-main      { padding: 20px 16px 48px; }
  .admin-container { padding: 20px 18px; border-radius: var(--r-lg); }

  /* Hamburger visible, nav cachée inline */
  .admin-nav-toggle { display: flex; }

  .admin-nav {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 3px;
    padding: 10px 20px 16px;
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,.10);
    z-index: 199;
  }

  .admin-nav.admin-nav--open { display: flex; }

  .admin-nav a {
    padding: 10px 14px;
    font-size: 15px;
  }
}

@media (max-width: 640px) {
  /* Ajustement dropdown sous header réduit */
  .admin-nav { top: 56px; }

  /* Prénom masqué sur très petit écran, lien "Site" reste visible */
  .header-greeting { display: none; }
}

/* ── Admin toolbar (titre + bouton action) ────────────────── */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-toolbar h1 {
  margin: 0;
  padding: 0;
  border: none;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.admin-toolbar .admin-back {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.admin-toolbar .admin-back:hover { color: var(--octeo-blue); }

/* ── Bouton action (+ Ajouter) ────────────────────────────── */
.btn-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  background: var(--octeo-blue);
  color: white !important;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none !important;
  transition: background var(--t-base);
  white-space: nowrap;
}

.btn-add:hover { background: var(--octeo-blue-dark) !important; color: white !important; }

/* ── Messages d'alerte dans l'admin ───────────────────────── */
.admin-alert {
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 20px;
  border-left: 3px solid;
  line-height: 1.5;
}

.admin-alert--error   { background: #fde8e8; color: #c0392b; border-color: #c0392b; }
.admin-alert--success { background: #e6f7df; color: #3a8a28; border-color: #5fbd45; }
.admin-alert--info    { background: #e8f4fb; color: #1a6a8a; border-color: #2fb1c7; }

/* ── Badges statut / rôle dans les tableaux admin ─────────── */
.admin-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-badge--active   { background: #e6f7df; color: #3a8a28; }
.admin-badge--inactive { background: #f1f3f7; color: #6f7785; }
.admin-badge--admin    { background: #fff3e0; color: #b36b00; }
.admin-badge--user     { background: #e8eef7; color: #1f3d66; }
.admin-badge--synced   { background: #e8f7fb; color: #1a7a8a; }
.admin-badge--unsynced { background: #fde8e8; color: #c0392b; }

/* ── Tableau responsive (scroll horizontal) ───────────────── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  margin-top: 8px;
}

.table-responsive .admin-container table,
.table-responsive table {
  margin-top: 0;
}

/* ── Score pill coloré ────────────────────────────────────── */
.score-pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: white;
}

@media (max-width: 640px) {
  .admin-toolbar h1 { font-size: 1.25rem; }
  .btn-add          { font-size: 13px; padding: 8px 14px; }
}
