/* ========================================================================
   ensemble — feuille de style
   Vanilla CSS, mobile-first, sobriété visuelle.
   ======================================================================== */

:root {
  --color-bg: #fdfaf6;
  --color-surface: #ffffff;
  --color-border: #e2dcd2;
  --color-text: #2a2a2a;
  --color-text-muted: #6b6b6b;
  --color-primary: #6b4f99;
  --color-primary-hover: #5a4282;
  --color-secondary: #8ab0a9;
  --color-danger: #b14848;
  --color-warning-bg: #fff8e6;
  --color-warning-border: #f0d480;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --max-width: 720px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font);
  line-height: 1.55;
  font-size: 16px;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
}

a:hover {
  color: var(--color-primary-hover);
}

.site-header {
  padding: 1.5rem 1rem 0.5rem;
  text-align: center;
}

.site-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-primary);
}

.site-footer {
  margin-top: 3rem;
  padding: 2rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
}

.site-footer a {
  color: var(--color-text-muted);
}

.site-footer-tagline {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.app {
  padding: 1rem;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.container-chat {
  padding: 1rem;
}

.hidden {
  display: none !important;
}

/* --- Typo --- */
h2 {
  margin-top: 0;
  font-size: 1.5rem;
  color: var(--color-text);
}

h3 {
  margin-top: 1.5rem;
  font-size: 1.05rem;
}

.lead {
  font-size: 1.05rem;
  color: var(--color-text-muted);
}

.disclaimer {
  margin-top: 2rem;
  padding: 0.75rem;
  border-left: 3px solid var(--color-warning-border);
  background: var(--color-warning-bg);
  font-size: 0.875rem;
  border-radius: 4px;
}

.callout {
  padding: 0.75rem 1rem;
  background: var(--color-warning-bg);
  border-left: 3px solid var(--color-warning-border);
  border-radius: 4px;
}

/* --- Boutons --- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border 0.15s, opacity 0.15s;
  text-align: center;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: #f5efff;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn-ghost:hover:not(:disabled) {
  background: #f7f3ec;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sub {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  margin-top: 0.25rem;
  opacity: 0.9;
}

.link-button {
  background: none;
  border: none;
  color: var(--color-text-muted);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

/* --- Landing modes --- */
.modes {
  display: grid;
  gap: 0.75rem;
  margin: 2rem 0;
}

@media (min-width: 480px) {
  .modes {
    grid-template-columns: 1fr 1fr;
  }
}

.resume {
  margin: 1.5rem 0;
  padding: 1rem;
  background: #f7f3ec;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: stretch;
}

@media (min-width: 480px) {
  .resume {
    flex-direction: row;
    align-items: center;
  }
  .resume p { flex: 1; margin: 0; }
}

/* --- Consentement --- */
.consent-text {
  margin-bottom: 1.5rem;
}

.consent-text ul {
  padding-left: 1.5rem;
}

.consent-form {
  border-top: 1px solid var(--color-border);
  padding-top: 1.5rem;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 1rem;
  cursor: pointer;
  font-size: 0.95rem;
}

.checkbox input[type='checkbox'] {
  margin-top: 0.25rem;
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.consent-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.consent-links {
  font-size: 0.875rem;
  text-align: center;
  color: var(--color-text-muted);
}

.consent-links span {
  margin: 0 0.4rem;
}

/* --- Partage lien duo --- */
.share-link {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.share-link input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: monospace;
  font-size: 0.85rem;
  background: #f7f3ec;
}

.share-feedback {
  font-size: 0.875rem;
  color: var(--color-secondary);
  margin: 0.5rem 0;
}

.share-actions {
  margin-top: 1rem;
}

/* --- Chat --- */
.messages {
  margin-bottom: 1rem;
  max-height: 30vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.message {
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.message-user {
  background: #f0eaff;
  margin-left: 2rem;
}

.message-assistant {
  background: #f7f3ec;
  margin-right: 2rem;
}

.question {
  background: #f5efff;
  padding: 1rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--color-primary);
  margin-bottom: 1rem;
  font-size: 1.05rem;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.choice-btn {
  text-align: left;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.95rem;
  transition: background 0.15s, border 0.15s;
}

.choice-btn:hover:not(:disabled) {
  background: #f7f3ec;
  border-color: var(--color-primary);
}

.choice-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.open-input textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  resize: vertical;
  min-height: 4rem;
}

.reply-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.char-count {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.chat-status {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 0.5rem;
  min-height: 1.2em;
}

/* --- Bilan --- */
.bilan-banner {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.bilan-scores {
  display: grid;
  gap: 0.5rem;
  margin: 1.5rem 0;
}

.bilan-score {
  display: grid;
  grid-template-columns: 140px 1fr 2ch;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.bilan-score-bar {
  position: relative;
  height: 12px;
  background: #f0eaff;
  border-radius: 6px;
  overflow: hidden;
}

.bilan-score-bar-fill {
  position: absolute;
  inset: 0;
  background: var(--color-primary);
  border-radius: 6px;
  transform-origin: left;
}

.bilan-sections h3 {
  margin-top: 1.5rem;
  font-size: 1.1rem;
  color: var(--color-primary);
}

.bilan-section-text {
  white-space: pre-wrap;
}

.bilan-actions {
  margin-top: 2rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bilan-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* --- Urgence --- */
.emergency-list {
  padding-left: 1rem;
  font-size: 1.05rem;
}

.emergency-list li {
  margin-bottom: 0.75rem;
}

/* --- Actions générales --- */
.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}
