/* ═══════════════════════════════════════════════════
   shared-header.css
   Shared sticky header and footer for every page.
   Load BEFORE any page-specific styles.

   Sections:
     0.  Font — self-hosted Inter (eliminates Google Fonts FOUT on OCI)
     1.  Reset & base
     2.  Header shell
     3.  Brand (logo + name + badge)
     4.  Nav links (centered)
     5.  Product dropdown
     6.  Header right (auth buttons)
     7.  Status dot (live indicator)
     8.  User chip + avatar
     9.  User dropdown menu
     10. Hamburger button
     11. Mobile menu drawer
     12. Footer
     13. Responsive breakpoints
═══════════════════════════════════════════════════ */

/* ── 0. Font — Inter via Google Fonts with font-display:swap ─
   Using font-display:swap ensures the header renders with Inter
   immediately on first paint even on slow connections (OCI),
   preventing the fallback-font size difference you see vs localhost.
   The preconnect hints below (in <head>) further reduce latency.
   ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap&font-display=swap');


/* ── 1. Reset & base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}
body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  /* Fix 3 — flex column keeps footer anchored, prevents flicker on view switch */
  display: flex;
  flex-direction: column;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
               'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;  

}
/* Fix 3 — main content fills available space so footer never jumps */
body > .main { flex: 1; min-height: 70vh; }

  /* Explicit Inter fallback stack — matches Inter metrics closely so layout
     doesn't shift when the web font arrives (reduces OCI visual difference) */



/* ── 2. Header shell ─────────────────────────────── */
.header {
  background: #ffffff;
  border-bottom: 1px solid #e4e6ef;
  height: 72px;
  width: 100%;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1000;
  /* NOTE: isolation:isolate removed — it created a stacking context that
     trapped the nav dropdown z-index inside the header, causing clicks on
     dropdown items to be intercepted by page content beneath them. */
}
/* Full-width inner with padding — stretches edge to edge */
.header-inner {
  width: 85%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0;
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
}


/* ── 3. Brand ────────────────────────────────────── */
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 40px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-name {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f1120;
  letter-spacing: -.03em;
  /* Prevent font-size from shifting if root em is different across environments */
  line-height: 1;
}
.brand-badge {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: .63rem;
  font-weight: 700;
  color: #2563eb;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 99px;
  padding: 2px 8px;
  letter-spacing: .04em;
  text-transform: uppercase;
}


/* ── 4. Nav links (centered) ─────────────────────── */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.nav-link {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 500;
  color: #4a4d6a;
  text-decoration: none;
  transition: all .15s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  white-space: nowrap;
  letter-spacing: .01em;
}
.nav-link:hover  { background: #f7f8fc; color: #0f1120; }
.nav-link.active { color: #2563eb; background: #f0f9ff; }


/* ── 5. Product dropdown ─────────────────────────── */
.nav-dropdown-wrap { position: relative; }

.nav-link-dd       { display: flex; align-items: center; gap: 3px; }
.nav-link-dd.open  { color: #2563eb; background: #f0f9ff; }
.nav-dd-chevron    { transition: transform .2s; }
.nav-link-dd.open .nav-dd-chevron { transform: rotate(180deg); }

.nav-dd {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #ffffff;
  border: 1px solid #e4e6ef;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
  min-width: 252px;
  overflow: hidden;
  z-index: 300;
}
.nav-dd.show {
  display: block;
  animation: shNavDdIn .15s ease;
}
@keyframes shNavDdIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.nav-dd-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  font-size: .85rem;
  font-weight: 500;
  color: #4a4d6a;
  cursor: pointer;
  transition: background .1s;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
}
.nav-dd-item:hover              { background: #f7f8fc; }
.nav-dd-item:hover .nav-dd-title { color: #2563eb; }
.nav-dd-title { font-size: .85rem; font-weight: 600; color: #0f1120; line-height: 1.3; }
.nav-dd-desc  { font-size: .74rem; color: #9496b0; margin-top: 1px; }


/* ── 6. Header right ─────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: auto;
  visibility: hidden; /* hidden until auth check completes via JS revealHeader() */
  /* Safety fallback — if JS is blocked or very slow on OCI, CSS animation
     forces visibility after 3s so the header never stays blank permanently */
  animation: _sh-reveal-fallback 0s 3s forwards;
}
@keyframes _sh-reveal-fallback {
  to { visibility: visible; }
}
/* Fix 5 — hamburger also hidden until auth check completes */
#sh-hamburger {
  visibility: hidden;
  animation: _sh-reveal-fallback 0s 3s forwards;
}

.hbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-weight: 600;
  font-size: .82rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s;
  padding: 7px 14px;
  text-decoration: none;
  white-space: nowrap;
  border: none;
}
.hbtn-ghost   { background: transparent; border: 1px solid #e4e6ef; color: #4a4d6a; }
.hbtn-ghost:hover  { border-color: #d0d3e8; color: #0f1120; background: #f7f8fc; }
.hbtn-primary { background: #2563eb; color: #fff; }
.hbtn-primary:hover  { background: #1d4ed8; box-shadow: 0 4px 14px rgba(37,99,235,.4); transform: translateY(-1px); }
.hbtn-primary:active { transform: none; box-shadow: none; }


/* ── 7. Status dot ───────────────────────────────── */
.status-dot      { width: 6px; height: 6px; border-radius: 50%; background: #d0d3e8; flex-shrink: 0; }
.status-dot.live { background: #12b76a; box-shadow: 0 0 0 3px rgba(18,183,106,.15); animation: shPgr 2s infinite; }
@keyframes shPgr {
  0%,100% { box-shadow: 0 0 0 3px rgba(18,183,106,.15); }
  50%     { box-shadow: 0 0 0 6px rgba(18,183,106,.05); }
}


/* ── 8. User chip + avatar ───────────────────────── */
.user-menu { position: relative; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 6px;
  background: #f7f8fc;
  border: 1px solid #e4e6ef;
  border-radius: 99px;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 500;
  color: #4a4d6a;
  transition: border-color .15s;
  user-select: none;
}
.user-chip:hover { border-color: #d0d3e8; }

.user-av {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.user-av img { width: 100%; height: 100%; object-fit: cover; }

.uc-chevron {
  width: 14px;
  height: 14px;
  color: #9496b0;
  transition: transform .2s;
  flex-shrink: 0;
}
.user-chip.open .uc-chevron { transform: rotate(180deg); }


/* ── 9. User dropdown menu ───────────────────────── */
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #ffffff;
  border: 1px solid #e4e6ef;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.12);
  min-width: 200px;
  overflow: hidden;
  z-index: 200;
}
.user-dropdown.show { display: block; animation: shUdIn .15s ease; }
@keyframes shUdIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}

.ud-header { padding: 14px 16px 10px; border-bottom: 1px solid #e4e6ef; }
.ud-name   { font-size: .88rem; font-weight: 600; color: #0f1120; }
.ud-email  { font-size: .75rem; color: #9496b0; margin-top: 1px; }

.ud-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: .85rem;
  font-weight: 500;
  color: #4a4d6a;
  cursor: pointer;
  transition: background .1s;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: 'Inter', sans-serif;
  text-decoration: none;
}
.ud-item:hover         { background: #f7f8fc; color: #0f1120; }
.ud-item.active        { color: #2563eb; }
.ud-item.danger        { color: #f04438; }
.ud-item.danger:hover  { background: #fef3f2; }
.ud-item svg           { width: 15px; height: 15px; flex-shrink: 0; opacity: .7; }

.ud-sep { height: 1px; background: #e4e6ef; margin: 4px 0; }


/* ── 10. Hamburger button ────────────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid #e4e6ef;
  border-radius: 9px;
  cursor: pointer;
  margin-left: auto;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
  padding: 0;
}
.hamburger:hover { background: #f7f8fc; border-color: #d0d3e8; }
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #4a4d6a;
  border-radius: 99px;
  transition: transform .25s ease, opacity .25s ease, width .25s ease;
}
/* Open state — turns into X */
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }


/* ── 11. Mobile menu drawer ──────────────────────── */
.mobile-menu {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  z-index: 99;
  overflow-y: auto;
  flex-direction: column;
  padding: 16px 0 40px;
  border-top: 1px solid #e4e6ef;
  animation: mobileMenuIn .22s ease;
}
.mobile-menu.show { display: flex; }
@keyframes mobileMenuIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

/* Mobile nav links */
.mob-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  font-size: 1rem;
  font-weight: 500;
  color: #4a4d6a;
  text-decoration: none;
  border: none;
  background: none;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background .1s;
}
.mob-nav-link:hover { background: #f7f8fc; color: #0f1120; }
.mob-nav-link.active { color: #2563eb; }

/* Product section in mobile menu */
.mob-section-title {
  font-size: .65rem;
  font-weight: 700;
  color: #9496b0;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 16px 24px 8px;
}

/* Sub-items under Product */
.mob-sub-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px 11px 32px;
  font-size: .9rem;
  font-weight: 500;
  color: #4a4d6a;
  text-decoration: none;
  transition: background .1s;
}
.mob-sub-item:hover { background: #f7f8fc; }
.mob-sub-title { font-size: .88rem; font-weight: 600; color: #0f1120; }
.mob-sub-desc  { font-size: .74rem; color: #9496b0; margin-top: 1px; }

/* Divider */
.mob-divider { height: 1px; background: #e4e6ef; margin: 12px 0; }

/* Auth buttons at bottom of mobile menu */
.mob-auth {
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}
.mob-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  background: #2563eb;
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: .95rem;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}
.mob-btn-primary:hover { background: #1d4ed8; }
.mob-btn-ghost {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  background: transparent;
  color: #4a4d6a;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: .95rem;
  border-radius: 10px;
  border: 1px solid #e4e6ef;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.mob-btn-ghost:hover { background: #f7f8fc; border-color: #d0d3e8; }

/* Mobile user section */
.mob-user-section {
  padding: 16px 24px;
  border-top: 1px solid #e4e6ef;
  margin-top: 8px;
}
.mob-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.mob-user-av {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.mob-user-av img { width: 100%; height: 100%; object-fit: cover; }
.mob-user-name  { font-size: .92rem; font-weight: 600; color: #0f1120; }
.mob-user-email { font-size: .76rem; color: #9496b0; margin-top: 1px; }


/* ── 12. Footer ──────────────────────────────────── */
.footer { background: #0a0b14; color: rgba(255,255,255,.85); width: 100%; display: block; }

.footer-top {
  width: 80%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 56px 0 48px;
  display: grid;
  grid-template-columns: 1.8fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer-brand      { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.footer-brand-mark { width: 32px; height: 32px; background: transparent; display: flex; align-items: center; justify-content: center; }
.footer-brand-name { font-size: 1rem; font-weight: 700; color: #fff; }
.footer-desc       { font-size: .85rem; color: rgba(255,255,255,.45); line-height: 1.65; max-width: 260px; margin-bottom: 24px; }

.footer-social { display: flex; gap: 10px; }
.social-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #1e1f2e;
  border: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  color: rgba(255,255,255,.6);
}
.social-btn:hover { background: rgba(14,165,233,.25); border-color: rgba(14,165,233,.35); color: #fff; }
.social-btn svg   { width: 15px; height: 15px; }

.footer-col-title {
  font-size: .72rem;
  font-weight: 700;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  letter-spacing: .1em;
  margin-bottom: 16px;
}
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-link {
  font-size: .85rem;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  transition: color .15s;
  cursor: pointer;
  background: none;
  border: none;
  font-family: 'Inter', sans-serif;
  text-align: left;
}
.footer-link:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.07);
  width: 80%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.footer-copy    { font-size: .78rem; color: rgba(255,255,255,.3); }
.footer-legal   { display: flex; gap: 20px; }
.footer-legal a { font-size: .78rem; color: rgba(255,255,255,.3); text-decoration: none; transition: color .15s; }
.footer-legal a:hover { color: rgba(255,255,255,.7); }


/* ── 13. Responsive ──────────────────────────────── */
@media (max-width: 900px) {
  /* Hide desktop nav, show hamburger */
  .nav-links    { display: none !important; }
  .hamburger    { display: flex; }
  /* Hide desktop auth buttons — shown inside mobile menu instead */
  .header-right { display: none !important; }
  /* Special override: keep header-right visible only for the hamburger container */
  .header-inner { width: 95%; }

  .footer-top    { grid-template-columns: 1fr 1fr; }

}

@media (max-width: 600px) {
  .footer-top    { grid-template-columns: 1fr; width: 95%; }
  .footer-bottom { flex-direction: column; align-items: flex-start; width: 95%; gap: 8px; }
  .footer-desc   { max-width: 100%; }
}