/* =========================================
   Palette Enedis
   #1423DC  Bleu Enedis  (primary)
   #232873  Bleu foncé   (dark / header)
   #2382D2  Bleu moyen   (links / focus)
   #96CD32  Vert Enedis  (success / active)
   #41A57D  Vert foncé
   #4BC3C3  Turquoise
   #FFC328  Jaune solaire (warning)
   #EB6E3C  Orange       (danger)
   #AF2891  Prune
   #8755C8  Violet
   #C8AF87  Taupe
   #000000  Noir
   ========================================= */

/* =========================================
   Reset & base
   ========================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #1a1a2e;
  background: #eef1f8;
}

a { color: #1423DC; text-decoration: none; }
a:hover { text-decoration: underline; color: #2382D2; }

/* =========================================
   Layout
   ========================================= */
.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* =========================================
   Header
   ========================================= */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #232873;
  color: #fff;
  padding: 0 1.5rem;
  height: 56px;
  border-bottom: 3px solid #1423DC;
}

.header-brand {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-brand::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  background: #96CD32;
  border-radius: 50%;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-nav a {
  color: #b8c4e8;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}
.header-nav a:hover { color: #fff; text-decoration: none; }

.header-user {
  color: #7b8fd4;
  font-size: 0.85rem;
  padding-right: 0.75rem;
  border-right: 1px solid #3d4a8a;
}

.logout-form { display: inline; }
.logout-form button {
  background: none;
  border: 1px solid #3d4a8a;
  color: #b8c4e8;
  padding: 0.3rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s, color 0.15s;
}
.logout-form button:hover {
  background: #1423DC;
  border-color: #1423DC;
  color: #fff;
}

/* =========================================
   Footer
   ========================================= */
.site-footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.78rem;
  color: #7b8fd4;
  border-top: 1px solid #d0d8ef;
  margin-top: 2.5rem;
  background: #fff;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.5rem 1.25rem;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  transition: filter 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn:active { filter: brightness(0.95); }

.btn-primary   { background: #1423DC; color: #fff; }
.btn-secondary { background: #e4e9f7; color: #232873; }
.btn-secondary:hover { background: #d0d8ef; }
.btn-danger    { background: #EB6E3C; color: #fff; }
.btn-warning   { background: #FFC328; color: #232873; }
.btn-success   { background: #96CD32; color: #232873; }
.btn-full      { display: flex; width: 100%; }
.btn-sm        { padding: 0.3rem 0.85rem; font-size: 0.82rem; }

/* =========================================
   Alerts
   ========================================= */
.alert {
  padding: 0.85rem 1.1rem;
  border-radius: 6px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  border-left: 4px solid;
}
.alert-error   {
  background: #fdf0eb;
  color: #8b3a1a;
  border-color: #EB6E3C;
}
.alert-success {
  background: #f2fae0;
  color: #3a5a10;
  border-color: #96CD32;
}

/* =========================================
   Forms
   ========================================= */
.form-group {
  margin-bottom: 1.1rem;
}
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  color: #232873;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1.5px solid #c5cde8;
  border-radius: 5px;
  font-size: 0.93rem;
  background: #fff;
  color: #1a1a2e;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group textarea { min-height: 100px; resize: vertical; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #1423DC;
  box-shadow: 0 0 0 3px rgba(20, 35, 220, 0.12);
}

/* =========================================
   Login page
   ========================================= */
.login-page {
  background: linear-gradient(135deg, #232873 0%, #1423DC 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-container {
  background: #fff;
  padding: 2.5rem 2.25rem;
  border-radius: 10px;
  width: 100%;
  max-width: 390px;
  box-shadow: 0 8px 32px rgba(20, 35, 220, 0.25);
}
.login-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  color: #232873;
  margin-bottom: 0.2rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.login-subtitle {
  text-align: center;
  font-size: 0.82rem;
  color: #7b8fd4;
  margin-bottom: 1.75rem;
}
.login-form { margin-top: 0.5rem; }

/* =========================================
   Error pages
   ========================================= */
.error-page {
  text-align: center;
  padding: 4rem 1rem;
}
.error-page h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
  color: #232873;
}
.error-page p  { color: #7b8fd4; margin-bottom: 1.5rem; }

/* =========================================
   Page header et titre générique
   ========================================= */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.page-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: #232873;
}

/* =========================================
   Liste des arbres (agent)
   ========================================= */
.tree-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.tree-card {
  background: #fff;
  border: 1.5px solid #d0d8ef;
  border-left: 4px solid #1423DC;
  border-radius: 7px;
  padding: 1.1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: box-shadow 0.15s;
}
.tree-card:hover { box-shadow: 0 2px 12px rgba(20, 35, 220, 0.1); }
.tree-card-body { flex: 1; }
.tree-card-title { font-size: 1.05rem; font-weight: 700; color: #232873; margin-bottom: 0.2rem; }
.tree-card-desc  { font-size: 0.88rem; color: #7b8fd4; }
.empty-state { color: #7b8fd4; font-style: italic; }

/* =========================================
   Navigation dans un arbre
   ========================================= */
.navigate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.navigate-tree-title {
  font-size: 0.9rem;
  color: #7b8fd4;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.node-card {
  background: #fff;
  border: 1.5px solid #d0d8ef;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.node-card--leaf {
  border-left: 5px solid #96CD32;
  background: linear-gradient(to right, #f6fbee, #fff 60px);
}
.node-question {
  font-size: 1.18rem;
  font-weight: 700;
  color: #232873;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}
.node-explanation {
  background: #eef6ff;
  border-left: 3px solid #2382D2;
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
  color: #2a4a7a;
  margin-top: 0.75rem;
}

.choices-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.choice-btn {
  background: #fff;
  border: 2px solid #1423DC;
  color: #1423DC;
  border-radius: 7px;
  padding: 0.85rem 1.25rem;
  font-size: 0.97rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s;
}
.choice-btn:hover {
  background: #1423DC;
  color: #fff;
  transform: translateX(3px);
}
.choice-btn:disabled,
.choice-btn--loading { opacity: 0.5; cursor: wait; transform: none; }

/* =========================================
   Récapitulatif
   ========================================= */
.summary {
  background: #fff;
  border: 1.5px solid #d0d8ef;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.summary-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: #232873;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.summary-step {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem;
  font-size: 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #eef1f8;
}
.summary-step:last-child { border-bottom: none; }
.summary-step-label {
  font-weight: 700;
  color: #232873;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.summary-step-q { color: #7b8fd4; }
.summary-step-a {
  color: #41A57D;
  font-weight: 600;
}

.navigate-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* =========================================
   Éditeur — commun
   ========================================= */
.inline-form { display: inline; }

/* Tableau de données */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1.5px solid #d0d8ef;
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.9rem;
}
.data-table thead { background: #232873; }
.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.82rem;
  color: #b8c4e8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-bottom: none;
}
.data-table td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #eef1f8;
  vertical-align: middle;
  color: #1a1a2e;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f5f7fd; }
.text-center { text-align: center; }
.table-desc {
  display: block;
  font-size: 0.8rem;
  color: #7b8fd4;
  margin-top: 0.15rem;
  font-weight: 400;
}
.table-actions {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  flex-wrap: wrap;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: #e4e9f7;
  color: #232873;
}
.badge--active   { background: #eaf6c8; color: #3a5a10; }
.badge--inactive { background: #fdf0eb; color: #8b3a1a; }
.badge--root     { background: #e0e8ff; color: #1423DC; }
.badge--leaf     { background: #eaf6c8; color: #3a5a10; }
.badge--manager  { background: #ede0ff; color: #5b1a9e; }
.badge--agent    { background: #e0f5f5; color: #1a5e5e; }
.badge--self     { background: #fff4d0; color: #7a4e00; font-size: 0.68rem; }

/* =========================================
   Éditeur — formulaires
   ========================================= */
.editor-form { max-width: 740px; }

.form-fieldset {
  border: 1.5px solid #d0d8ef;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  background: #fff;
}
.form-fieldset legend {
  font-weight: 700;
  font-size: 0.9rem;
  padding: 0 0.5rem;
  color: #232873;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fieldset-hint {
  font-size: 0.84rem;
  color: #7b8fd4;
  margin-bottom: 1rem;
}

.form-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: #232873;
  font-weight: 500;
}
.checkbox-label input { margin-top: 0.2rem; accent-color: #1423DC; }
.checkbox-label small { color: #7b8fd4; display: block; font-weight: 400; }

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}
.required { color: #EB6E3C; }

.section-title { font-size: 1.05rem; font-weight: 700; color: #232873; }
.node-section  { margin-top: 2.5rem; }

/* Choix dans le formulaire de nœud */
.choice-row {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: #f5f7fd;
  border: 1.5px solid #d0d8ef;
  border-radius: 6px;
  margin-bottom: 0.65rem;
}
.choice-row-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.choice-row .form-group { margin-bottom: 0; }

/* =========================================
   Gestion des utilisateurs
   ========================================= */
.input-disabled {
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 1.5px solid #e4e9f7;
  border-radius: 5px;
  font-size: 0.93rem;
  background: #f5f7fd;
  color: #7b8fd4;
  cursor: not-allowed;
}
.input-hint {
  display: block;
  font-size: 0.8rem;
  color: #7b8fd4;
  margin-top: 0.35rem;
}
