/* =========================================================
   Petites Annonces — style.css (pur CSS, sans librairie)
   ========================================================= */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-accent: #f59e0b;
  --color-bg: #f8fafc;
  --color-surface: #ffffff;
  --color-text: #1e293b;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-hover: 0 10px 20px rgba(0,0,0,.08), 0 3px 6px rgba(0,0,0,.06);
  --header-h: 64px;
  --max-width: 1280px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm); border: none;
  font-weight: 600; font-size: 14px; cursor: pointer; transition: all .15s ease;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100; background: var(--color-surface);
  border-bottom: 1px solid var(--color-border); height: var(--header-h);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.logo { display: flex; align-items: center; height: 40px; }
.logo svg { height: 100%; width: auto; }

.main-nav { display: flex; align-items: center; gap: 8px; }
.main-nav a.btn { white-space: nowrap; }
.burger-btn { display: none; background: none; border: none; font-size: 24px; cursor: pointer; padding: 8px; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 199; }
.sidebar-overlay.active { display: block; }
.mobile-sidebar {
  position: fixed; top: 0; right: -300px; width: 280px; height: 100%; background: #fff;
  z-index: 200; transition: right .25s ease; padding: 20px; overflow-y: auto;
}
.mobile-sidebar.active { right: 0; }
.mobile-sidebar a { display: block; padding: 12px 8px; border-bottom: 1px solid var(--color-border); }
.mobile-sidebar-close { background: none; border: none; font-size: 22px; float: right; cursor: pointer; }

@media (max-width: 860px) {
  .main-nav.desktop-only { display: none; }
  .burger-btn { display: block; }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff; padding: 60px 0;
}
.hero .container { display: flex; align-items: center; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.hero-slogan { flex: 1 1 320px; }
.hero-slogan h1 { font-size: 2.2rem; margin: 0 0 12px; }
.hero-slogan p { opacity: .9; margin: 0; }
.hero-search { flex: 1 1 380px; }
.search-bar { display: flex; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.search-bar input { flex: 1; border: none; padding: 14px 16px; font-size: 15px; outline: none; }
.search-bar button { border: none; background: var(--color-accent); color: #fff; padding: 0 22px; cursor: pointer; font-weight: 600; }

/* ---------- Catégories ---------- */
.section { padding: 40px 0; }
.section-title { font-size: 1.4rem; margin: 0 0 20px; display: flex; align-items: center; justify-content: space-between; }
.category-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px;
}
.category-tile {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 20px 12px; text-align: center; transition: box-shadow .15s, transform .15s;
}
.category-tile:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.category-tile .icon { font-size: 28px; color: var(--color-primary); margin-bottom: 10px; }
.category-tile .icon img { height: 32px; margin: 0 auto 10px; }
.category-tile .name { font-weight: 600; font-size: 14px; }

/* ---------- Cards annonces : mode LISTE ---------- */
.listing-list { display: flex; flex-direction: column; gap: 14px; }
.listing-row {
  display: flex; gap: 16px; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); overflow: hidden; transition: box-shadow .15s;
}
.listing-row:hover { box-shadow: var(--shadow-hover); }
.listing-row .thumb { width: 180px; min-width: 180px; height: 130px; background: #eef2f7; overflow: hidden; }
.listing-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-row .body { padding: 14px 16px 14px 0; flex: 1; min-width: 0; }
.listing-row h3 { margin: 0 0 6px; font-size: 1.05rem; }
.listing-row .desc { color: var(--color-text-muted); font-size: 14px; margin: 0 0 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-row .meta { display: flex; gap: 14px; font-size: 13px; color: var(--color-text-muted); flex-wrap: wrap; }
.listing-row .price { font-weight: 700; color: var(--color-primary); font-size: 1.1rem; margin-top: 6px; }

@media (max-width: 560px) {
  .listing-row { flex-direction: column; }
  .listing-row .thumb { width: 100%; height: 180px; }
  .listing-row .body { padding: 12px; }
}

/* ---------- Cards annonces : mode SHOP/ARTICLE ---------- */
.listing-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1100px) { .listing-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 780px) { .listing-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 460px) { .listing-grid { grid-template-columns: 1fr; } }

.listing-card {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow .15s, transform .15s; display: flex; flex-direction: column;
}
.listing-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.listing-card .thumb { width: 100%; height: 170px; background: #eef2f7; overflow: hidden; position: relative; }
.listing-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.listing-card .badge-premium {
  position: absolute; top: 8px; left: 8px; background: var(--color-accent); color: #fff;
  font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px;
}
.listing-card .body { padding: 12px 14px; flex: 1; display: flex; flex-direction: column; }
.listing-card h3 { margin: 0 0 6px; font-size: .95rem; }
.listing-card .desc { color: var(--color-text-muted); font-size: 13px; margin: 0 0 8px; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.listing-card .meta { font-size: 12px; color: var(--color-text-muted); }
.listing-card .price { font-weight: 700; color: var(--color-primary); margin-top: 6px; }

/* ---------- Étoiles de qualité ---------- */
.quality-stars { color: var(--color-accent); font-size: 13px; }

/* ---------- Page annonce détail ---------- */
.listing-detail { display: grid; grid-template-columns: 1.4fr 1fr; gap: 30px; }
@media (max-width: 900px) { .listing-detail { grid-template-columns: 1fr; } }

.carousel { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; }
.carousel-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.carousel-track img { scroll-snap-align: start; width: 100%; flex: 0 0 100%; height: 420px; object-fit: cover; cursor: zoom-in; }
.carousel-dots { display: flex; gap: 6px; justify-content: center; padding: 10px 0; }
.carousel-dots span { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; cursor: pointer; }
.carousel-dots span.active { background: var(--color-primary); }

.photo-modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 300; }
.photo-modal.active { display: flex; align-items: center; justify-content: center; }
.photo-modal img { max-width: 92vw; max-height: 88vh; touch-action: pan-y; }
.photo-modal .close-modal { position: absolute; top: 16px; right: 24px; color: #fff; font-size: 30px; cursor: pointer; background: none; border: none; }
.photo-modal .nav-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.15); border: none; color: #fff; font-size: 28px; padding: 10px 16px; cursor: pointer; border-radius: 6px; }
.photo-modal .nav-prev { left: 16px; }
.photo-modal .nav-next { right: 16px; }

.listing-info-box { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; }
.listing-info-box .price { font-size: 1.6rem; font-weight: 800; color: var(--color-primary); margin-bottom: 12px; }
.contact-box { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--color-border); }

.dynamic-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 20px; margin: 16px 0; }
.dynamic-fields .field-item { font-size: 14px; display: flex; justify-content: space-between; border-bottom: 1px dashed var(--color-border); padding: 6px 0; }
@media (max-width: 480px) { .dynamic-fields { grid-template-columns: 1fr; } }

/* ---------- Sensible / avertissement ---------- */
.sensitive-warning-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.92); z-index: 400;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.sensitive-warning-box { background: #fff; border-radius: var(--radius); padding: 30px; max-width: 480px; text-align: center; }
.sensitive-warning-box h2 { color: var(--color-danger); }

/* ---------- Formulaires ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-sm);
  font-size: 14px; font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }
textarea.form-control { resize: vertical; min-height: 120px; }
.form-hint { font-size: 12px; color: var(--color-text-muted); margin-top: 4px; }
.form-error { color: var(--color-danger); font-size: 13px; margin-top: 4px; }
.card-form { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 26px; max-width: 480px; margin: 40px auto; }

.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-info { background: #dbeafe; color: #1e40af; }

/* ---------- Espace compte (style webmail) ---------- */
.webmail-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; }
@media (max-width: 800px) { .webmail-layout { grid-template-columns: 1fr; } }
.webmail-sidebar { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 10px; height: fit-content; }
.webmail-sidebar a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--color-text); }
.webmail-sidebar a:hover, .webmail-sidebar a.active { background: #eff6ff; color: var(--color-primary); }
.webmail-sidebar a i { width: 18px; text-align: center; }
.webmail-content { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; }

.list-item-row { display: flex; align-items: center; gap: 14px; padding: 12px; border-bottom: 1px solid var(--color-border); }
.list-item-row:last-child { border-bottom: none; }
.list-item-row img { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius-sm); background: #eef2f7; }
.status-badge { font-size: 11px; padding: 3px 8px; border-radius: 20px; font-weight: 700; }
.status-published { background: #dcfce7; color: #166534; }
.status-pending_review { background: #fef9c3; color: #854d0e; }
.status-draft { background: #e2e8f0; color: #475569; }
.status-rejected, .status-disabled_by_moderator { background: #fee2e2; color: #991b1b; }
.status-disabled_by_user, .status-trashed { background: #f1f5f9; color: #64748b; }

/* ---------- Footer ---------- */
.site-footer { background: #0f172a; color: #cbd5e1; padding: 30px 0; margin-top: 60px; }
.footer-grid { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-grid a { color: #cbd5e1; }
.footer-grid a:hover { color: #fff; }
.footer-keywords { flex: 1; text-align: center; font-size: 12px; color: #64748b; }
@media (max-width: 700px) { .footer-grid { flex-direction: column; text-align: center; } }

/* ---------- Utilitaires ---------- */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--color-text-muted); }
.text-center { text-align: center; }
