/* ========================================
   ANNONCES
   ======================================== */
.ann-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 900px) {
  .ann-wrap {
    grid-template-columns: 1fr;
  }
}

.ann-card {
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--panel);
  box-shadow: var(--ann-shadow);
}

.ann-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--ann-border);
}

.ann-title {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.ann-date {
  font-size: 12px;
  opacity: .7;
}

.ann-body {
  --ann-line-height: 1.35;
  --ann-lines: 3;
  margin-top: 10px;
  font-size: 20px;
  line-height: var(--ann-line-height);
  color: var(--text);
  max-height: calc(var(--ann-line-height) * var(--ann-lines) * 1em);
  overflow: hidden;
  position: relative;
}

.ann-text {
  white-space: normal;
  will-change: transform;
}

/* Badge épinglé */
.ann-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ann-pin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  font-size: 12px;
  border-radius: 999px;
  padding: 0 6px;
  background: var(--ann-pin-bg);
}

/* Effet de fondu pour le défilement */
.ann-body.scrolling {
  -webkit-mask-image: linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,1) 5%,
    rgba(0,0,0,1) 95%,
    rgba(0,0,0,0) 100%
  );
  mask-image: linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0%,
    rgba(0,0,0,1) 5%,
    rgba(0,0,0,1) 95%,
    rgba(0,0,0,0) 100%
  );
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}

/* ========================================
   Grille d'annonces (structure de base)
   Les layouts spécifiques sont dans /layouts/*.css
   ======================================== */
.ann-grid {
  display: grid;
  gap: var(--ann-gap, 16px);
}

/* Overrides par carte (utilisables avec tous les layouts) */
.ann-grid .ann.span-full {
  grid-column: span 2;
}

.ann-grid .ann.span-row {
  grid-column: 1 / -1;
}

.ann-grid .ann.takeover {
  grid-column: 1 / -1;
}

/* ========================================
   Panel pour les annonces
   ======================================== */
.panel-head {
  margin-bottom: 12px;
}

.panel-body {
  /* Conteneur des annonces */
}

/* ========================================
   Utilitaires
   ======================================== */
.hidden {
  display: none;
}

/* ========================================
   Titres dans les annonces
   ======================================== */
.ann-text h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent, #0066cc);
  margin: 0.5rem 0;
  padding: 0;
  line-height: 1.3;
}

.ann-text h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent-dark, #004499);
  margin: 0.4rem 0;
  padding: 0;
  line-height: 1.25;
}

.ann-text h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text, inherit);
  margin: 0.3rem 0;
  padding: 0;
  line-height: 1.2;
}

/* ========================================
   Listes dans les annonces
   ======================================== */
.ann-text ul,
.ann-text ol {
  margin: 0.5rem 0;
  padding-left: 1.5em;
  line-height: 1.4;
}

.ann-text ul {
  list-style-type: disc;
}

.ann-text ol {
  list-style-type: decimal;
}

.ann-text li {
  margin: 0.2rem 0;
  padding-left: 0.3em;
}

.ann-text li::marker {
  color: var(--accent, #0066cc);
}

/* Listes imbriquées */
.ann-text ul ul,
.ann-text ol ol,
.ann-text ul ol,
.ann-text ol ul {
  margin: 0.2rem 0;
}

/* Titres et listes en mode sombre */
body[data-theme="dark"] .ann-text h1 {
  color: var(--accent-light, #66b3ff);
}

body[data-theme="dark"] .ann-text li::marker {
  color: var(--accent-light, #66b3ff);
}

/* Mobile - titres et listes */
@media (max-width: 768px) {
  .ann-text h1 {
    font-size: 1.3rem;
  }
  
  .ann-text h2 {
    font-size: 1.2rem;
  }
  
  .ann-text h3 {
    font-size: 1.1rem;
  }
  
  .ann-text ul,
  .ann-text ol {
    padding-left: 1.2em;
  }
}

/* ========================================
   Mobile - Annonces
   ======================================== */
@media (max-width: 600px) {
  #z4-annonces .ann-grid {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
  }

  #z4-annonces .ann-grid .ann {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    grid-column: auto !important;
  }

  body[data-theme] main.container {
    padding: 10px !important;
    gap: 10px !important;
  }

  body[data-theme] section.ratp-wrap {
    padding: 5px !important;
  }

  body[data-theme] section.meteo--compact,
  body[data-theme] section.meteo--compact .panel {
    padding: 5px !important;
  }

  body[data-theme] section.row-date-time .card {
    padding: 5px !important;
  }

  body[data-theme] section#z4-annonces {
    padding: 5px !important;
  }

  /* Lignes bus → RER : layout en 2 colonnes fixes */
  .rtp-row {
    display: grid;
    grid-template-columns: minmax(0, 40%) minmax(0, 1fr);
    column-gap: 8px;
    align-items: center;
    padding: 10px 0;
  }

  .rtp-row > div:first-child {
    font: 700 14px/1.2 system-ui;
  }

  .rtp-row > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
  }

  .t-bus .chip {
    min-width: 52px;
    padding: 6px 8px;
    font-size: 60px;
  }

  .t-bus .chip span.min {
    font-size: 30px;
  }
}

/* ========================================
   Effets smooth pour hot reload
   ======================================== */
#annonces-panel {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

#annonces-panel.ann-fade-out {
  opacity: 0;
  transform: translateY(4px);
}

#annonces-panel.ann-fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   ANNONCES PDF
   ======================================== */
.ann-pdf {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 180px); /* Toute la hauteur moins header date/heure */
}

.ann-pdf .ann-head {
  flex-shrink: 0;
}

.ann-pdf .ann-pdf-body {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  min-height: 0; /* Important pour flex */
  max-height: none; /* Override .ann-body max-height */
  overflow: visible;
  position: relative;
  background: #fff;
  border-radius: 8px;
  padding: 10px;
  box-sizing: border-box;
}

.ann-pdf .pdf-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 210 / 297; /* Ratio A4 portrait */
  opacity: 0;
  transition: opacity 0.2s ease;
}

.ann-pdf.pdf-loaded .pdf-canvas {
  opacity: 1;
}

.ann-pdf .pdf-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #64748b;
  font-size: 14px;
  transition: opacity 0.2s ease;
}

.ann-pdf.pdf-loaded .pdf-loading {
  opacity: 0;
  pointer-events: none;
}

.ann-pdf .ann-pdf-icon {
  font-size: 1.2em;
  margin-right: 4px;
}

.ann-pdf .ann-pdf-pages {
  font-size: 12px;
  color: #64748b;
  background: rgba(0,0,0,0.05);
  padding: 2px 8px;
  border-radius: 10px;
}

.ann-pdf .ann-pdf-pages .current-page {
  font-weight: 600;
}

/* Grille annonces - forcer hauteur 
.ann-grid.layout-grid-full .ann-pdf {
  height: calc(100vh - 180px);
}*/

/* Mode slideshow - Annonces avec PDF */
/* Forcer les PDF à prendre toute la largeur, peu importe le layout grid */
.ann-grid .ann-pdf {
  grid-column: 1 / -1 !important;
  width: 100%;
  height: auto;
}

.ann-pdf .ann-pdf-body {
  width: 100%;
}

.ann-pdf .pdf-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 210 / 297; /* Ratio A4 portrait */
}

/* ========================================
   FORCER HAUTEUR POUR PDF PLEIN ÉCRAN
   ======================================== */
#z4-annonces:has(.ann-pdf) {
  height: calc(100vh - 160px);
  display: flex;
  flex-direction: column;
}

#z4-annonces:has(.ann-pdf) .panel-body,
#z4-annonces:has(.ann-pdf) #annonces-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#z4-annonces:has(.ann-pdf) .ann-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#z4-annonces:has(.ann-pdf) .ann-grid .ann-pdf {
  flex: 1;
  min-height: 0;
}