/* Com'Bleymard — UI “village-friendly” (clair par défaut) */

:root{
  --bg: #f7f3ea;
  --bg2: #efe6d7;
  --card: rgba(255,255,255,0.78);
  --text: #1c232b;
  --muted: rgba(28,35,43,0.65);
  --border: rgba(28,35,43,0.12);
  --shadow: 0 12px 30px rgba(0,0,0,0.10);

  --primary: #2b6cb0;
  --primary2: #1f5a92;

  --ok: #2f855a;
  --danger: #c53030;

  --chip: rgba(255,255,255,0.65);
}

html[data-theme="dark"]{
  --bg: #0b1220;
  --bg2: #0f1a2e;
  --card: rgba(255,255,255,0.06);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.60);
  --border: rgba(255,255,255,0.12);
  --shadow: 0 18px 40px rgba(0,0,0,0.45);

  --primary: #63b3ed;
  --primary2: #3ea0e6;

  --chip: rgba(255,255,255,0.08);
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: radial-gradient(1200px 600px at 15% 0%, var(--bg2), transparent 60%),
              radial-gradient(900px 500px at 85% 10%, rgba(43,108,176,0.20), transparent 60%),
              var(--bg);
  color: var(--text);
}

a{ color: inherit; text-decoration: none; }

.wrap{ max-width: 980px; margin: 0 auto; padding: 18px; }

.topbar{
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(255,255,255,0.55);
  border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .topbar{ background: rgba(11,18,32,0.55); }

.topbar-inner{ display:flex; align-items:center; justify-content: space-between; gap: 14px; }

.brand{ display:flex; align-items:center; gap: 10px; font-weight: 800; }
.brand-mark{ font-size: 26px; }
.brand-name{ letter-spacing: .2px; }

.topnav{ display:flex; align-items:center; gap: 10px; flex-wrap: wrap; }
.topnav a{ padding: 8px 10px; border-radius: 10px; color: var(--muted); }
.topnav a.active{ background: var(--chip); color: var(--text); border:1px solid var(--border); }

.btn{
  display:inline-flex; align-items:center; justify-content:center;
  border: 1px solid var(--border);
  background: var(--chip);
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}
.btn.small{ padding: 8px 10px; border-radius: 10px; }
.btn.big{ padding: 12px 16px; border-radius: 14px; font-size: 1.02rem; }
.btn.primary{ background: linear-gradient(135deg, var(--primary), var(--primary2)); color: white; border-color: transparent; }
.btn.ghost{ background: transparent; box-shadow: none; }
.btn.ok{ background: rgba(47,133,90,0.15); border-color: rgba(47,133,90,0.35); }
.btn.danger{ background: rgba(197,48,48,0.14); border-color: rgba(197,48,48,0.35); }
.btn:hover{ transform: translateY(-1px); }
.btn:active{ transform: translateY(0px); }

.userchip{
  display:flex; align-items:center; gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--border);
}
.userchip .dot{ width:10px; height:10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(47,133,90,0.18); }

.card{
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

h1,h2,h3{ margin: 0 0 10px 0; }
.lead{ margin: 0 0 14px 0; color: var(--muted); font-size: 1.05rem; line-height: 1.4; }
.muted{ color: var(--muted); }

.form label{ display:block; margin: 12px 0 6px; font-weight: 800; }
.form input, .form textarea, .form select{
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.60);
  color: var(--text);
}
html[data-theme="dark"] .form input,
html[data-theme="dark"] .form textarea,
html[data-theme="dark"] .form select{
  background: rgba(255,255,255,0.06);
}
.form textarea{ resize: vertical; }

.row{ display:flex; gap:12px; align-items:center; }
.between{ justify-content: space-between; }
.link{ color: var(--primary); font-weight: 900; }

.divider{ height: 1px; background: var(--border); margin: 14px 0; }

.flashes{ display:grid; gap: 10px; margin: 10px 0 16px; }
.flash{
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--chip);
  font-weight: 700;
}
.flash.ok{ border-color: rgba(47,133,90,0.35); background: rgba(47,133,90,0.12); }
.flash.error{ border-color: rgba(197,48,48,0.35); background: rgba(197,48,48,0.12); }
.flash.info{ border-color: rgba(43,108,176,0.35); background: rgba(43,108,176,0.12); }

.hero{ display:flex; align-items:flex-end; justify-content: space-between; gap: 14px; margin: 12px 0 16px; }
.hero-actions{ flex: 0 0 420px; display:grid; gap: 10px; }
@media (max-width: 820px){
  .hero{ flex-direction: column; align-items: stretch; }
  .hero-actions{ width: 100%; flex: 1; }
}

.searchbar{
  display:flex; gap:10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}
.searchbar input{
  border: none;
  background: transparent;
  outline: none;
  padding: 10px 10px;
  border-radius: 12px;
}
.searchbar input:focus{ outline: 2px solid rgba(43,108,176,0.25); }

.chips{ display:flex; gap: 8px; flex-wrap: wrap; }

/* Tabs (Mes annonces) */
.tabs{ display:flex; align-items:center; gap: 10px; flex-wrap: wrap; }
.tab{
  display:inline-flex; align-items:center; gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--text);
  font-weight: 900;
}
.tab .tab-emoji{ font-size: 1.05rem; }
.tab .tab-count{
  display:inline-flex; min-width: 22px; height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  align-items:center; justify-content:center;
  background: rgba(0,0,0,0.08);
  border: 1px solid var(--border);
  font-weight: 900;
  font-size: .85rem;
}
html[data-theme="dark"] .tab .tab-count{ background: rgba(255,255,255,0.08); }
.tab.active{ background: var(--card); box-shadow: 0 10px 22px rgba(0,0,0,0.10); }

/* Mes annonces list */
.my-list{ display:grid; gap: 12px; }
.my-item{ padding: 16px; }
.my-item-main{ display:flex; gap: 12px; }
.my-item-icon{
  width: 56px; height: 56px;
  border-radius: 16px;
  display:flex; align-items:center; justify-content:center;
  font-size: 30px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
html[data-theme="dark"] .my-item-icon{ background: rgba(255,255,255,0.05); }
.my-item-body{ flex: 1; min-width: 0; }
.my-item-title{ margin: 6px 0 6px 0; }
.my-item-title a{ color: var(--text); text-decoration: none; }
.my-item-actions{ display:flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.chip{
  display:inline-flex;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip);
  color: var(--muted);
  font-weight: 900;
}
.chip.active{ color: var(--text); background: var(--card); }

.grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 720px){
  .grid{ grid-template-columns: 1fr; }
}

.tile{
  display:flex; gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
}
.tile:hover{ transform: translateY(-1px); }
.tile-icon{
  width: 62px; height: 62px;
  border-radius: 18px;
  display:flex; align-items:center; justify-content:center;
  font-size: 34px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border);
}
html[data-theme="dark"] .tile-icon{ background: rgba(255,255,255,0.05); }

.tile-body{ flex:1; min-width: 0; }
.tile-top{ display:flex; gap: 8px; align-items:center; flex-wrap: wrap; margin-bottom: 6px; }
.badge{
  display:inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--chip);
  font-weight: 900;
  font-size: .85rem;
}
.badge.ok{ border-color: rgba(47,133,90,0.35); background: rgba(47,133,90,0.12); }
.badge.warn{ border-color: rgba(230,126,34,0.45); background: rgba(230,126,34,0.18); }
.badge.danger{ border-color: rgba(192,57,43,0.45); background: rgba(192,57,43,0.16); }
.badge.subtle{ opacity: .85; }
.tile h3{ margin: 0 0 6px 0; font-size: 1.05rem; }
.tile p{ margin: 0 0 8px 0; line-height: 1.35; }
.tile-meta{ display:flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-weight: 800; font-size: .92rem; }

/* Admin lists */
.list{ display:grid; gap: 10px; }
.list-item{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--chip);
}
.list-item.link{ text-decoration:none; color: inherit; }
.list-item.link:hover{ box-shadow: var(--shadow); transform: translateY(-1px); transition: transform .12s ease; }
.list-item .meta{ display:flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-weight: 800; }
.list-item .title{ font-weight: 900; }
.list-item .actions{ display:flex; gap: 8px; flex-wrap: wrap; }
.kpis{ display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 720px){ .kpis{ grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi{ padding: 14px; border-radius: 18px; border: 1px solid var(--border); background: var(--card); box-shadow: var(--shadow); }
.kpi .num{ font-size: 1.6rem; font-weight: 1000; }
.kpi .lbl{ color: var(--muted); font-weight: 900; }

.post-head{ display:flex; gap: 14px; align-items: flex-start; }
.post-icon{
  width: 70px; height: 70px;
  border-radius: 22px;
  display:flex; align-items:center; justify-content:center;
  font-size: 38px;
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--border);
}
html[data-theme="dark"] .post-icon{ background: rgba(255,255,255,0.05); }

.post-actions{ display:flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.inline{ display:inline; }

.hint{
  margin-top: 14px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px dashed var(--border);
  color: var(--muted);
  font-weight: 700;
}

/* Push notifications (profil) */
.push-box{
  margin-top: 12px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.35);
}
html[data-theme="dark"] .push-box{ background: rgba(255,255,255,0.04); }
.push-row{ display:flex; align-items:center; justify-content:space-between; gap: 12px; flex-wrap:wrap; }
.push-actions{ display:flex; gap: 8px; flex-wrap:wrap; }

.footer{
  margin-top: 28px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.35);
}
html[data-theme="dark"] .footer{ background: rgba(11,18,32,0.35); }
.footer-inner{ padding: 18px; }
.footer-note{ color: var(--muted); font-weight: 800; }

html, body, .card, .tile, .topbar, .footer{
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

/* Chat / messagerie */
.chat{
  margin-top: 14px;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.35);
  max-height: 380px;
  overflow: auto;
}
html[data-theme="dark"] .chat{ background: rgba(255,255,255,0.04); }
.chat-empty{ text-align: center; padding: 16px; }
.msg-row{ display:flex; margin: 10px 0; }
.msg-row.theirs{ justify-content: flex-start; }
.msg-row.mine{ justify-content: flex-end; }
.msg{
  max-width: 86%;
  border-radius: 18px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 8px 18px rgba(0,0,0,0.08);
}
html[data-theme="dark"] .msg{ box-shadow: 0 10px 24px rgba(0,0,0,0.35); }
.msg-row.mine .msg{ background: rgba(254, 240, 138, 0.35); }
html[data-theme="dark"] .msg-row.mine .msg{ background: rgba(250, 204, 21, 0.12); }
.msg-top{ display:flex; gap: 10px; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.msg-top .name{ font-weight: 1000; }
.msg-top .time{ color: var(--muted); font-weight: 800; font-size: .9rem; }
.msg-body{ line-height: 1.35; }
.chat-form{ margin-top: 12px; }
.chat-form textarea{ width: 100%; min-height: 90px; }
.chat-actions{ display:flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 10px; }
.breadcrumbs{ display:flex; gap: 10px; flex-wrap: wrap; align-items:center; margin-bottom: 8px; }
.breadcrumbs a{ color: inherit; font-weight: 900; }


/* --- Com’Bleymard: petits plus (photo + messages non-lus) --- */
.nav-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:22px;
  height:22px;
  padding:0 7px;
  border-radius:999px;
  margin-left:8px;
  font-weight:700;
  font-size:12px;
  border:1px solid rgba(255,255,255,0.18);
  background: rgba(230, 126, 34, 0.18);
}

.badge.new{
  border-color: rgba(230,126,34,0.45);
  background: rgba(230,126,34,0.18);
  font-weight:700;
}

.tile-thumb{
  width:56px;
  height:56px;
  border-radius:16px;
  overflow:hidden;
  flex:0 0 auto;
  border:1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.tile-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.post-photo{
  margin: 10px 0 14px;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 45px rgba(0,0,0,0.20);
}
.post-photo img{
  width:100%;
  max-height: 420px;
  object-fit: cover;
  display:block;
}

/* Nouveau: affichage photo "objet" sans recadrage violent (tondeuse, remorque...) */
.post-media{
  margin: 10px 0 14px;
  border-radius: 18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 45px rgba(0,0,0,0.20);
  background: rgba(255,255,255,0.06);
}
.post-media img{
  width:100%;
  max-height: 420px;
  object-fit: contain;
  display:block;
}

.photo-row{
  display:flex;
  gap:12px;
  align-items:center;
  margin: 6px 0 10px;
}
.photo-thumb{
  width:86px;
  height:86px;
  border-radius:18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.12);
  flex: 0 0 auto;
}
.photo-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.my-photo{
  width:64px;
  height:64px;
  border-radius:18px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  flex: 0 0 auto;
}
.my-photo img{ width:100%; height:100%; object-fit:cover; display:block; }

.form .check{
  display:inline-flex;
  align-items:center;
  gap:8px;
  margin: 0;
}

.form-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 12px;
}


/* Avatars (profil / messages / annonces) */
.avatar{
  --av: 32px;
  width: var(--av);
  height: var(--av);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  overflow:hidden;
  border:1px solid var(--border);
  background: rgba(0,0,0,0.04);
  flex: 0 0 auto;
}
.avatar img{ width:100%; height:100%; object-fit:cover; display:block; }
.avatar-initials{
  font-weight: 800;
  letter-spacing: .02em;
  font-size: calc(var(--av) * 0.36);
  color: var(--text);
  opacity: .85;
}
.author-name{ vertical-align: middle; }

/* Chat avatars */
.msg-row{ display:flex; gap:10px; align-items:flex-end; }
.msg-row.mine{ justify-content:flex-end; }
.msg-row.mine .msg-avatar{ display:none; } /* plus lisible */
.msg-avatar{ flex: 0 0 auto; }
.msg-row.mine .msg{ max-width: min(560px, 92%); }
.msg-row.theirs .msg{ max-width: min(560px, 92%); }

/* Bell */
.bell{
  position: relative;
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 10px;
  border-radius: 14px;
  border:1px solid transparent;
}
.bell:hover{ background: rgba(0,0,0,0.04); border-color: var(--border); }
.badge-dot{
  position:absolute;
  top:4px;
  right:6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  text-align:center;
  background: #e11d48;
  color: white;
  font-weight: 800;
}

/* Profil page */
.grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:16px;
}
@media (max-width: 900px){
  .grid-2{ grid-template-columns: 1fr; }
}
.profile-row{ display:flex; align-items:center; gap:14px; margin: 10px 0 14px; }
.checkline{ display:flex; gap:10px; align-items:center; margin: 10px 0; }
.divider{ height:1px; background: var(--border); margin: 14px 0; opacity: .7; }
.h2{ font-size: 1.05rem; margin: 0 0 10px; }

/* Notifications list */
.list{ display:flex; flex-direction:column; }
.list-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 12px 10px;
  border-top:1px solid var(--border);
  text-decoration:none;
  color:inherit;
}
.list-row:hover{ background: rgba(0,0,0,0.03); }
.list-title{ font-weight: 700; }
.list-meta{ font-size: .92rem; margin-top: 2px; }
