/* =====================================================================
   TrésoPro — Enhancements UI (additif au thème existant)
   Chargé après app.css. Ne pas modifier app.css.
   ===================================================================== */

/* ── Variables additionnelles ──────────────────────────────────────── */
:root {
  --shadow-sm: 0 1px 2px rgba(0,0,0,.18);
  --shadow-md: 0 4px 12px rgba(0,0,0,.28);
  --shadow-lg: 0 12px 28px rgba(0,0,0,.4);
  --radius: 10px;
  --accent-soft: rgba(79,124,255,.16);
  --green-soft: rgba(34,197,94,.16);
  --red-soft: rgba(239,68,68,.16);
  --orange-soft: rgba(245,158,11,.16);
}

/* ── Body : meilleure typo + scrollbar fine ────────────────────────── */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg); }
*::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 5px; }
*::-webkit-scrollbar-thumb:hover { background: var(--border); }

/* ── Focus visible plus accessible (clavier) ───────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible, .btn:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ── Cards & ombres ────────────────────────────────────────────────── */
.card {
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ── Boutons : raffinements ────────────────────────────────────────── */
.btn {
  position: relative;
  letter-spacing: .01em;
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-primary { background: linear-gradient(135deg, var(--accent), #6e92ff); }
.btn-primary:hover { background: linear-gradient(135deg, #3d6aff, var(--accent)); }
.btn-success { background: linear-gradient(135deg, var(--green), #2ed26b); }
.btn-danger:hover { background: rgba(239,68,68,.18); color: var(--red); }

/* ── Inputs : effet focus subtil ───────────────────────────────────── */
input, select, textarea {
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
input:hover, select:hover, textarea:hover { border-color: #3a4159; }
input:focus, select:focus, textarea:focus {
  box-shadow: 0 0 0 3px rgba(79,124,255,.18);
}
input[disabled] { opacity: .55; cursor: not-allowed; }

/* ── Badges : un poil plus de présence ─────────────────────────────── */
.badge { letter-spacing: .02em; }

/* ── Alertes : animation d'entrée + icône intégrée ─────────────────── */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  animation: alertIn .25s ease-out;
  box-shadow: var(--shadow-sm);
}
.alert code {
  background: rgba(0,0,0,.25); padding: 1px 6px; border-radius: 4px;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  user-select: all;
}
@keyframes alertIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Tables : zebra subtile + hover plus marqué ────────────────────── */
table tbody tr:nth-child(odd) td { background: rgba(255,255,255,.01); }
table tbody tr:hover td { background: rgba(79,124,255,.05); }
.actions-cell .btn:hover { transform: translateY(-1px); }

/* ── Recherche inline (sur les listes) ─────────────────────────────── */
.search-inline {
  position: relative; display: inline-flex; align-items: center;
}
.search-inline i {
  position: absolute; left: 10px; color: var(--muted); font-size: 12px; pointer-events: none;
}
.search-inline input {
  padding: 6px 10px 6px 30px; font-size: 12px; min-width: 240px;
  background: var(--surface2); border-radius: 8px;
}
.search-inline input:focus { min-width: 280px; }

/* ── Sidebar : sélecteur de société plus joli ──────────────────────── */
.soc-selector select {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 8px; cursor: pointer;
  transition: border-color .15s ease;
}
.soc-selector select:hover { border-color: var(--accent); }

/* ── Sidebar : item actif avec barre latérale gauche ──────────────── */
.nav-direct.active, .nav-sub a.active {
  position: relative;
}
.nav-direct.active::before, .nav-sub a.active::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); border-radius: 0 2px 2px 0;
}

/* ── Page Mon compte ───────────────────────────────────────────────── */
.account-grid {
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px;
}
.account-pwd-card { max-width: 720px; margin: 0 auto; }
.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-list > div {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 10px; border-radius: 8px; background: rgba(255,255,255,.02);
  border: 1px solid var(--border); font-size: 13px;
}
.info-list strong { color: var(--text); font-weight: 500; }
.society-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.society-list li {
  padding: 8px 12px; border-radius: 8px; background: rgba(255,255,255,.02);
  border: 1px solid var(--border); font-size: 13px; display: flex; align-items: center; gap: 8px;
}

/* ── Champs mot de passe : wrap + toggle d'affichage ──────────────── */
.pwd-wrap { position: relative; display: flex; align-items: center; }
.pwd-wrap input { padding-right: 38px; }
.pwd-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; border-radius: 6px;
  transition: color .15s ease, background .15s ease;
}
.pwd-toggle:hover { color: var(--accent); background: rgba(79,124,255,.08); }

/* Indicateur de force */
.pwd-strength { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.pwd-strength-bar {
  flex: 1; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden;
}
.pwd-strength-bar > div {
  height: 100%; width: 0; background: var(--red);
  transition: width .25s ease, background .25s ease;
  border-radius: 3px;
}
.pwd-strength-label { font-size: 11px; color: var(--muted); min-width: 70px; font-weight: 600; }
.pwd-match { font-size: 11px; margin-top: 6px; min-height: 14px; }
.pwd-match.ok { color: var(--green); }
.pwd-match.ko { color: var(--red); }

/* Règles de mot de passe */
.pwd-rules {
  margin-top: 14px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 10px; background: rgba(255,255,255,.02); font-size: 12px;
}
.pwd-rules strong { display: block; margin-bottom: 6px; color: var(--text); }
.pwd-rules ul { list-style: none; padding: 0; display: grid; gap: 4px; }
.pwd-rules li { color: var(--muted); position: relative; padding-left: 22px; }
.pwd-rules li::before {
  content: "○"; position: absolute; left: 6px; color: var(--muted);
}
.pwd-rules li.ok { color: var(--green); }
.pwd-rules li.ok::before { content: "✓"; color: var(--green); }

/* ── Responsive : compte ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .account-grid { grid-template-columns: 1fr; }
}

/* ── Spinner / état de chargement (utilitaire) ────────────────────── */
.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sélection de texte ────────────────────────────────────────────── */
::selection { background: var(--accent-soft); color: #fff; }

/* ── Liens : underline subtil au hover ─────────────────────────────── */
a.link:hover { text-decoration: underline; text-underline-offset: 2px; }

/* ── Auth card : effet subtil ─────────────────────────────────────── */
.auth-card {
  box-shadow: var(--shadow-lg);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface2) 100%);
}
.auth-card h1 {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Mobile : adaptations ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .search-inline input { min-width: 100%; }
  .search-inline { width: 100%; }
}
