/*
 * Guide (page publique + aperçu dans le dashboard).
 * Même DA que la page Économie et le dashboard : fond #232323, cartes #2b2b2b arrondies,
 * Poppins, accents bleus, boutons en pilule. Mise en page façon documentation (menu + contenu).
 */
.guide-page,
.guide-content {
  --g-card: #2b2b2b;
  --g-deep: #1f1f1f;
  --g-line: rgba(255, 255, 255, 0.08);
  --g-text: #e4e4e4;
  --g-muted: #a3a3a3;
  --g-blue: #2379ee;
  --g-blue-soft: #6aa8ff;
}

.guide-page {
  background: #232323;
  color: var(--g-text);
  font-family: 'Poppins', sans-serif;
}

/* ---------------------------------------------------------------- En-tête */
.guide-hero {
  padding: 7.5rem 1.25rem 2.25rem;
  background: #2b2b2b;
  text-align: center;
}

.guide-hero__title {
  margin: 0 0 0.6rem;
  color: #ffffff;
}

.guide-hero__subtitle {
  margin: 0 auto 1.1rem;
  max-width: 560px;
  color: #cfcfcf;
  font-size: 1rem;
  line-height: 1.6;
}

/* ---------------------------------------------------------------- Mise en page */
.guide-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 1.75rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.guide-main {
  min-width: 0;
  max-width: 860px;
}

/* ---------------------------------------------------------------- Menu */
.guide-nav {
  position: sticky;
  top: 5.75rem;
  align-self: start;
  max-height: calc(100vh - 6.75rem);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: var(--g-card);
}

.guide-nav__head {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--g-line);
}

.guide-search {
  flex: 1;
  min-width: 0;
  padding: 0.55rem 1rem;
  border: 2px solid #3d3d3d;
  border-radius: 100px;
  background: var(--g-deep);
  color: #ffffff;
  font-family: inherit;
  font-size: 0.9rem;
  color-scheme: dark;
}

.guide-search:focus {
  outline: none;
  border-color: var(--g-blue);
}

.guide-nav__close {
  display: none;
  width: 2.4rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  font-size: 1.4rem;
  line-height: 1;
}

.guide-menu {
  overflow-y: auto;
  padding: 0.6rem 0.75rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: #4a4a4a transparent;
}

.guide-menu__heading {
  margin: 0.9rem 0.6rem 0.35rem;
  color: var(--g-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-menu__heading:first-child {
  margin-top: 0.3rem;
}

.guide-menu__heading .guide-icon {
  margin-right: 0.4rem;
}

.guide-menu__sep {
  margin: 0.6rem 0.6rem;
  border: 0;
  border-top: 1px solid var(--g-line);
  opacity: 1;
}

.guide-menu__link,
.guide-menu__topics a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-radius: 100px;
  color: #dcdcdc !important;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.3;
  transition: background 0.15s, color 0.15s;
}

.guide-menu__link:hover,
.guide-menu__topics a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff !important;
}

.guide-menu__text {
  flex: 1;
  min-width: 0;
}

.guide-menu__ext {
  color: var(--g-muted);
  font-size: 0.8rem;
}

.guide-menu .guide-icon {
  width: 1.3rem;
  flex-shrink: 0;
  text-align: center;
}

.guide-menu__section {
  position: relative;
}

.guide-menu__section-link {
  padding-right: 2.4rem;
}

.guide-menu__section.is-active > .guide-menu__section-link {
  background: rgba(35, 121, 238, 0.16);
  color: #ffffff !important;
}

.guide-menu__toggle {
  position: absolute;
  top: 0.2rem;
  right: 0.3rem;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--g-muted);
}

.guide-menu__toggle::before {
  content: '';
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s;
}

.guide-menu__toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
}

.guide-menu__section.is-open > .guide-menu__toggle::before {
  transform: rotate(45deg);
}

.guide-menu__topics {
  margin: 0.15rem 0 0.4rem 1.35rem;
  padding: 0 0 0 0.6rem;
  border-left: 1px solid var(--g-line);
  list-style: none;
}

.guide-page.is-enhanced .guide-menu__section:not(.is-open) > .guide-menu__topics {
  display: none;
}

.guide-menu__topics a {
  padding: 0.38rem 0.7rem;
  color: #bdbdbd !important;
  font-size: 0.86rem;
  font-weight: 400;
}

.guide-menu__topics a.is-active {
  background: var(--g-blue);
  color: #ffffff !important;
}

.guide-menu__topic-sep {
  height: 1px;
  margin: 0.4rem 0.7rem;
  background: var(--g-line);
}

.guide-menu__empty {
  margin: 1rem 0.75rem;
  color: var(--g-muted);
  font-size: 0.9rem;
}

.guide-menu [hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------- Sections */
.guide-section {
  margin-bottom: 1.25rem;
  padding: 2rem 2.25rem 1.25rem;
  border-radius: 14px;
  background: var(--g-card);
  scroll-margin-top: 6rem;
}

.guide-section__title {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0 0 0.6rem;
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.2;
}

.guide-section__desc {
  color: #cfcfcf;
}

.guide-section__head {
  padding-bottom: 1.25rem;
}

.guide-section__break {
  height: 0.5rem;
  margin: 0.6rem -2.25rem 0;
  background: #232323;
}

/* ---------------------------------------------------------------- Sous-sections et blocs */
.guide-content .guide-topic {
  padding: 1.4rem 0 1.25rem;
  border-top: 1px solid var(--g-line);
  scroll-margin-top: 6rem;
}

.guide-content .guide-topic__title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.7rem;
  color: #ffffff;
  font-family: 'Poppins', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.3;
}

.guide-content .guide-topic__anchor {
  margin-left: 0.2rem;
  color: var(--g-muted) !important;
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.15s;
}

.guide-content .guide-topic:hover .guide-topic__anchor,
.guide-content .guide-topic__anchor:focus-visible {
  opacity: 1;
}

.guide-content .guide-topic:target {
  animation: guide-flash 1.6s ease-out;
}

@keyframes guide-flash {
  from { box-shadow: inset 3px 0 0 var(--g-blue); }
  to { box-shadow: inset 3px 0 0 transparent; }
}

.guide-content .guide-text {
  margin: 0 0 0.85rem;
  color: var(--g-text);
  font-size: 1rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.guide-content .guide-text:last-child {
  margin-bottom: 0;
}

.guide-content .guide-text strong {
  color: #ffffff;
}

.guide-content .guide-command {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.9rem;
  padding: 0.7rem 0.7rem 0.7rem 1.1rem;
  border: 1px solid var(--g-line);
  border-radius: 12px;
  background: var(--g-deep);
}

.guide-content .guide-command__line {
  flex: 1;
  min-width: 0;
  color: #9fc4ff;
  font-family: 'Consolas', 'SFMono-Regular', 'Menlo', monospace;
  font-size: 0.92rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.guide-content .guide-command__copy {
  flex-shrink: 0;
  padding: 0.35rem 0.9rem;
  border: 1.5px solid var(--g-blue);
  border-radius: 100px;
  background: transparent;
  color: var(--g-blue-soft);
  font-family: 'Poppins', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.guide-content .guide-command__copy:hover,
.guide-content .guide-command__copy.is-copied {
  background: var(--g-blue);
  color: #ffffff;
}

.guide-content .guide-figure {
  margin: 0.4rem 0 1rem;
}

.guide-content .guide-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.guide-content .guide-figure figcaption {
  margin-top: 0.5rem;
  color: var(--g-muted);
  font-size: 0.85rem;
  text-align: center;
}

.guide-content .guide-video {
  position: relative;
  margin: 0.4rem 0 1rem;
  overflow: hidden;
  border-radius: 12px;
  background: #000000;
  aspect-ratio: 16 / 9;
}

.guide-content .guide-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.guide-content .guide-callout {
  display: flex;
  gap: 0.8rem;
  margin: 0.2rem 0 1rem;
  padding: 0.9rem 1.1rem;
  border-left: 4px solid var(--g-blue);
  border-radius: 12px;
  background: rgba(35, 121, 238, 0.1);
}

.guide-content .guide-callout__icon {
  font-size: 1.2rem;
  line-height: 1.6;
}

.guide-content .guide-callout__label {
  display: block;
  margin-bottom: 0.15rem;
  color: #ffffff;
  font-size: 0.9rem;
}

.guide-content .guide-callout .guide-text {
  font-size: 0.95rem;
}

.guide-content .guide-callout--tip {
  border-color: #3ccf6e;
  background: rgba(60, 207, 110, 0.1);
}

.guide-content .guide-callout--warning {
  border-color: #f0a43a;
  background: rgba(240, 164, 58, 0.1);
}

.guide-content .guide-callout--danger {
  border-color: #ef5b5b;
  background: rgba(239, 91, 91, 0.1);
}

.guide-empty {
  padding: 3rem 0;
  text-align: center;
}

/* ---------------------------------------------------------------- Mobile : menu en tiroir */
.guide-nav-toggle,
.guide-nav-backdrop {
  display: none;
}

@media (max-width: 991px) {
  .guide-hero {
    padding-top: 6.5rem;
  }

  .guide-layout {
    grid-template-columns: minmax(0, 1fr);
    padding: 1.25rem 0.75rem 5.5rem;
  }

  .guide-nav {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1060;
    width: min(330px, 88vw);
    max-height: none;
    align-self: stretch;
    border-radius: 0 14px 14px 0;
    transform: translateX(-105%);
    transition: transform 0.25s ease-out;
  }

  .guide-page.nav-open .guide-nav {
    transform: none;
  }

  .guide-nav__close {
    display: block;
  }

  .guide-nav-toggle {
    display: block;
    position: fixed;
    bottom: 1.1rem;
    left: 50%;
    z-index: 1040;
    padding: 0.7rem 1.4rem;
    border: 0;
    border-radius: 100px;
    background: var(--g-blue);
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
    transform: translateX(-50%);
  }

  .guide-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1055;
    background: rgba(0, 0, 0, 0.55);
  }

  .guide-page.nav-open .guide-nav-backdrop {
    display: block;
  }

  .guide-section {
    padding: 1.4rem 1.1rem 0.75rem;
  }

  .guide-section__break {
    margin-left: -1.1rem;
    margin-right: -1.1rem;
  }

  .guide-section__title {
    font-size: 1.5rem;
  }

  .guide-content .guide-topic__title {
    font-size: 1.15rem;
  }

  .guide-content .guide-text {
    font-size: 0.95rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .guide-nav,
  .guide-menu__toggle::before {
    transition: none;
  }

  .guide-content .guide-topic:target {
    animation: none;
  }
}
