/* Recommandations page styles */
:root {
  --reco-bg: #f7f7f7;
  --reco-card-bg: #ffffff;
  --reco-text: #1b1b1b;
  --reco-muted: #6b7280;
  --reco-border: #e5e7eb;
  /* Use a darker primary for accessible white text contrast */
  --reco-primary: #c74224; /* AA with white at normal text sizes */
  --reco-primary-ink: #9a2f19; /* hover/active */
}

/* Loader overlay */
.page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.page-loader__spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #e25430;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.reco-page {
  margin-top: 100px; /* rely on body padding-top for fixed nav offset */
}

/* Center the login prompt when it's effectively the only content */
.reco-page--needs-auth,
.reco-page:has(> .reco-banner):not(
    :has(.reco-grid, .reco-accordion, .reco-hero)
  ) {
  min-height: calc(100vh - 180px); /* account for header/footer */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* Fallback for browsers without :has support: visually center using viewport margins */
@supports not selector(:has(*)) {
  .reco-banner {
    margin: 12vh auto; /* approximate vertical centering */
  }
}

/* Hero section */
.reco-hero {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  margin: 40px 0;
  padding: 0 24px;
}

.reco-hero__image {
  width: 100%;
  max-width: 400px;
  border-radius: 12px;
  object-fit: cover;
}

.reco-hero__title {
  font-size: 2rem;
  margin-bottom: 12px;
  color: #333;
}

.reco-hero__text {
  margin-bottom: 8px;
  color: #555;
}

/* titres des sections */
.reco-section {
  max-width: 860px;
  margin: 40px auto 20px;
  padding: 0 24px;
}

.reco-section__title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.reco-section__line {
  width: 60px;
  height: 4px;
  background: #e25430;
  margin-bottom: 24px;
  border-radius: 2px;
}

.reco-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1100;
  pointer-events: auto; /* block background interactions while gate is visible */
  background: rgba(255, 255, 255, 0.92); /* subtle backdrop for readability */
}

.reco-gate {
  max-width: 860px;
  width: 100%;
  text-align: center;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 24px;
  transform: translateY(-6vh);
  pointer-events: auto;
}

.reco-answers {
  max-width: 860px;
  margin: 40px auto;
  padding: 24px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.reco-gate__title {
  margin: 0 0 10px;
}
.reco-gate__desc {
  margin: 0 0 16px;
  color: #444;
}

.reco-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.reco-btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.reco-btn--primary {
  background: var(--reco-primary);
  color: #fff;
}
.reco-btn--primary:hover { background: var(--reco-primary-ink); }

.reco-btn--outline {
  border: 1px solid var(--reco-primary);
  color: var(--reco-primary);
  background: transparent;
}
.reco-btn--outline:hover {
  background: rgba(226, 84, 48, 0.08);
}

/* Banner */
.reco-banner {
  max-width: 860px;
  margin: 40px auto;
  padding: 24px;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  background: #fff;
  text-align: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.reco-banner__row {
  margin-bottom: 16px;
  color: #444;
  font-size: 1rem;
}

.reco-banner__btn {
  display: inline-block;
  padding: 10px 16px;
  background: var(--reco-primary);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.3s;
}

.reco-banner__btn:hover { background: var(--reco-primary-ink); }

.reco-banner__btn:focus-visible,
.reco-card__cta:focus-visible {
  outline: 3px solid #111;
  outline-offset: 3px;
}

.reco-accordion {
  max-width: 860px;
  margin: 24px auto;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.reco-acc__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 16px 24px;
  background: #fff;
  transition: background 0.3s;
}

.reco-acc__header:hover {
  background: #f9f9f9;
}

.reco-acc__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #333;
}

.reco-acc__chevron {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-right: 2px solid #e25430;
  border-bottom: 2px solid #e25430;
  transform: rotate(45deg);
  transition: transform 0.3s;
}

.reco-acc__header[aria-expanded="true"] .reco-acc__chevron {
  transform: rotate(-135deg);
}

.reco-acc__count {
  font-size: 0.9rem;
  color: #666;
}

.reco-acc__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
  background: #fff;
}

.reco-acc__panel.open {
  max-height: 2000px; /* assez grand pour contenir tout le contenu */
}

/* Grid des cards */
.reco-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
  padding: 16px 24px;
}

.reco-card {
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s;
}

.reco-card:hover {
  transform: translateY(-4px);
}

.reco-card__media {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.reco-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.reco-card__title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: #333;
}

.reco-card__meta {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: auto;
}

.reco-card__cta {
  display: inline-block;
  margin-top: 12px;
  padding: 8px 12px;
  background: var(--reco-primary);
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.9rem;
  text-align: center;
  transition: background 0.3s;
}

.reco-card__cta:hover { background: var(--reco-primary-ink); }

/* Tablette */
@media (max-width: 900px) {
  .reco-hero {
    gap: 16px;
    padding: 0 16px;
  }
  .reco-section,
  .reco-banner,
  .reco-accordion {
    margin-left: 16px;
    margin-right: 16px;
  }
  .reco-grid {
    gap: 16px;
    padding: 12px 16px;
  }
}

/* téléphone */
@media (max-width: 600px) {
  .reco-gate {
    transform: translateY(-4vh);
  }
  .reco-hero {
    flex-direction: column;
    text-align: center;
  }
  .reco-hero__title {
    font-size: 1.5rem;
  }
  .reco-hero__image {
    max-width: 100%;
  }
  .reco-section__title {
    font-size: 1.25rem;
  }
  .reco-banner {
    padding: 16px;
  }
  .reco-card__media {
    height: 140px;
  }
}


@media (max-width: 480px) {
  .reco-grid {
    grid-template-columns: 1fr !important;
  }
}
