/* =====================================================================
   UEMF — Components
   ===================================================================== */

/* ===== Carte ===== */
.glass-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.glass-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--gold-400));
  opacity: 0.9;
}
.glass-card + .glass-card { margin-top: 1.25rem; }

/* ===== Alertes ===== */
.glass-alert {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
}
.glass-alert.alert-danger  { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: var(--danger-bg); color: var(--danger); }
.glass-alert.alert-warning { border-color: color-mix(in srgb, var(--warning) 40%, var(--border)); background: var(--warning-bg); }
.glass-alert.alert-success { border-color: var(--border-brand); background: var(--success-bg); }

/* ===== Boutons ===== */
.btn-cta {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  border: none;
  border-radius: var(--r-md);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.78rem 1.6rem;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(14, 124, 74, 0.28);
  transition: transform var(--t-fast), box-shadow var(--t-fast), opacity var(--t-fast);
}
.btn-cta:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(14, 124, 74, 0.38); color: #fff; }
.btn-cta:active:not(:disabled) { transform: translateY(0); }
.btn-cta:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text-soft);
  font-weight: 600;
  padding: 0.78rem 1.4rem;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-hover); color: var(--text); border-color: var(--border-brand); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-advanced-toggle {
  background: none;
  border: none;
  color: var(--text-brand);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.35rem 0;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.btn-advanced-toggle:hover { text-decoration: underline; }

/* ===== Champs ===== */
.form-control,
.form-select {
  background-color: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: var(--r-md);
  min-height: 52px;
  font-size: 0.95rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus,
.form-select:focus {
  background-color: var(--surface);
  border-color: var(--brand-500);
  color: var(--text);
  box-shadow: 0 0 0 4px var(--ring);
  outline: none;
}
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-bg);
}

.form-label {
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Floating labels */
.form-floating > label { color: var(--text-muted); }
.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label {
  color: var(--text-brand);
  opacity: 1;
}

/* Flèche du select : TOUTES les sous-propriétés (sinon répétition) */
.form-select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394A3B8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 15px 11px;
  padding-right: 2.5rem;
  appearance: none;
  -webkit-appearance: none;
}
.form-select:focus {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2316A34A' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
.form-select option { background: var(--surface); color: var(--text); }

/* ===== Champ lecture seule ===== */
.readonly-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold-400);
  border-radius: var(--r-md);
  padding: 0.78rem 0.9rem;
  color: var(--text-soft);
  min-height: 52px;
  font-size: 0.95rem;
}
.readonly-field i { color: var(--gold-500); font-size: 0.8rem; flex-shrink: 0; }
.readonly-field span { overflow: hidden; text-overflow: ellipsis; }

/* ===== Titre de section ===== */
.section-title {
  font-size: 1.08rem;
  font-weight: 700;
  margin-bottom: 1.4rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.section-title i {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  border-radius: var(--r-sm);
  color: var(--brand-500);
  font-size: 0.95rem;
  flex-shrink: 0;
}

.divider { border: none; border-top: 1px solid var(--border); margin: 1.4rem 0; }

/* ===== Switches ===== */
.switch-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
@media (min-width: 576px) { .switch-grid { grid-template-columns: repeat(4, 1fr); } }
.switch-tile {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  user-select: none;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.switch-tile:hover { border-color: var(--border-strong); }
.switch-tile:has(.switch-input:checked) { border-color: var(--brand-500); background: var(--brand-soft); color: var(--text); }
.switch-input { display: none; }
.switch-slider {
  width: 38px; height: 22px;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  position: relative;
  flex-shrink: 0;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.switch-slider::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: var(--text-muted);
  border-radius: 50%;
  top: 2px; left: 2px;
  transition: transform var(--t-fast), background var(--t-fast);
}
.switch-input:checked + .switch-slider { background: var(--brand-500); border-color: var(--brand-500); }
.switch-input:checked + .switch-slider::after { transform: translateX(16px); background: #fff; }

/* ===== Résultats de recherche ===== */
.results-grid { display: flex; flex-direction: column; gap: 0.6rem; }
.result-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: transform var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.result-card:hover { transform: translateY(-2px); border-color: var(--border-brand); box-shadow: var(--shadow-md); color: var(--text); }
.result-avatar {
  width: 44px; height: 44px;
  border-radius: var(--r-full);
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-600), var(--brand-400));
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
}
.result-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.result-info strong { font-size: 0.98rem; }
.result-info span { font-size: 0.8rem; color: var(--text-muted); }

/* ===== Documents ===== */
.doc-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--brand-soft);
  color: var(--text-brand);
  border: 1px solid var(--border-brand);
  border-radius: var(--r-full);
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}
.doc-category { margin-bottom: 1.4rem; }
.doc-category-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  margin: 0 0 0.7rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.doc-category-title::before { content: ''; width: 6px; height: 16px; border-radius: 3px; background: var(--gold-400); }
.doc-tiles { display: grid; gap: 0.55rem; }
.doc-tile {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--text-soft);
  font-size: 0.92rem;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.doc-tile:hover { border-color: var(--border-strong); }
.doc-tile .doc-checkbox { display: none; }
.doc-tile-icon {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: all var(--t-fast);
}
.doc-tile.selected { border-color: var(--brand-500); background: var(--brand-soft); color: var(--text); }
.doc-tile.selected .doc-tile-icon { background: var(--brand-500); color: #fff; }
.doc-tile-hidden { display: none !important; }

/* ===== Pills (type de tuteur) ===== */
.pill-radio-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill-radio {
  position: relative;
  padding: 0.6rem 1.2rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-soft);
  transition: all var(--t-fast);
}
.pill-radio input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.pill-radio:hover { border-color: var(--border-brand); }
.pill-radio.active,
.pill-radio:has(input:checked) { background: var(--brand-500); border-color: var(--brand-500); color: #fff; }

/* ===== Filtres avancés ===== */
.advanced-filters {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-mid);
}
.advanced-filters > * { overflow: hidden; }
.advanced-filters.show { grid-template-rows: 1fr; }

/* ===== Récapitulatif ===== */
.recap-list {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 0.6rem 1rem;
  margin: 0;
}
.recap-list dt { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; }
.recap-list dd { margin: 0; color: var(--text); font-weight: 600; }

/* ===== Utilitaires ===== */
.text-accent { color: var(--text-brand) !important; }
.text-muted { color: var(--text-muted) !important; }
