/* =========================================================
   Module markets.css — Marchés / Appels d’offres
   Source migrée depuis : assets/css/annonces-ao.css
   Migration CSS Phase 1 : modules/ — 2026-05-07
   Note : contenu repris sans refonte profonde pour éviter toute casse.
   ========================================================= */

/* Marchés / Appels d'offres — alignement sur le socle front ADHA
   Sobriété institutionnelle : aplats, bordures fines, accent vert discret. */
:root{
  --ao-green: var(--front-green, var(--vert-fonce, #1A7346));
  --ao-green-dark: var(--front-green-dark, var(--vert-tres-fonce, #0D1F1C));
  --ao-soft: var(--front-soft, #f1f7f2);
  --ao-border: var(--front-border, rgba(13,31,28,.12));
  --ao-border-green: var(--front-border-green, rgba(26,115,70,.20));
  --ao-muted: var(--front-muted, #64746f);
  --ao-text: var(--front-text, #183b34);
  --ao-radius: 14px;
}

.marches-home,
.marches-static-page,
.ao-page{
  min-width: 0;
}

/* Titre page Marchés généré par render_site_page */
.marches-home > h1,
.marches-static-page > h1{
  position: relative;
  margin: 0 0 .9rem;
  padding: 1.15rem 1.25rem 1rem;
  border: 1px solid var(--ao-border);
  border-top: 4px solid var(--ao-green);
  border-radius: var(--ao-radius);
  background: #fff;
  color: var(--ao-text);
  font-size: clamp(1.65rem, 2.5vw, 2.25rem);
  line-height: 1.15;
  font-weight: 800;
  box-shadow: none;
}

.marches-home > h1::after,
.marches-static-page > h1::after{
  content: "";
  display: block;
  width: 86px;
  height: 3px;
  margin-top: .75rem;
  background: var(--ao-green);
}

.marches-home > p,
.marches-static-page > p{
  margin: -.35rem 0 1.5rem;
  max-width: 860px;
  color: var(--ao-muted);
  line-height: 1.75;
}

.marches-home-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.4rem;
}

.marches-home-card{
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .7rem;
  min-height: 190px;
  padding: 1.15rem 1.2rem;
  border: 1px solid var(--ao-border);
  border-left: 4px solid var(--ao-green);
  border-radius: var(--ao-radius);
  background: #fff;
  box-shadow: none;
}

.marches-home-card h2{
  margin: 0;
  color: var(--ao-text);
  font-size: 1.1rem;
  line-height: 1.35;
}

.marches-home-card p{
  margin: 0;
  color: var(--ao-muted);
  line-height: 1.7;
}

.marches-home-card .front-actions{
  margin-top: auto;
}

/* Page AO */
.ao-page-title{
  margin: 0 0 1.2rem;
}

.ao-page-title .ao-page-kicker{
  display: inline-flex;
  width: max-content;
  margin-bottom: .55rem;
  color: var(--ao-green);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ao-page-title h1{
  margin: 0;
}

.ao-page-title .ao-page-meta{
  margin-top: .8rem;
}

.ao-page-summary{
  display: flex;
  gap: .55rem;
  flex-wrap: wrap;
  margin-top: .9rem;
}

.ao-stat-card{
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 32px;
  padding: .25rem .75rem;
  border: 1px solid var(--ao-border-green);
  border-radius: 999px;
  background: var(--ao-soft);
  color: var(--ao-green);
  box-shadow: none;
}

.ao-stat-label{
  color: var(--ao-muted);
  font-size: .82rem;
  font-weight: 700;
}

.ao-stat-card strong{
  color: var(--ao-green-dark);
  font-size: .95rem;
  line-height: 1;
}

.ao-page-intro{
  margin-bottom: 1.35rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
  background: #fff;
  box-shadow: none;
}

.ao-page-intro > *:first-child{margin-top:0}
.ao-page-intro > *:last-child{margin-bottom:0}

.ao-filters{
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
  background: #fff;
  box-shadow: none;
}

.ao-filter-field{
  display: grid;
  gap: .4rem;
}

.ao-filters label span{
  font-size: .88rem;
  font-weight: 700;
  color: var(--ao-text);
}

.ao-filters input,
.ao-filters select{
  min-height: 42px;
  border: 1px solid var(--ao-border);
  border-radius: 10px;
  background: #fff;
  color: var(--ao-text);
  box-shadow: none;
}

.ao-filters input:focus,
.ao-filters select:focus{
  border-color: var(--ao-green);
  outline: none;
}

.ao-filter-actions{
  display: flex;
  gap: .55rem;
  align-items: flex-end;
  flex-wrap: wrap;
  grid-column: 1 / -1;
}

.ao-filter-actions .button.secondary{
  background: #fff;
  color: var(--ao-green);
  border: 1px solid var(--ao-border-green);
}

.ao-filter-actions .button.secondary:hover{
  background: var(--ao-green);
  color: #fff;
}

.ao-toolbar{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ao-results-note{
  margin: 0;
  color: var(--ao-muted);
  font-size: .93rem;
}

.ao-active-filters{
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
}

.ao-chip{
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 30px;
  padding: .2rem .65rem;
  border: 1px solid var(--ao-border-green);
  border-radius: 999px;
  background: var(--ao-soft);
  color: var(--ao-green-dark);
  font-size: .84rem;
  line-height: 1.3;
}

.ao-chip strong{
  color: var(--ao-green);
}

.ao-table-wrap,
.marches-table-wrap{
  overflow-x: auto;
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
  background: #fff;
  box-shadow: none;
}

.ao-table,
.marches-static-page table{
  width: 100%;
  margin: 0;
  border-collapse: collapse;
  background: #fff;
}

.ao-table thead th,
.marches-static-page table thead th{
  padding: .8rem .85rem;
  border-bottom: 1px solid var(--ao-border);
  background: #f7faf7;
  color: var(--ao-green-dark);
  font-size: .83rem;
  font-weight: 800;
  text-align: start;
  vertical-align: middle;
}

.ao-table tbody td,
.marches-static-page table tbody td{
  padding: .8rem .85rem;
  border-bottom: 1px solid rgba(13,31,28,.08);
  color: var(--ao-text);
  vertical-align: top;
}

.ao-table tbody tr:last-child td,
.marches-static-page table tbody tr:last-child td{
  border-bottom: 0;
}

.ao-table tbody tr:hover{
  background: #fbfdfb;
}

.ao-reference{
  font-weight: 800;
  color: var(--ao-green-dark);
}

.ao-date-pill,
.ao-tag,
.ao-place,
.ao-dao-unavailable,
.ao-deadline-state{
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 28px;
  padding: .18rem .58rem;
  border: 1px solid var(--ao-border);
  border-radius: 999px;
  background: #fff;
  color: var(--ao-green-dark);
  font-size: .82rem;
  font-weight: 700;
}

.ao-tag,
.ao-deadline-state.is-open{
  border-color: var(--ao-border-green);
  background: var(--ao-soft);
  color: var(--ao-green);
}

.ao-deadline-state.is-closed,
.ao-dao-unavailable{
  background: #f5f6f4;
  color: #68746b;
}

.ao-object-cell{
  min-width: 280px;
}

.ao-object-title{
  display: block;
  color: var(--ao-text);
  line-height: 1.55;
}

.ao-object-details{
  margin-top: .5rem;
}

.ao-object-details summary{
  cursor: pointer;
  color: var(--ao-green);
  font-size: .9rem;
  font-weight: 700;
}

.ao-object-details summary::-webkit-details-marker{display:none}
.ao-object-details summary::after{content:'+'; margin-inline-start:.4rem; font-weight:900}
.ao-object-details[open] summary::after{content:'−'}

.ao-object-full{
  margin-top: .6rem;
  padding: .75rem .85rem;
  border: 1px solid var(--ao-border);
  border-radius: 10px;
  background: #fbfdfb;
  color: var(--ao-muted);
  line-height: 1.7;
}

.ao-deadline{
  display: grid;
  gap: .38rem;
}

.ao-deadline strong{
  color: var(--ao-text);
  font-size: .9rem;
}

.ao-dao-cell{white-space:nowrap}
.ao-dao-btn{min-width: 132px; justify-content:center}

.ao-empty-state{
  padding: 1.7rem 1rem !important;
  text-align: center;
}

.ao-empty-state strong,
.ao-empty-state span{display:block}
.ao-empty-state strong{color:var(--ao-text); font-size:1rem}
.ao-empty-state span{margin-top:.45rem; color:var(--ao-muted)}

.ao-pagination{
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}

.ao-page-link,
.ao-page-link-current{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 .75rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 800;
}

.ao-page-link{
  background: #fff;
  border: 1px solid var(--ao-border);
  color: var(--ao-green-dark);
}

.ao-page-link:hover{
  border-color: var(--ao-green);
  color: var(--ao-green);
}

.ao-page-link-current{
  background: var(--ao-green);
  border: 1px solid var(--ao-green);
  color: #fff;
}

/* Pages statiques Marchés */
.marches-static-page .article-body{
  display: grid;
  gap: 1rem;
}

.marches-static-page .article-body h1{
  display: none;
}

.marches-static-page .article-body h2,
.marches-static-page .article-body h3{
  position: relative;
  margin: 1.25rem 0 .25rem;
  padding-inline-start: .85rem;
  color: var(--ao-text);
  font-size: 1.14rem;
  line-height: 1.35;
}

.marches-static-page .article-body h2::before,
.marches-static-page .article-body h3::before{
  content: "";
  position: absolute;
  inset-block: .2rem;
  inset-inline-start: 0;
  width: 4px;
  border-radius: 99px;
  background: var(--ao-green);
}

.marches-static-page .article-body p{
  margin: 0 0 .65rem;
  color: var(--ao-muted);
  line-height: 1.8;
}

.marches-static-page .article-body > table{
  display: table;
  overflow: hidden;
  border: 1px solid var(--ao-border);
  border-radius: var(--ao-radius);
}

html[dir="rtl"] .marches-home-card{
  border-left-width: 1px;
  border-right: 4px solid var(--ao-green);
}

html[dir="rtl"] .ao-page-title,
html[dir="rtl"] .ao-page-intro,
html[dir="rtl"] .ao-page-meta,
html[dir="rtl"] .ao-toolbar,
html[dir="rtl"] .ao-results-note,
html[dir="rtl"] .marches-static-page .article-body,
html[dir="rtl"] .marches-home > h1,
html[dir="rtl"] .marches-static-page > h1,
html[dir="rtl"] .marches-home > p,
html[dir="rtl"] .marches-static-page > p{
  text-align: right;
}

html[dir="rtl"] .ao-filter-actions,
html[dir="rtl"] .ao-active-filters,
html[dir="rtl"] .ao-page-summary{
  justify-content: flex-start;
}

html[dir="rtl"] .ao-table th,
html[dir="rtl"] .ao-table td,
html[dir="rtl"] .marches-static-page table th,
html[dir="rtl"] .marches-static-page table td{
  text-align: right;
}

@media screen and (max-width: 1100px){
.ao-filters{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}


@media screen and (max-width: 900px){
.marches-home-grid{
    grid-template-columns: 1fr;
  }
}


@media screen and (max-width: 768px){
.ao-filters{
    grid-template-columns: 1fr;
    padding: .9rem;
  }

  .ao-filter-actions{
    align-items: stretch;
  }

  .ao-toolbar{
    flex-direction: column;
    align-items: stretch;
  }

  .ao-object-cell,
  .ao-dao-cell{
    min-width: 0;
  }

  .ao-dao-btn{
    min-width: 0;
    width: 100% !important;
  }
}


.marches-info-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.marches-info-grid .front-card-text{
  margin: 0;
  color: var(--ao-muted);
  line-height: 1.75;
}

@media screen and (max-width: 900px){
.marches-info-grid{
    grid-template-columns: 1fr;
  }
}


/* --------------------------------------------------------------------------
   Harmonisation finale Marchés : menu horizontal et structure commune.
   -------------------------------------------------------------------------- */
.ao-page,
.marches-home,
.marches-static-page{
  width: min(1120px, 100%);
  margin-inline: auto;
}

.ao-page .ao-page-title{
  margin-bottom: 1.45rem;
}

.ao-page-title .ao-page-kicker{
  display: none;
}

.ao-page-summary{
  margin-top: 1rem;
}

.ao-page-intro{
  margin-top: 0;
}

.marches-static-page .article-body{
  margin-top: 0;
}

.marches-static-page .article-body > p:first-child{
  margin-top: 0;
}
