/* ============================================================================
 * shared/components.css — Composants UI réutilisables
 * ----------------------------------------------------------------------------
 * Boutons, cards, inputs, badges. Réutilisés par toutes les pages.
 * ============================================================================
 */

/* ============================================================================
 * Boutons
 * ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

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

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 0 rgba(19,32,85,.08), 0 4px 12px -4px rgba(91,101,222,.45);
}

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

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

.btn-ghost:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.btn-link {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding: 6px 8px;
  font-weight: 600;
}

.btn-link:hover {
  color: var(--accent-hover);
  background: var(--accent-softer);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #b54040;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
  border-radius: 9px;
}

.btn-block {
  display: flex;
  width: 100%;
  justify-content: center;
}

.btn svg.i {
  width: 14px;
  height: 14px;
}

/* ============================================================================
 * Cards
 * ============================================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.card.compact {
  padding: 14px 18px;
}

/* ============================================================================
 * Inputs
 * ============================================================================ */

.input,
input.txt,
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  font-family: inherit;
  /* font-size: 16px en mobile pour éviter le zoom Safari iOS au focus
     (Safari zoom auto sur les inputs < 16px). 14px en desktop pour
     compactage. Audit responsive 20/05/2026. */
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
@media (min-width: 768px) {
  .input,
  input.txt,
  textarea,
  select { font-size: 14px; }
}

.input:focus,
input.txt:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-softer);
}

.input::placeholder,
input.txt::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 6px;
}

/* Input avec icône à gauche */
.input-wrap {
  position: relative;
}

.input-wrap .lead {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  display: inline-flex;
  pointer-events: none;
}

.input-wrap input.txt,
.input-wrap .input {
  padding-left: 40px;
}

/* ============================================================================
 * Badges / pills
 * ============================================================================ */

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

.badge.ok,
.pill.ok {
  background: var(--success-soft);
  color: #0f8a48;
}

.badge.warn,
.pill.warn {
  background: var(--warning-soft);
  color: #8a4a23;
}

.badge.info,
.pill.info {
  background: var(--accent-softer);
  color: var(--accent-ink);
}

.badge.danger {
  background: var(--danger-soft);
  color: #8a2929;
}

/* ============================================================================
 * Toast (notification temporaire)
 * ============================================================================ */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-elev);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .25s;
  z-index: 1000;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================================
 * Modal scrim + dialog
 * ============================================================================ */

.modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(19, 32, 85, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-scrim.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  max-width: 480px;
  width: 92%;
  box-shadow: var(--shadow-elev);
  max-height: 88vh;
  overflow-y: auto;
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.modal p {
  color: var(--muted);
  margin: 0 0 16px;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ============================================================================
 * Empty state
 * ============================================================================ */

.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
}

.empty b {
  color: var(--ink);
  display: block;
  font-size: 15px;
  margin-bottom: 4px;
}

/* ============================================================================
 * Privacy bar (mention "chiffré et confidentiel")
 * ============================================================================ */

.privacy-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--accent-ink);
  background: var(--accent-softer);
  border: 1px solid var(--accent-soft);
  padding: 6px 12px;
  border-radius: 999px;
}
