/* AutoMania — WIDGETS CSS : sidebar, widgets AM, événements, footer.
   Version : vignettes pleine largeur + texte dessous.
*/

/* ── Sidebar ──────────────────────────────────────────────── */
.widget-area {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.widget {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  padding: 20px;
}

.widget-title {
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--color-dark);
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-accent);
}

.widget-title a {
  color: inherit;
  text-decoration: none;
}

.widget-title a:hover {
  color: var(--color-accent);
}

/* ── Listes widgets AutoMania ─────────────────────────────── */
.am-widget-list,
.am-widget-recent,
.am-widget-popular,
.am-widget-events {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Cartes verticales : image pleine largeur, texte dessous */
.am-recent-item,
.am-popular-item,
.am-event-item {
  position: relative;
  display: flex !important;
  flex-direction: column;
  gap: 9px;
  align-items: stretch;
  padding: 0 0 18px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--color-border);
  min-width: 0;
  grid-template-columns: none !important;
}

.am-recent-item:first-child,
.am-popular-item:first-child,
.am-event-item:first-child {
  padding-top: 0;
}

.am-recent-item:last-child,
.am-popular-item:last-child,
.am-event-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* Vignettes pleine largeur */
.am-widget-thumb,
.am-recent-thumb,
.am-popular-thumb,
.am-event-thumb {
  display: block;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
}

.am-event-thumb {
  aspect-ratio: 16 / 9;
}

.am-widget-thumb img,
.am-widget-thumb-img,
.am-recent-thumb img,
.am-popular-thumb img,
.am-event-thumb img {
  width: 100% !important;
  height: 100% !important;
  display: block;
  object-fit: cover;
}

/* Corps texte sous l'image */
.am-widget-body,
.am-recent-body,
.am-popular-body,
.am-event-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 5px;
  min-width: 0;
  min-height: 0 !important;
}

.am-widget-title-link,
.am-recent-title,
.am-popular-title,
.am-event-title {
  color: var(--color-dark);
  font-size: .92rem;
  font-weight: 800;
  line-height: 1.28;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.am-widget-title-link:hover,
.am-recent-title:hover,
.am-popular-title:hover,
.am-event-title:hover {
  color: var(--color-accent);
}

.am-widget-date,
.am-recent-date {
  font-size: .72rem;
  color: var(--color-muted);
}

/* ── Articles les plus vus : badge numéro sur l'image ────── */
.am-popular-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  width: 28px !important;
  height: 28px;
  min-height: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--color-accent);
  color: #fff;
  font-size: .78rem;
  font-weight: 900;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* Quand il n'y a pas de vignette, le numéro redevient normal */
.am-popular-item.no-thumb {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) !important;
  gap: 10px;
  align-items: start;
}

.am-popular-item.no-thumb .am-popular-rank {
  position: static;
  box-shadow: none;
}

/* ── Prochains événements ────────────────────────────────── */
.widget-prochains-evenements .widget-title,
.widget_am_upcoming_events_widget .widget-title,
.widget_am_upcoming_events .widget-title {
  border-bottom-color: #c0392b;
}

.am-event-date-line,
.am-event-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.am-event-date,
.am-event-meta time {
  color: #c0392b;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.25;
}

.am-event-type {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 999px;
  background: #f5f5f5;
  color: #555;
  font-size: .72rem;
  line-height: 1.25;
  white-space: nowrap;
}

.am-event-line,
.am-event-place {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--color-muted);
  font-size: .75rem;
  line-height: 1.3;
  min-width: 0;
}

.am-event-line span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.am-event-organizer {
  color: #999;
}

.am-widget-more {
  margin: 14px 0 0;
  text-align: center;
}

.am-widget-more a {
  color: #c0392b;
  font-size: .82rem;
  font-weight: 800;
  text-decoration: none;
}

.am-widget-more a:hover {
  color: var(--color-accent);
}

/* ── Anciens widgets / compatibilité ─────────────────────── */
/* Si un ancien widget sort encore .recent-post-item, on le force aussi en vertical */
.widget .recent-post-item {
  display: flex !important;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
  padding: 0 0 18px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--color-border);
}

.widget .recent-post-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.widget .recent-post-item .thumb {
  flex-shrink: 0;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg);
}

.widget .recent-post-item .thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

.widget .recent-post-item h4 {
  font-size: .92rem;
  line-height: 1.28;
  font-weight: 800;
  margin: 0 0 4px;
}

.widget .recent-post-item h4 a {
  color: var(--color-dark);
}

.widget .recent-post-item h4 a:hover {
  color: var(--color-accent);
}

.widget .recent-post-item .date {
  font-size: .72rem;
  color: var(--color-muted);
}

/* ── Footer : espace entre plusieurs widgets même colonne ─── */
.site-footer .footer-grid {
  align-items: start;
}

.site-footer .footer-col,
.site-footer .footer-col-inner {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.site-footer .footer-col > *,
.site-footer .footer-col-inner > * {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

@media (max-width: 768px) {
  .widget-area {
    gap: 24px;
  }

  .widget {
    padding: 18px;
  }

  .am-recent-item,
  .am-popular-item,
  .am-event-item,
  .widget .recent-post-item {
    padding-bottom: 16px;
    margin-bottom: 16px;
  }

  .am-widget-title-link,
  .am-recent-title,
  .am-popular-title,
  .am-event-title,
  .widget .recent-post-item h4 {
    font-size: .9rem;
  }

  .site-footer .footer-grid {
    gap: 28px !important;
  }

  .site-footer .footer-col,
  .site-footer .footer-col-inner {
    gap: 26px;
  }
}
