/* offre — feuille de style unique, mobile d'abord. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e2e5ea;
  --text: #14181f;
  --muted: #667085;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --ok: #15803d;
  --ok-bg: #dcfce7;
  --err: #b91c1c;
  --err-bg: #fee2e2;
  --warn-bg: #fef3c7;
  --warn: #92400e;
  --radius: 12px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319;
    --surface: #171c24;
    --border: #2a313c;
    --text: #e8ecf1;
    --muted: #98a2b3;
    --accent: #4f8cf7;
    --accent-text: #08101d;
    --ok: #4ade80;
    --ok-bg: #14321f;
    --err: #fca5a5;
    --err-bg: #3a1618;
    --warn-bg: #3a2f12;
    --warn: #fcd34d;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 0 calc(72px + var(--safe-bottom));
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

body.centered {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

main { max-width: 900px; margin: 0 auto; padding: 12px; }

h1 { font-size: 1.3rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-size: 0.85em; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* -- Barre supérieure ---------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.topnav { display: none; gap: 4px; flex: 1; }
.topnav a {
  padding: 6px 10px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.topnav a.active { background: var(--bg); color: var(--text); }
.logout { margin-left: auto; }

.badge {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  background: var(--accent); color: var(--accent-text);
  border-radius: 999px; font-size: 0.72rem; font-weight: 700;
}

/* -- Navigation basse (mobile) ------------------------------------------- */

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: flex;
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.bottomnav a {
  position: relative;
  flex: 1; padding: 9px 4px 11px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--muted); font-size: 0.72rem; text-decoration: none;
}
.bottomnav a.active { color: var(--accent); }
.bottomnav .ico { font-size: 1.15rem; line-height: 1; }
.bottomnav .dot {
  position: absolute; top: 7px; right: calc(50% - 16px);
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}

@media (min-width: 720px) {
  body { padding-bottom: 24px; }
  .topnav { display: flex; }
  .bottomnav { display: none; }
}

/* -- Blocs --------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin: 6px 0 12px; flex-wrap: wrap;
}
.page-actions { display: flex; gap: 8px; }

.flash {
  max-width: 900px; margin: 10px auto 0; padding: 10px 14px;
  border-radius: var(--radius); font-size: 0.9rem;
}
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-error { background: var(--err-bg); color: var(--err); }

.empty { padding: 24px 14px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.error-text { color: var(--err); }
.back { font-size: 0.9rem; }

/* -- Formulaires --------------------------------------------------------- */

label { display: block; margin-bottom: 10px; font-size: 0.88rem; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--text); }

input[type="text"], input[type="search"], input[type="password"],
input[type="number"], input[type="date"], select, textarea {
  width: 100%; margin-top: 4px; padding: 10px 11px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 9px;
  font: inherit; font-size: 16px; /* 16px évite le zoom automatique sur iOS */
}
input[type="checkbox"] { width: auto; margin: 0; }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: 9px; margin: 0 0 10px; padding: 10px 12px; }
legend { color: var(--muted); font-size: 0.85rem; padding: 0 4px; }

button, .button {
  display: inline-block; padding: 9px 14px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 500; cursor: pointer; text-align: center;
}
button:hover, .button:hover { border-color: var(--accent); text-decoration: none; }
button.primary, .button.primary {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent);
}
button.ghost { background: transparent; }
button.small, .button.small { padding: 6px 10px; font-size: 0.85rem; }
button.danger { color: var(--err); border-color: var(--err); }
button.link { background: none; border: none; color: var(--muted); padding: 4px 6px; }
form.inline { display: inline-flex; gap: 6px; align-items: center; }
form.inline.right { margin-left: auto; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

.filters { margin-bottom: 12px; }
.filters-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.filters-row > * { flex: 1 1 140px; }
.filters-row label { margin-bottom: 0; }

/* -- Offres -------------------------------------------------------------- */

.offers { list-style: none; margin: 0; padding: 0; }

.offer-head { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.offer-title { font-weight: 600; color: var(--text); flex: 1; min-width: 0; }
.offer-meta { margin: 6px 0 0; }
.offer-actions { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.score {
  flex: 0 0 auto;
  min-width: 34px; padding: 3px 0; text-align: center;
  border-radius: 8px; font-weight: 700; font-size: 0.85rem;
}
.score-high { background: var(--ok-bg); color: var(--ok); }
.score-mid { background: var(--warn-bg); color: var(--warn); }
.score-low { background: var(--bg); color: var(--muted); }

.tag {
  display: inline-block; padding: 2px 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; font-size: 0.75rem; color: var(--muted);
  white-space: nowrap;
}
.tag.new { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.tag.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.err { background: var(--err-bg); color: var(--err); border-color: transparent; }
.tag.off { background: var(--bg); color: var(--muted); }
.tag.status-postule, .tag.status-entretien { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.tag.status-accepte { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.tag.status-refuse, .tag.status-abandonne { background: var(--err-bg); color: var(--err); border-color: transparent; }

.description { white-space: pre-wrap; margin-top: 8px; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; }

/* -- Listes -------------------------------------------------------------- */

.compact, .timeline { list-style: none; margin: 0; padding: 0; }
.compact li, .timeline li {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.compact li:last-child, .timeline li:last-child { border-bottom: none; }

/* -- Connexion ----------------------------------------------------------- */

.login { width: 100%; max-width: 360px; }
.login h1 { margin-bottom: 2px; }
.login button { width: 100%; margin-top: 6px; }

/* -- Barre de recherche repliable ---------------------------------------- */

.search-row { display: flex; gap: 8px; align-items: stretch; }
.search-row input { margin-top: 0; }
.search-row button { flex: 0 0 auto; }

.more-filters { margin-top: 8px; }
.more-filters > summary {
  cursor: pointer; list-style: none;
  display: inline-block; padding: 6px 10px;
  color: var(--muted); font-size: 0.88rem;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface);
}
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters > summary::after { content: " ▾"; }
.more-filters[open] > summary::after { content: " ▴"; }
