/*
 * The sidebar+banner shell for every self-serve partner screen (Dashboard,
 * Pipeline, Clients, Promotion, Team, Mon compte) — replaces the old flat
 * top-nav-only layout. Follows the same square/hairline visual language
 * partner-cabinet.css already established for the Cabinet/Agent screens,
 * extended here to the whole portal shell rather than kept scoped to
 * .cabinet-panel, since Jon's roadmap explicitly asks for one consistent
 * interface language across every tab, not just the team-management ones.
 */

/* Alpine.js hides [x-cloak] elements until it finishes initializing —
   without this rule the attribute has no effect and content can flash
   visibly (used by layout.blade.php and partner-link-card.blade.php).
   Deliberately kept HERE rather than in assets/css/base.css: that file is
   this app's copy of the marketing site's own stylesheet, and every
   deploy's rsync from ../repperio silently overwrites it, which already
   wiped this exact rule out of production once — see CLAUDE.md's "One
   docroot, two domains, two repos" section. partner-shell.css only exists
   in this repo, so it survives every deploy. */
[x-cloak] {
  display: none !important;
}

.partner-shell {
  display: flex;
  min-height: 100vh;
}

.partner-sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--color-navy);
  display: flex;
  flex-direction: column;
  padding: var(--space-3) 0;
}

.partner-sidebar__logo {
  display: block;
  padding: 0 var(--space-3) var(--space-3);
}

.partner-sidebar__logo img {
  width: 100%;
  height: auto;
}

.partner-sidebar__nav {
  display: flex;
  flex-direction: column;
}

.partner-sidebar__item {
  color: #c7d2e8;
  text-decoration: none;
  padding: 0.75rem var(--space-3);
  border-left: 3px solid transparent;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.partner-sidebar__item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.partner-sidebar__item--active,
.partner-sidebar__item--active:hover {
  background: rgba(255, 255, 255, 0.08);
  border-left-color: var(--color-accent);
  color: #fff;
}

.partner-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.partner-topbar {
  height: 64px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 var(--space-3);
  gap: var(--space-3);
  background: #fff;
}

.partner-topbar__burger {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--color-border);
  background: #fff;
  padding: 0;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.partner-topbar__burger:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-text-muted);
}

.partner-topbar__burger:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.partner-topbar__burger-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--color-navy);
}

.partner-topbar__logo {
  display: none;
}

.partner-content {
  padding: var(--space-5, 2rem) var(--space-3);
}

/* Every plain <table> rendered inside the content area (Dashboard's "Mes
   demandes", Clients) gets a horizontal-scroll safety net on narrow
   viewports — cheaper than a full stacked-card redesign for this task,
   and prevents columns from being crushed unreadable on a phone. Team's
   own .cabinet-table already has its own richer thead-hidden/stacked-row
   treatment (partner-cabinet.css) and is unaffected by this rule. */
.partner-content table:not(.cabinet-table) {
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.partner-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.partner-notifications {
  position: relative;
}

.partner-notifications__button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-navy);
}

.partner-notifications__button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.partner-notifications__button svg {
  width: 22px;
  height: 22px;
}

.partner-notifications__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}

.partner-notifications__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--color-border);
  width: 320px;
  max-width: 90vw;
  max-height: 420px;
  overflow-y: auto;
  z-index: 20;
}

.partner-notifications__menu-header {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.partner-notifications__menu-header button {
  background: none;
  border: none;
  color: var(--color-primary);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}

.partner-notifications__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--space-3);
  border: none;
  border-bottom: 1px solid var(--color-border);
  background: none;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.partner-notifications__item:last-child {
  border-bottom: none;
}

.partner-notifications__item:hover {
  background: var(--color-bg-alt);
}

.partner-notifications__item--unread {
  background: #fff4f1;
}

.partner-notifications__item-message {
  display: block;
  margin: 0 0 0.2rem;
}

.partner-notifications__item-time {
  display: block;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.partner-notifications__empty {
  padding: var(--space-3);
  color: var(--color-text-muted);
}

.partner-profile {
  position: relative;
}

.partner-profile__button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.partner-profile__button:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.partner-profile__avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-navy);
  color: #fff;
  font-weight: 700;
  transition: background-color 0.15s ease;
}

.partner-profile__button:hover .partner-profile__avatar {
  background: var(--color-primary);
}

.partner-profile__name small {
  display: block;
  font-weight: 400;
  color: var(--color-text-muted);
}

.partner-profile__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #fff;
  border: 1px solid var(--color-border);
  min-width: 220px;
  z-index: 20;
}

.partner-profile__menu-header {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.partner-profile__menu a,
.partner-profile__menu form button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem var(--space-3);
  border: none;
  background: none;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.partner-profile__menu a:hover,
.partner-profile__menu form button:hover {
  background: var(--color-bg-alt);
}

@media (max-width: 768px) {
  .partner-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 30;
  }

  .partner-sidebar--open {
    transform: translateX(0);
  }

  /* Three-column grid instead of the flex/margin-auto trick used at desktop
     width: burger and profile are guaranteed equal-width (40px) tap targets,
     so the middle column mathematically centers the logo between them
     instead of it drifting toward whichever side is lighter. */
  .partner-topbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    column-gap: var(--space-2);
  }

  .partner-topbar__burger {
    display: flex;
    justify-self: start;
  }

  .partner-topbar__logo {
    display: block;
    justify-self: center;
    width: 104px;
    height: auto;
  }

  .partner-topbar__actions {
    justify-self: end;
  }

  /* Full name/cabinet text is what pushes the fixed-height topbar into
     wrapping to 2-3 lines and overflowing on a narrow viewport — the
     avatar alone stays tappable and opens the same dropdown, which still
     shows the full name/email/cabinet in comfortable, unconstrained
     width. */
  .partner-profile__name {
    display: none;
  }

  .partner-sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 31, 58, 0.4);
    z-index: 25;
  }
}
