/* Styles de Lezgo Collect — bâtis sur les tokens du design system new_lezgo. */
body {
  margin: 0;
  font-family: var(--ds-font, "Open Sans", system-ui, sans-serif);
  color: var(--ds-ink-800, #1E293B);
  background: var(--ds-surface-2, #F6F8FB);
  -webkit-font-smoothing: antialiased;
}

/* En-tête app (logo Lezgo Collect) */
.lc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  background: var(--ds-surface, #fff);
  border-bottom: 1px solid var(--ds-line, #E9ECF1);
  position: sticky;
  top: 0;
  z-index: 10;
}
.lc-header-brand { display: flex; align-items: center; gap: 10px; }
.lc-header-logo { height: 26px; width: auto; display: block; }
.lc-header-title { font-size: 15px; font-weight: 800; color: var(--ds-ink-900, #11181F); letter-spacing: -.01em; }
.lc-header-sub { font-size: 11px; color: var(--ds-ink-500, #64748B); }
.lc-header-right { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.lc-header-space { color: var(--ds-ink-600, #475569); font-weight: 600; }
.lc-header-link { color: var(--ds-ink-500, #64748B); text-decoration: none; background: none; border: none; padding: 0; margin: 0; cursor: pointer; font: inherit; font-size: 13px; }
.lc-header-link:hover { color: var(--ds-primary-600, #E08800); }
.lc-header form { display: inline; margin: 0; }

/* Conteneur de page */
.lc-page { max-width: 720px; margin: 0 auto; padding: 24px 20px 48px; }
.lc-page-title { font-size: 20px; font-weight: 800; color: var(--ds-ink-900, #11181F); margin: 0 0 4px; letter-spacing: -.01em; }
.lc-page-lead { color: var(--ds-ink-500, #64748B); font-size: 14px; margin: 0 0 20px; }

/* Cartes */
.lc-card {
  background: var(--ds-surface, #fff);
  border: 1px solid var(--ds-line, #E9ECF1);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 8px 24px rgba(17, 24, 31, .05);
}
.lc-card + .lc-card { margin-top: 14px; }

/* Boutons */
.lc-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-sizing: border-box;
  padding: 12px 20px; font-size: 14px; font-weight: 700; font-family: inherit;
  border: none; border-radius: 12px; cursor: pointer; text-decoration: none;
}
.lc-btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--ds-primary-500, #FF9900), var(--ds-primary-600, #E08800));
  box-shadow: 0 6px 16px rgba(255, 153, 0, .30);
}
.lc-btn-primary:hover { filter: brightness(.98); }
.lc-btn-ghost { color: var(--ds-ink-600, #475569); background: var(--ds-surface, #fff); border: 1px solid var(--ds-line-strong, #E2E6EC); }
.lc-btn-block { width: 100%; }

/* Login */
.lc-login { min-height: 70vh; display: flex; align-items: center; justify-content: center; }
.lc-login-card { max-width: 420px; text-align: center; }
.lc-login-logo { height: 40px; margin-bottom: 16px; }
.lc-login-lead { color: var(--ds-ink-500, #64748B); font-size: 14px; line-height: 1.6; margin: 0 0 22px; }

/* Listes sélectionnables (espaces, programmes) */
.lc-list { display: flex; flex-direction: column; gap: 10px; }
.lc-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 18px; background: var(--ds-surface, #fff);
  border: 1px solid var(--ds-line, #E9ECF1); border-radius: 12px;
  text-decoration: none; color: inherit; cursor: pointer; transition: border-color .15s, box-shadow .15s;
  width: 100%; box-sizing: border-box; text-align: left; font: inherit;
}
.lc-list form { margin: 0; }
.lc-item:hover { border-color: var(--ds-primary-300, #F8B05F); box-shadow: 0 4px 14px rgba(255,153,0,.10); }
.lc-item-name { display: block; font-weight: 700; color: var(--ds-ink-900, #11181F); font-size: 15px; }
.lc-item-meta { display: block; font-size: 12px; color: var(--ds-ink-500, #64748B); margin-top: 2px; }
.lc-item-badge { font-size: 11px; font-weight: 700; color: var(--ds-primary-700, #B86D00); background: var(--ds-primary-50, #FFF6EC); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.lc-item-chevron { color: var(--ds-ink-300, #CBD5E1); flex-shrink: 0; }

.lc-avatar {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; color: #fff; font-size: 15px;
  background: linear-gradient(135deg, var(--ds-primary-500, #FF9900), var(--ds-primary-600, #E08800));
}
.lc-item-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* États / flash */
.lc-flash { padding: 11px 15px; border-radius: 10px; font-size: 14px; font-weight: 600; margin: 0 auto 16px; max-width: 720px; }
.lc-flash-notice { background: rgba(89,178,36,.12); color: #3F7A1E; }
.lc-flash-alert  { background: rgba(231,76,60,.10); color: #C0392B; }
.lc-empty { color: var(--ds-ink-500, #64748B); font-size: 14px; text-align: center; padding: 20px; }

/* ── Dropdown en-tête (repris à l'identique de new_lezgo) ───────────── */
.organization-info { display: flex; align-items: center; gap: 12px; border: 1px solid #D7E3ED; border-radius: 15px; padding: 8px 14px; position: relative; cursor: pointer; transition: all .2s ease; background: var(--ds-surface, #fff); }
.organization-info:hover { background-color: #F6F7F8; }
.organization-name { font-size: 14px; font-weight: 700; color: #384D64; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-avatar-initials { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: #F6F7F8; color: #586D85; border: 1px solid #D7E3ED; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.dropdown-arrow { transition: transform .2s ease; width: 12px; }
.organization-info.open .dropdown-arrow { transform: rotate(180deg); }
.dropdown-menu { position: absolute; top: calc(100% + 8px); right: 0; background: #FFFFFF; border: 1px solid #DFE5EC; border-radius: 20px; box-shadow: 0px 4px 14px rgba(0,0,0,.10); padding: 10px; min-width: 240px; z-index: 1000; opacity: 0; visibility: hidden; transform: translateY(-10px); transition: all .2s ease; }
.dropdown-menu.open { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu form { margin: 0; }
.dropdown-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 14px; cursor: pointer; transition: background-color .2s ease; text-decoration: none; color: inherit; width: 100%; box-sizing: border-box; background: none; border: none; font: inherit; text-align: left; }
.dropdown-item:hover { background-color: #F6F7F8; }
.dropdown-item-content { display: flex; align-items: center; gap: 10px; }
.dropdown-text { font-family: "Open Sans", sans-serif; font-size: 15px; font-weight: 400; color: #22364D; line-height: 1.33em; }
.dropdown-icon { width: 18px; height: 18px; flex-shrink: 0; color: #586D85; }
.lc-menu-id { padding: 6px 10px 10px; border-bottom: 1px solid #F1F3F6; margin-bottom: 6px; }
.lc-menu-id-name { font-weight: 700; color: #22364D; font-size: 14px; }
.lc-menu-id-mail { font-size: 12px; color: #64748B; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }

/* Sélecteur de langue (FR/EN), aligné sur l'app mère */
.lc-lang { position: relative; }
.lc-lang-btn { display: flex; align-items: center; gap: 6px; border: 1px solid #D7E3ED; border-radius: 15px; padding: 7px 11px; background: var(--ds-surface, #fff); color: #586D85; cursor: pointer; font: inherit; transition: background-color .2s ease; }
.lc-lang-btn:hover { background-color: #F6F7F8; }
.lc-lang-globe { color: #586D85; flex-shrink: 0; }
.lc-lang-current { font-size: 13px; font-weight: 700; color: #384D64; }
.lc-lang-menu { min-width: 170px; }
.lc-lang-option .lang-flag { font-size: 16px; line-height: 1; }
.lc-lang-option span:last-child { font-size: 14px; color: #22364D; }
.lc-lang-option.active { background-color: var(--ds-primary-50, #FFF6EC); }
.lc-lang-option.active span:last-child { font-weight: 700; color: var(--ds-primary-600, #E08800); }

/* Vignette de programme (photo ou fallback dossier, comme sur new_lezgo) */
.lc-prog-photo { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--ds-line, #E9ECF1); }
.lc-prog-photo-default { display: flex; align-items: center; justify-content: center; background: var(--ds-primary-50, #FFF6EC); border-color: var(--ds-primary-100, #FEE8CC); }
.lc-prog-photo-icon { width: 22px; height: 22px; }

/* ── Page programme (formulaires) ──────────────────────────────────── */
.lc-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ds-ink-500, #64748B); text-decoration: none; font-size: 13px; font-weight: 600; margin-bottom: 16px; }
.lc-back:hover { color: var(--ds-primary-600, #E08800); }
.lc-prog-head { display: flex; align-items: flex-start; gap: 16px; }
.lc-prog-head-photo { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; flex-shrink: 0; border: 1px solid var(--ds-line, #E9ECF1); }
.lc-prog-head-text { min-width: 0; }
.lc-prog-head-name { font-size: 19px; font-weight: 800; color: var(--ds-ink-900, #11181F); margin: 0 0 6px; letter-spacing: -.01em; }
.lc-prog-head-desc { font-size: 13.5px; line-height: 1.55; color: var(--ds-ink-500, #64748B); margin: 0 0 10px; }
.lc-consent-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: #3F7A1E; background: rgba(89,178,36,.12); padding: 4px 11px; border-radius: 999px; }
.lc-section-h { font-size: 15px; font-weight: 800; color: var(--ds-ink-900, #11181F); margin: 24px 0 12px; }
.lc-form-icon { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: var(--ds-primary-600, #E08800); background: var(--ds-primary-50, #FFF6EC); }

/* ── Boutons complémentaires + actions de section ──────────────────── */
.lc-btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.lc-section-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 12px; }

/* ── Écran de saisie (fill) ─────────────────────────────────────────── */
.lc-fill-card + .lc-fill-card { margin-top: 14px; }
.lc-fill-card-title { font-size: 15px; font-weight: 800; color: var(--ds-ink-900, #11181F); margin-bottom: 16px; }
.lc-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.lc-field { display: block; }
.lc-field.lc-field-full, .lc-field-grid .lc-field:last-child:nth-child(odd) { grid-column: auto; }
.lc-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ds-ink-600, #475569); margin-bottom: 5px; }
.lc-input { width: 100%; box-sizing: border-box; padding: 10px 13px; font-size: 14px; font-family: inherit; color: var(--ds-ink-800, #1E293B); background: #fff; border: 1px solid var(--ds-line-strong, #E2E6EC); border-radius: 10px; }
.lc-input:focus { outline: none; border-color: var(--ds-primary-500, #FF9900); box-shadow: 0 0 0 3px rgba(255,153,0,.14); }
.lc-input-sm { padding: 7px 10px; font-size: 13px; }
.lc-textarea { resize: vertical; min-height: 74px; }

.lc-question { padding: 16px 0; border-top: 1px solid var(--ds-line-soft, #F1F3F6); }
.lc-question:first-of-type { border-top: none; padding-top: 0; }
.lc-question-title { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ds-ink-900, #11181F); font-size: 14.5px; margin-bottom: 12px; }
.lc-question-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ds-primary-50, #FFF6EC); color: var(--ds-primary-700, #B86D00); font-size: 12px; font-weight: 800; flex-shrink: 0; }
.lc-radios { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.lc-radio { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--ds-ink-700, #334155); cursor: pointer; }
.lc-radio input { accent-color: var(--ds-primary-500, #FF9900); }

.lc-disagg { margin-top: 12px; padding: 12px; background: var(--ds-surface-2, #F6F8FB); border: 1px solid var(--ds-line-soft, #F1F3F6); border-radius: 10px; }
.lc-disagg-group + .lc-disagg-group { margin-top: 10px; }
.lc-disagg-name { font-size: 12px; font-weight: 700; color: var(--ds-ink-600, #475569); margin-bottom: 8px; }
.lc-disagg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.lc-disagg-cell { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ds-ink-500, #64748B); }

/* Consentement + pad signature */
.lc-consent-content { font-size: 13.5px; line-height: 1.6; color: var(--ds-ink-600, #475569); margin-bottom: 14px; }
.lc-pad-wrap { position: relative; width: 100%; height: 150px; background: #fff; border: 1px dashed var(--ds-ink-300, #CBD5E1); border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.lc-pad { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.lc-pad-hint { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 13px; color: var(--ds-ink-400, #94A3B8); pointer-events: none; }
.lc-pad-hint[hidden] { display: none; }

@media (max-width: 540px) { .lc-field-grid { grid-template-columns: 1fr; } }

/* Bandeau « Installer l'app » (PWA) */
.lc-install-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #FFF6E9;
  border-bottom: 1px solid #F5D9A8;
  color: #7A4E00;
  font-size: 13px;
}
.lc-install-text { flex: 1; line-height: 1.4; }
.lc-install-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  color: #A8834A;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.lc-install-close:hover { color: #7A4E00; }

/* Carte « Collecter hors-ligne » (télécharger un programme) */
.lc-offline {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin: 4px 0 18px;
  background: #FFF6E9;
  border: 1px solid #F5D9A8;
  border-radius: 14px;
}
.lc-offline.is-ready { background: #ECF8EC; border-color: #BBE3BB; }
.lc-offline-icon {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px;
  color: #E08800;
  background: #FFEAC7;
}
.lc-offline.is-ready .lc-offline-icon { color: #2FA84F; background: #D6F0D6; }
.lc-offline-body { flex: 1; min-width: 0; }
.lc-offline-title { font-weight: 700; font-size: 14px; color: #22364D; }
.lc-offline-title-ok { color: #2E7D33; }
.lc-offline-sub { font-size: 12.5px; color: #6B7C90; margin-top: 2px; line-height: 1.4; }
.lc-offline-refresh {
  background: none; border: none; padding: 0; margin-left: 4px;
  color: var(--ds-primary-600, #E08800); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  text-decoration: underline;
}

/* Choix (radio / case) — même aspect que le design system new_lezgo */
.lc-choice-options { display: flex; flex-direction: column; gap: 10px; max-width: 520px; }
.lc-choice-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1px solid #E8ECF1;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.lc-choice-option:hover { border-color: #FFCC80; background: #FFFDF9; }
.lc-choice-input { position: absolute; opacity: 0; width: 0; height: 0; }
.lc-choice-mark {
  position: relative;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid #CBD5E1;
  border-radius: 50%;
  transition: border-color .15s ease, background .15s ease;
}
.lc-choice-mark-check { border-radius: 6px; }
.lc-choice-mark::after { content: ""; position: absolute; opacity: 0; transition: opacity .15s ease; }
.lc-choice-mark:not(.lc-choice-mark-check)::after {
  top: 50%; left: 50%;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #FFFFFF;
  transform: translate(-50%, -50%);
}
.lc-choice-mark-check::after {
  top: 2px; left: 6px;
  width: 5px; height: 10px;
  border: solid #FFFFFF; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.lc-choice-text { font-size: 14.5px; color: #33475B; }
.lc-choice-input:checked ~ .lc-choice-mark { border-color: #FF9900; background: #FF9900; }
.lc-choice-input:checked ~ .lc-choice-mark::after { opacity: 1; }
.lc-choice-input:checked ~ .lc-choice-text { font-weight: 600; color: #1A2233; }
.lc-choice-input:focus-visible ~ .lc-choice-mark { box-shadow: 0 0 0 3px rgba(255,153,0,.2); }

/* Recherche rapide (destinataires) */
.lc-search {
  position: relative;
  margin: 4px 0 14px;
}
.lc-search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--ds-ink-400, #94A3B8);
  pointer-events: none;
}
.lc-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px 12px 40px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ds-ink-900, #11181F);
  background: var(--ds-surface, #fff);
  border: 1px solid var(--ds-line, #E9ECF1);
  border-radius: 12px;
}
.lc-search-input:focus {
  outline: none;
  border-color: var(--ds-primary-400, #FFB84D);
  box-shadow: 0 0 0 3px rgba(255,153,0,.14);
}

/* Garantit que l'attribut [hidden] masque même les éléments en display:flex
   (ex. .lc-item lors du filtrage de la recherche). */
[hidden] { display: none !important; }

/* Thème flatpickr — accent orange (design system Lezgo) */
.flatpickr-day.selected, .flatpickr-day.selected:hover,
.flatpickr-day.startRange, .flatpickr-day.endRange {
  background: #FF9900; border-color: #FF9900;
}
.flatpickr-day.today { border-color: #FF9900; }
.flatpickr-day.today:hover { background: #FF9900; border-color: #FF9900; color: #fff; }
.flatpickr-day:hover, .flatpickr-day:focus { background: #FFF6E9; border-color: #FFF6E9; }
.flatpickr-weekday { color: #8494A7; }
.flatpickr-current-month .flatpickr-monthDropdown-months, .flatpickr-current-month input.cur-year { color: #22364D; }

/* Barre de synchronisation (collectes hors-ligne en attente) */
.lc-sync-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #EAF1FC;
  border-bottom: 1px solid #C9DDF7;
  color: #23477A;
  font-size: 13px;
}
.lc-sync-text { flex: 1; line-height: 1.4; }
.lc-sync-text strong { color: #1A3C6E; }
.lc-sync-status { color: #5B7FB0; margin-left: 4px; }

/* Liste déroulante (période de collecte) — cohérent avec .lc-input */
.lc-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23384D64' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

/* État « déjà rempli » / « en attente » d'un destinataire pour la période choisie */
.lc-item.is-done .lc-item-badge { color: #2E7D33; background: #E7F6E7; }
.lc-item.is-pending .lc-item-badge { color: #A86400; background: #FFF3D6; }
.lc-item.is-done .lc-avatar, .lc-item.is-pending .lc-avatar { opacity: .75; }
