/* Menu mobile premium — bottom sheet (☰ header + Plus) */

.app-menu {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: auto;
}

.app-menu:not(.is-open) {
  visibility: hidden;
  pointer-events: none;
}

.app-menu.is-open {
  visibility: visible;
  pointer-events: auto;
}

.app-menu__scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.app-menu.is-open .app-menu__scrim {
  opacity: 1;
}

.app-menu__sheet {
  position: relative;
  width: 100%;
  max-height: min(88vh, 720px);
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -24px 64px rgba(15, 23, 42, 0.22);
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.34s cubic-bezier(0.22, 1, 0.36, 1);
  outline: none;
  overflow: hidden;
}

.app-menu.is-open .app-menu__sheet {
  transform: translateY(0);
}

.app-menu__handle {
  flex-shrink: 0;
  width: 40px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: #cbd5e1;
}

.app-menu__hero {
  flex-shrink: 0;
  position: relative;
  padding: 16px 20px 18px;
  background: linear-gradient(135deg, #6665dd 0%, #4338ca 100%);
  color: #fff;
}

.app-menu__hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.app-menu__close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.app-menu__user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-menu__avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.app-menu__user-text {
  min-width: 0;
}

.app-menu__name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-menu__plan {
  display: inline-block;
  margin-top: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.app-menu__scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px 12px;
}

.app-menu__group {
  margin-bottom: 8px;
}

.app-menu__group-title {
  margin: 8px 8px 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #94a3b8;
}

.app-menu__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  margin-bottom: 2px;
  border-radius: 12px;
  color: #0f172a;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.15s ease;
}

.app-menu__row:hover {
  background: #f8fafc;
}

.app-menu__row.is-active {
  background: #ede9fe;
  color: #4338ca;
}

.app-menu__row-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.app-menu__row.is-active .app-menu__row-icon {
  background: #fff;
  box-shadow: 0 0 0 1px rgba(102, 101, 221, 0.25);
}

.app-menu__row-label {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.app-menu__row-chevron {
  color: #cbd5e1;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.app-menu__row.is-active .app-menu__row-chevron {
  color: #a5b4fc;
}

.app-menu__footer {
  flex-shrink: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #e2e8f0;
  background: #fafafa;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.app-menu__footer .lang-switcher {
  width: 100%;
}

.app-menu__footer .lang-switcher__select {
  width: 100%;
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 0.88rem;
}

.app-menu__foot-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed #cbd5e1;
  background: #fff;
  color: #334155;
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
}

.app-menu__logout {
  width: 100%;
  padding: 11px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #dc2626;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

body.app-menu-open {
  overflow: hidden;
}

/* Mobile / tablette étroite uniquement */
@media (max-width: 900px) {
  html.exone-mobile .nav__toggle,
  html.is-app-compact .nav__toggle {
    display: flex !important;
    order: 10;
    position: relative;
    z-index: 300;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
  }

  html.exone-mobile .nav,
  html.is-app-compact .nav {
    z-index: 250;
  }

  html.exone-mobile .nav__links,
  html.is-app-compact .nav__links {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }
}

/* Masquer les liens nav inline sur mobile — menu sheet uniquement */
@media (max-width: 900px) {
  body:not(.landing) .nav__links {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  body:not(.landing) .nav__toggle {
    display: flex;
    order: 10;
    position: relative;
    z-index: 130;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  body:not(.landing) .nav__inner {
    flex-wrap: nowrap;
    align-items: center;
  }

  body:not(.landing) .brand {
    min-width: 0;
    flex: 1 1 auto;
  }
}

/* Téléphone / tablette — en-tête pro : Exxon-bat toujours visible */
@media (max-width: 900px) and (not ((hover: hover) and (pointer: fine))) {
  .nav {
    position: relative;
    z-index: 50;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border, #e2e8f0);
  }

  .nav__inner {
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    min-height: 56px;
  }

  .nav-back {
    order: 0;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    min-width: 36px;
    margin-right: 0;
  }

  .brand {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    gap: 10px;
  }

  body:has(.nav-back) .brand {
    max-width: none;
  }

  .brand__logo {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 11px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.1);
  }

  .brand__logo img {
    border-radius: 11px;
  }

  .brand__text {
    min-width: 0;
    flex: 1;
  }

  .brand__name {
    display: block !important;
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    color: var(--navy, #0f172a);
  }

  .brand__tag {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.25;
    margin-top: 2px;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .nav__toggle {
    order: 2;
    flex-shrink: 0;
    margin-left: auto;
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 9px;
  }
}

@media (max-width: 380px) and (not ((hover: hover) and (pointer: fine))) {
  .brand__tag {
    font-size: 0.62rem;
  }

  .brand__name {
    font-size: 1.05rem;
  }
}

/* PC — barre complète, liens visibles, pas de menu ☰ (défile avec la page) */
@media (min-width: 901px) {
  .nav__toggle {
    display: none !important;
  }

  .nav__links {
    display: flex !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }

  html.is-app-compact .nav__toggle,
  html.exone-mobile .nav__toggle {
    display: none !important;
  }

  html.is-app-compact .nav__links,
  html.exone-mobile .nav__links {
    display: flex !important;
    visibility: visible !important;
    height: auto !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }

  .app-menu {
    display: none !important;
  }
}

/* PC fenêtre étroite — logo + Exxon-bat visibles, liens défilables (pas de ☰) */
@media (max-width: 1100px) and (hover: hover) and (pointer: fine) {
  .nav__inner {
    flex-wrap: nowrap !important;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
  }

  .brand {
    flex: 0 0 auto !important;
    order: 0 !important;
    min-width: 0;
    max-width: 11rem;
  }

  .brand__logo {
    width: 36px;
    height: 36px;
  }

  .brand__name {
    display: block !important;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand__tag {
    display: none !important;
  }

  .nav__links {
    display: flex !important;
    flex: 1 1 auto !important;
    order: 1 !important;
    min-width: 0;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    gap: 4px;
    scrollbar-width: none;
  }

  .nav__links::-webkit-scrollbar {
    display: none;
  }

  .nav__link {
    flex-shrink: 0;
    padding: 0 9px;
    height: 32px;
    min-height: 32px;
    font-size: 0.74rem;
  }

  .nav__user {
    flex-shrink: 0;
    max-width: 7rem;
  }
}
