/* Navigation dropdowns */
.nd-nav-dropdown {
  position: relative;
}

.nd-nav-dropdown-trigger {
  font-family: var(--nd-mono);
  font-size: 12px;
  letter-spacing: .5px;
  color: var(--nd-text2);
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .2s;
}

.nd-nav-dropdown-trigger:hover,
.nd-nav-dropdown-trigger.active,
.nd-nav-dropdown.open > .nd-nav-dropdown-trigger {
  color: var(--nd-green);
  background: rgba(0,255,148,.07);
}

.nd-nav-dropdown-trigger svg {
  width: 15px;
  height: 15px;
}

.nd-nav-chevron {
  width: 12px !important;
  height: 12px !important;
  transition: transform .2s;
}

.nd-nav-dropdown.open .nd-nav-chevron {
  transform: rotate(180deg);
}

.nd-nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 220px;
  max-width: min(340px, 90vw);
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 8px;
  background: var(--nd-bg2);
  border: 1px solid var(--nd-border);
  border-radius: 8px;
  box-shadow: 0 16px 35px rgba(0,0,0,.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility .18s;
  z-index: 600;
}

.nd-nav-dropdown.open > .nd-nav-dropdown-menu,
.nd-nav-dropdown:hover > .nd-nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nd-nav-dropdown-menu > a,
.nd-nav-dropdown-group > a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--nd-text2);
  text-decoration: none;
  font-size: 13px;
  border-radius: 5px;
}

.nd-nav-dropdown-menu > a:hover,
.nd-nav-dropdown-group > a:hover {
  color: var(--nd-green);
  background: rgba(255,255,255,.05);
}

.nd-nav-dropdown-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--nd-border);
}

.nd-nav-dropdown-group > span {
  display: block;
  padding: 2px 10px 4px;
  color: var(--nd-text3);
  font-family: var(--nd-mono);
  font-size: 10px;
  letter-spacing: .8px;
  text-transform: uppercase;
}

.nd-nav-profile-menu {
  right: 0;
  left: auto;
  min-width: 210px;
}

.nd-nav-profile-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nd-nav-profile-menu svg {
  width: 15px;
  height: 15px;
}

.nd-nav-menu-separator {
  display: block;
  height: 1px;
  margin: 6px 2px;
  background: var(--nd-border);
}

.nd-nav-danger {
  color: #f87171 !important;
}

.nd-nav-danger:hover {
  background: rgba(248,113,113,.08) !important;
}

.nd-sidebar-account-actions {
  margin-top: 8px;
}

.nd-menu-danger {
  color: #f87171 !important;
}

.nd-mobile-bottom-nav {
  display: none;
}

@media (max-width: 900px) {
  .nd-nav-dropdown-menu {
    display: none;
  }

  body .nd-navbar-public {
    height: 56px;
    display: flex;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 16px;
    border-bottom-color: rgba(255, 255, 255, .12);
    background: rgba(6, 8, 16, .76);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
  }

  .nd-navbar-public > :not(.nd-navbar-brand):not(.nd-theme-toggle):not(.nd-lang-switch):not(.nd-currency-switch) {
    display: none;
  }

  .nd-navbar-public .nd-navbar-brand {
    font-size: 15px;
    letter-spacing: 1.4px;
  }

  .nd-navbar-public .nd-navbar-brand svg {
    width: 18px;
    height: 18px;
  }

  .nd-navbar-public .nd-theme-toggle {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    margin-left: auto;
    border: 1px solid var(--nd-border);
    background: color-mix(in srgb, var(--nd-bg2) 76%, transparent);
  }

  .nd-navbar-public .nd-lang-switch {
    display: flex !important;
    align-items: center;
    flex: 0 0 auto;
    margin: 0;
    visibility: visible;
    opacity: 1;
    position: relative;
    z-index: 2;
  }

  .nd-navbar-public .nd-lang-btn {
    display: inline-flex !important;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--nd-border);
    background: color-mix(in srgb, var(--nd-bg2) 76%, transparent);
    color: var(--nd-green);
    font-family: var(--nd-mono);
    font-size: 12px;
    font-weight: 700;
    visibility: visible;
    opacity: 1;
  }

  .nd-navbar-public .nd-lang-flag {
    font-size: 12px;
  }

  .nd-navbar-public .nd-currency-switch {
    display: flex !important;
    flex: 0 0 auto;
    margin: 0;
  }

  .nd-navbar-public .nd-currency-select {
    height: 38px;
    max-width: 70px;
    background: color-mix(in srgb, var(--nd-bg2) 76%, transparent);
  }

  html.nd-light body .nd-navbar-public {
    border-bottom-color: rgba(31, 71, 112, .13);
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 10px 30px rgba(31, 71, 112, .10);
  }

  html.nd-light .nd-navbar-public .nd-theme-toggle,
  html.nd-light .nd-navbar-public .nd-lang-btn {
    background: rgba(255, 255, 255, .76);
  }

  .nd-mobile-bottom-nav {
    position: fixed;
    top: auto;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    width: auto;
    height: auto;
    min-height: 70px;
    z-index: 950;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 22px;
    background: rgba(10, 14, 26, .84);
    background:
      linear-gradient(135deg, rgba(255, 255, 255, .17), rgba(255, 255, 255, .045) 45%, rgba(0, 0, 0, .16)),
      color-mix(in srgb, var(--nd-bg2) 78%, transparent);
    box-shadow:
      0 18px 45px rgba(0, 0, 0, .28),
      inset 0 1px 0 rgba(255, 255, 255, .14),
      inset 0 -1px 0 rgba(0, 0, 0, .12);
    backdrop-filter: blur(24px) saturate(145%);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
    isolation: isolate;
    overflow: hidden;
  }

  .nd-mobile-bottom-nav::before {
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(59, 158, 255, .08), transparent 48%, rgba(0, 255, 148, .08));
    content: "";
    pointer-events: none;
  }

  .nd-mobile-bottom-item {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 7px 3px 6px;
    border-radius: 15px;
    color: var(--nd-text3);
    font-family: var(--nd-mono);
    font-size: 10px;
    line-height: 1.1;
    letter-spacing: .15px;
    text-align: center;
    text-decoration: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: color .2s, background .2s, transform .2s;
  }

  .nd-mobile-bottom-item:hover,
  .nd-mobile-bottom-item:focus-visible {
    color: var(--nd-text);
    background: rgba(255, 255, 255, .08);
    outline: none;
  }

  .nd-mobile-bottom-item.active {
    color: var(--nd-green);
    background: rgba(0, 255, 148, .12);
  }

  .nd-mobile-bottom-item.active .nd-mobile-bottom-icon {
    box-shadow: 0 0 18px rgba(0, 255, 148, .18);
  }

  .nd-mobile-bottom-icon {
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    border-radius: 10px;
  }

  .nd-mobile-bottom-icon svg {
    width: 17px;
    height: 17px;
    stroke-width: 2;
  }

  html.nd-light .nd-mobile-bottom-nav {
    border-color: rgba(31, 71, 112, .16);
    background:
      linear-gradient(135deg, rgba(255, 255, 255, .86), rgba(255, 255, 255, .62) 48%, rgba(224, 237, 248, .72)),
      rgba(255, 255, 255, .78);
    box-shadow:
      0 18px 45px rgba(31, 71, 112, .18),
      inset 0 1px 0 rgba(255, 255, 255, .92),
      inset 0 -1px 0 rgba(31, 71, 112, .08);
  }

  html.nd-light .nd-mobile-bottom-nav::before {
    background: linear-gradient(90deg, rgba(59, 158, 255, .11), transparent 48%, rgba(0, 175, 117, .10));
  }

  html.nd-light .nd-mobile-bottom-item.active {
    color: #087f5b;
    background: rgba(0, 175, 117, .12);
  }

  .nd-layout {
    padding-bottom: 92px;
  }

  .nd-public-student .nd-layout {
    padding-top: 56px;
  }

  .nd-home-page {
    padding-bottom: 92px;
  }

  .nd-home-page .wa-float {
    right: 16px;
    bottom: calc(94px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  /* En-tête public : logo, thème, langue et devise tiennent sur 320 px */
  body .nd-navbar-public {
    gap: 6px;
    padding: 0 12px;
  }

  .nd-navbar-public .nd-navbar-brand {
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    letter-spacing: .4px;
    white-space: nowrap;
  }

  .nd-navbar-public .nd-theme-toggle,
  .nd-navbar-public .nd-lang-btn {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
  }

  .nd-navbar-public .nd-currency-select {
    height: 34px;
    max-width: 62px;
    padding: 0 2px 0 6px;
    font-size: 11px;
  }

  .nd-mobile-bottom-nav {
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    padding: 7px 5px;
    border-radius: 19px;
  }

  .nd-mobile-bottom-item {
    font-size: 9px;
  }

  .nd-mobile-bottom-icon {
    width: 27px;
    height: 27px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nd-mobile-bottom-item {
    transition: none;
  }
}

/* Suggestions de recherche (assets/js/search-suggest.js) */
.nd-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 320px;
  max-height: min(70vh, 460px);
  overflow-y: auto;
  padding: 6px;
  background: var(--nd-bg2);
  border: 1px solid var(--nd-border2);
  border-radius: 10px;
  box-shadow: 0 16px 35px rgba(0,0,0,.35);
  z-index: 700;
}

.nd-sidebar-search .nd-suggest {
  left: 16px;
  right: 16px;
  min-width: 0;
}

.nd-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--nd-text);
  text-decoration: none;
}

.nd-suggest-item:hover,
.nd-suggest-item.is-active {
  background: rgba(0,255,148,.08);
}

.nd-suggest-type {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--nd-bg3);
  color: var(--nd-green);
  font-family: var(--nd-mono);
  font-size: 10px;
  letter-spacing: .3px;
  text-transform: uppercase;
}

.nd-suggest-type--tutorials { color: var(--nd-blue); }
.nd-suggest-type--documents { color: var(--nd-violet2); }

.nd-suggest-text {
  min-width: 0;
  display: grid;
}

.nd-suggest-text strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nd-suggest-text small {
  color: var(--nd-text3);
  font-size: 11px;
}

.nd-suggest-empty {
  padding: 10px;
  color: var(--nd-text3);
  font-size: 13px;
}

.nd-suggest-all {
  margin-top: 4px;
  border-top: 1px solid var(--nd-border);
  border-radius: 0 0 7px 7px;
  color: var(--nd-green);
  font-family: var(--nd-mono);
  font-size: 12px;
}
