/* partner-shell.css — Partner shell (sidebar + top header + mobile bottom nav) */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600;700&display=swap');

:root {
  --sidebar-w: 72px; /* compact rail width */
}

/* Ensure consistent box-sizing on all partner pages
   (even when Tailwind isn't loaded) */
body.partner-shell,
body.partner-shell * ,
body.partner-shell *::before,
body.partner-shell *::after {
  box-sizing: border-box;
}
/* Base body */
body {
  font-family: "Poppins", ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
  background: #f6f7fb;
}

/* Partner shell context */
body.partner-shell {
  padding-top: 64px;          /* room for fixed top header */
}
body.partner-shell #siteHeader {
  display: none; /* hide main site header on partner shell pages */
}

/* Expanded sidebar on desktop */
body.partner-shell.sidebar-expanded {
  --sidebar-w: 240px;
}

/* ====== Layout shell ====== */

.app-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-w);
  transition: margin-left 0.18s ease;
  position: relative;
}

/* ====== Desktop sidebar – minimal white rail ====== */

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  padding: 12px 12px 12px;
  box-shadow: 0 0 0 rgba(0, 0, 0, 0); /* almost flat by default */
  z-index: 100;
}

/* kill old glow */
.app-sidebar::before {
  content: none;
}

/* ====== Rail head (tiny logo only) ====== */

.rail-head {
  display: flex;
  align-items: center;
  justify-content: left;
  padding-left: 3px;
  padding-bottom: 10px;
}

.rail-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #1b2f7b;
  text-decoration: none;
}

.rail-logo-initials {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #2d72c9;
}

/* Partner name/email under rail logo (expanded only) */
.app-brand-meta {
  margin-top: 4px;
  padding: 0 6px;
}
.brand-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: #111827;
}
.brand-sub {
  font-size: 0.72rem;
  color: #6b7280;
}

/* hide name/email in compact rail mode */
body.partner-shell:not(.sidebar-expanded) .app-brand-meta {
  display: none;
}

/* ====== Nav ====== */

.sb-scroll {
  margin-top: 12px;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 0;
}

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Base nav link for expanded mode */
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  font-weight: 500;
  border-radius: 999px;
  color: #374151;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.12s ease;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #374151;
}

.nav-text {
  font-size: 0.82rem;
  white-space: nowrap;
}

/* Compact = icon-only rail on desktop */
body.partner-shell:not(.sidebar-expanded) .sb-nav {
  align-items: center;
}

body.partner-shell:not(.sidebar-expanded) .nav-text {
  display: none;
}

body.partner-shell:not(.sidebar-expanded) .nav-link {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: 999px;
}

/* Expanded rail shows labels, full-width pills */
body.partner-shell.sidebar-expanded .nav-link {
  justify-content: flex-start;
}

/* Hover / active states */
.nav-link:hover {
  background: #f3f4f6;
  color: #111827;
  border-color: #e5e7eb;
  transform: translateY(-1px);
}
.nav-link:hover .nav-icon {
  color: #6b7280;
}

/* Active pill look (desktop expanded + mobile) */
.nav-link.is-active {
  background: #4b5563;
  color: #ffffff;
}
.nav-link.is-active .nav-icon {
  color: #ffffff;
}

/* ====== Sidebar bottom buttons ====== */

/* Bottom buttons – always visible in the rail */
.sidebar-bottom {
  display: grid;
  padding: 12px 0px 0;
  gap: 8px;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
}

/* (keep for clarity but no different behavior; can be removed if you want)
body.partner-shell.sidebar-expanded .sidebar-bottom {
  display: grid;
}
*/

.ej-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.ej-btn-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ej-btn-icon svg {
  width: 18px;
  height: 18px;
}

.ej-btn.ghost {
  background: #f9fafb;
  border: 1px solid #e2e8f0;
  color: #111827;
}
.ej-btn.ghost:hover {
  background: #eef2ff;
}

.ej-btn.primary {
  background: #003193;
  color: #f9fafb;
}

.ej-btn.primary:hover {
  background: #26357b;
}

/* When rail is compact, strip labels inside buttons (just icons if you add them) */
body.partner-shell:not(.sidebar-expanded) .sidebar-bottom .ej-btn-text {
  display: none;
}
body.partner-shell:not(.sidebar-expanded) .sidebar-bottom .ej-btn {
  padding-inline: 0;
  width: 40px;
  justify-self: center;
}

/* ====== Fixed white top header (desktop) ====== */

.partner-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  padding: 0 20px;
  column-gap: 16px;
  z-index: 40;
}

/* Hamburger + notification buttons */
.partner-topbar-btn {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.partner-topbar-btn svg {
  width: 18px;
  height: 18px;
}

/* Title stack ("Partner" + page name) */
.partner-topbar-title {
  display: flex;
  flex-direction: column;
}

.partner-topbar-label {
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9ca3af;
}

.partner-topbar-page {
  font-size: 0.98rem;
  font-weight: 600;
  color: #0f172a;
}

/* Spacer pushes pill + icons to the right */
.partner-topbar-spacer {
  flex: 1 1 auto;
}

/* "Receiving requests" pill */
.partner-topbar-pill {
  font-size: 0.78rem;
  padding: 4px 9px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #15803d;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
}

.partner-topbar-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
}

/* Avatar on far right */
.partner-topbar-avatar {
  margin-left: 6px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f172a, #020617);
  color: #f9fafb;
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ====== Topbar notifications popover ====== */

.partner-topbar-notif-popover {
  position: fixed;
  top: 64px;
  right: 24px;
  width: 280px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.18);
  border: 1px solid #e5e7eb;
  padding-top: 8px;
  padding-bottom: 6px;
  display: none;
  z-index: 60;
}

.partner-topbar-notif-popover.is-open {
  display: block;
}

.partner-topbar-notif-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 0 10px 4px;
}

.partner-topbar-notif-item {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.8rem;
  color: #111827;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.partner-topbar-notif-item + .partner-topbar-notif-item {
  margin-top: 4px;
}

.partner-topbar-notif-item:hover {
  background: #f3f4f6;
}

.partner-topbar-notif-title {
  font-weight: 600;
}

.partner-topbar-notif-meta {
  font-size: 0.7rem;
  color: #6b7280;
}

.partner-topbar-notif-empty {
  padding: 10px 12px 8px;
  font-size: 0.8rem;
  color: #6b7280;
}

.partner-topbar-notif-footer {
  margin-top: 4px;
  padding: 6px 14px 4px;
  border-top: 1px solid #e5e7eb;
  text-align: right;
}

.partner-topbar-notif-footer a {
  font-size: 0.78rem;
  font-weight: 600;
  color: #025fbc;
  text-decoration: none;
}

.partner-topbar-notif-footer a:hover {
  text-decoration: underline;
}

/* ====== Mobile bottom nav (unchanged) ====== */

.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 58px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.mobile-bottom-nav a {
  text-align: center;
  flex: 1;
  padding-top: 4px;
  color: #64748b;
  font-size: 12px;
  text-decoration: none;
}

.mobile-bottom-nav a .icon {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  margin: 0 auto 2px;
}

.mobile-bottom-nav a.active {
  color: #0f172a;
  font-weight: 600;
}

/* ====== Mobile: overlay rail + separate mobile topbar ====== */

@media (max-width: 960px) {
  body.partner-shell {
    padding-top: 56px; /* mobile header */
  }

  .partner-topbar {
    display: none; /* use mobile topbar instead */
  }

  .app-shell {
    margin-left: 0;
  }

  .app-sidebar {
    width: 260px;
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    box-shadow: none;
  }

  .app-shell.app-shell--sidebar-open .app-sidebar {
    transform: translateX(0);
    box-shadow: 10px 0 26px rgba(15, 23, 42, 0.6);
  }

  .app-shell::before {
    content: none;
  }

  .app-shell.app-shell--sidebar-open::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    opacity: 1;
    pointer-events: auto;
    z-index: 40;
  }

  /* NAV: full-width pills, left aligned on mobile */
  body.partner-shell .sb-nav {
    align-items: stretch;
  }

  body.partner-shell:not(.sidebar-expanded) .nav-link,
  body.partner-shell.sidebar-expanded .nav-link {
    width: 100%;
    height: auto;
    padding: 8px 14px;
    justify-content: flex-start;
    text-align: left;
  }

  body.partner-shell .nav-text {
    display: inline-block;
  }

  body.partner-shell:not(.sidebar-expanded) .nav-text {
    display: inline-block;
  }

  /* Active pill on mobile – same style, just full-width */
  body.partner-shell .nav-link.is-active {
    background: #4b5563;
    color: #ffffff;
  }
  body.partner-shell .nav-link.is-active .nav-icon {
    color: #ffffff;
  }

  /* Bottom buttons: full-width with text */
  body.partner-shell .sidebar-bottom {
    display: grid;
  }

  body.partner-shell .sidebar-bottom .ej-btn-text {
    display: inline-block;
  }

  body.partner-shell .sidebar-bottom .ej-btn {
    width: 100%;
    padding-inline: 14px;
    justify-content: center;
  }
}

/* Mobile topbar generated by JS (partnerMobileTopbar) */
.mobile-partner-topbar-global {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  z-index: 60;
}
.mobile-top-left {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mobile-top-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
}
.mobile-top-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: #111827;
  color: #f9fafb;
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 960px) {
  /* Show partner name/email under avatar on mobile */
  body.partner-shell .app-brand-meta {
    display: block !important;
    padding: 6px 16px 10px;
  }

  .rail-head {
    padding-left: 8px;
  }
  body.partner-shell .brand-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #111827;
  }

  body.partner-shell .brand-sub {
    font-size: 0.72rem;
    color: #6b7280;
  }
}

@media (max-width: 960px) {
  /* Ensure bottom buttons show their labels on mobile */
  body.partner-shell .sidebar-bottom .ej-btn-text {
    display: inline-block !important;
  }

  body.partner-shell .sidebar-bottom .ej-btn {
    width: 100% !important;
    padding-inline: 14px !important;
    justify-content: center !important;
  }
}

/* Hide mobile partner topbar on large screens (desktop uses .partner-topbar) */
@media (min-width: 961px) {
  .mobile-partner-topbar-global {
    display: none;
  }
}

/* Logout button – separate variant */
.ej-btn-logout {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.ej-btn-logout:hover {
  background: #fecaca;
  color: #991b1b;
}
