/**
 * Setor Seguro — navegação unificada (portal + drawer).
 * Carregar após brand.css.
 * A index (home) deve usar apenas este ficheiro, sem ss-shell.css.
 */

:root {
  --ss-logo-h-desktop: 72px;
  --ss-logo-h-mobile: 48px;
  --ss-header-padding-y: 6px;
  --ss-header-h-mobile: 64px;
  --ss-shell-line: rgba(148, 163, 184, 0.28);
  --ss-header-glass-dark: linear-gradient(140deg, rgba(7, 16, 36, 0.86), rgba(2, 8, 24, 0.72));
  --ss-header-glass-light: linear-gradient(140deg, rgba(255, 255, 255, 0.84), rgba(247, 250, 252, 0.76));
}

.site-header.ss-unified-nav {
  background: var(--ss-header-glass-dark);
  border-bottom: 1px solid rgba(255, 208, 2, 0.28);
  box-shadow:
    0 16px 40px rgba(2, 6, 23, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px) saturate(125%);
}

[data-theme="light"] .site-header.ss-unified-nav {
  background: var(--ss-header-glass-light);
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow:
    0 16px 34px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.site-header.ss-unified-nav .menu {
  padding: 8px 10px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(140deg, rgba(15, 23, 42, 0.4), rgba(2, 6, 23, 0.22));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .site-header.ss-unified-nav .menu {
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.9), rgba(241, 245, 249, 0.86));
  border-color: rgba(15, 23, 42, 0.1);
}

.site-header.ss-unified-nav .nav-link {
  border-radius: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.site-header.ss-unified-nav .nav-link .iconify {
  width: 20px;
  height: 20px;
  opacity: 1;
}

/* ——— Portal (desktop): fora do pill do menu principal ——— */
.nav-portal {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  margin-left: 4px;
  border-left: 1px solid var(--ss-shell-line);
}

.nav-portal-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 7px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink, #e5f0ff);
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
}

.nav-portal-link .iconify {
  width: 19px;
  height: 19px;
  opacity: 1;
  color: #f8fafc;
}

[data-theme="light"] .nav-portal-link .iconify {
  color: #0f172a;
}

.nav-portal-link--cliente:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.35);
  color: #e0f2fe;
}

.nav-portal-link--equipe {
  background: linear-gradient(135deg, rgba(255, 208, 2, 0.12), rgba(255, 159, 10, 0.08));
  border-color: rgba(255, 208, 2, 0.35);
}

.nav-portal-link--equipe:hover {
  background: linear-gradient(135deg, rgba(255, 208, 2, 0.22), rgba(255, 159, 10, 0.14));
  border-color: rgba(255, 208, 2, 0.55);
}

[data-theme="light"] .nav-portal-link {
  color: #0f172a;
}

[data-theme="light"] .nav-portal-link--cliente:hover {
  background: rgba(14, 165, 233, 0.1);
  color: #0c4a6e;
}

[data-theme="light"] .nav-portal-link--equipe {
  background: linear-gradient(135deg, rgba(255, 208, 2, 0.35), rgba(255, 180, 0, 0.2));
  border-color: rgba(245, 158, 11, 0.45);
}

/* ——— Botão hamburger ——— */
.ss-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-right: 4px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.06), rgba(15, 23, 42, 0.9));
  color: #e5e7eb;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.2s, border-color 0.2s;
}

.ss-nav-toggle .iconify {
  width: 24px;
  height: 24px;
}

.ss-nav-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 208, 2, 0.45);
}

[data-theme="light"] .ss-nav-toggle {
  background: linear-gradient(145deg, #fff, #f1f5f9);
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.12);
}

/* ——— Drawer ——— */
.ss-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s;
}

.site-header.ss-drawer-open .ss-sidebar-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ss-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10001;
  width: min(320px, 88vw);
  height: 100vh;
  height: 100dvh;
  padding: 0;
  margin: 0;
  background: linear-gradient(165deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.99));
  border-right: 1px solid var(--ss-shell-line);
  box-shadow: 24px 0 60px rgba(0, 0, 0, 0.55);
  transform: translateX(-104%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

[data-theme="light"] .ss-sidebar {
  background: linear-gradient(165deg, #ffffff, #f8fafc);
  box-shadow: 24px 0 50px rgba(2, 6, 23, 0.12);
}

.site-header.ss-drawer-open .ss-sidebar {
  transform: translateX(0);
}

.ss-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--ss-shell-line);
}

.ss-sidebar-head img {
  height: 40px;
  width: auto;
}

.ss-sidebar-close {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.4);
  color: #e2e8f0;
  cursor: pointer;
  display: grid;
  place-items: center;
}

[data-theme="light"] .ss-sidebar-close {
  background: #f1f5f9;
  color: #0f172a;
}

.ss-sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 12px 12px 8px;
  gap: 4px;
}

.ss-sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.95rem;
  color: #e5e7eb;
  text-decoration: none;
  transition: background 0.18s;
}

.ss-sidebar-link .iconify {
  width: 22px;
  height: 22px;
  opacity: 0.9;
}

.ss-sidebar-link:hover,
.ss-sidebar-link:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

[data-theme="light"] .ss-sidebar-link {
  color: #0f172a;
}

[data-theme="light"] .ss-sidebar-link:hover,
[data-theme="light"] .ss-sidebar-link:focus-visible {
  background: rgba(15, 23, 42, 0.06);
}

.ss-sidebar-link[aria-current="page"] {
  background: rgba(255, 208, 2, 0.12);
  color: #fef9c3;
}

[data-theme="light"] .ss-sidebar-link[aria-current="page"] {
  background: rgba(255, 208, 2, 0.25);
  color: #0f172a;
}

.ss-sidebar-divider {
  height: 1px;
  margin: 10px 16px;
  background: var(--ss-shell-line);
}

.ss-sidebar-label {
  margin: 0 16px 6px;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #64748b;
}

.ss-sidebar-portal {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 20px;
}

.ss-sidebar-portal a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 12px 14px;
  border-radius: 14px;
  font-weight: 800;
  font-size: 0.88rem;
  text-decoration: none;
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

.ss-sidebar-portal a .iconify {
  width: 20px;
  height: 20px;
}

.ss-sidebar-portal a:first-of-type {
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.08);
}

.ss-sidebar-portal a:last-of-type {
  border-color: rgba(255, 208, 2, 0.4);
  background: linear-gradient(135deg, rgba(255, 208, 2, 0.12), rgba(255, 140, 0, 0.08));
}

[data-theme="light"] .ss-sidebar-portal a {
  color: #0f172a;
}

/* ——— Desktop: mostrar portal, esconder drawer UI ——— */
@media (min-width: 769px) {
  .nav-portal {
    display: flex;
  }

  .ss-nav-toggle {
    display: none !important;
  }

  .site-header .ss-sidebar,
  .site-header .ss-sidebar-backdrop {
    display: none !important;
  }

  .site-header.ss-drawer-open .ss-sidebar-backdrop {
    display: none !important;
  }
}

/* ——— Mobile: header compacto + sidebar ——— */
@media (max-width: 768px) {
  :root {
    --header-height: var(--ss-header-h-mobile);
  }

  .site-header.ss-unified-nav .mnav {
    display: none !important;
  }

  .site-header.ss-unified-nav .ss-nav-toggle {
    display: inline-flex !important;
  }

  .site-header.ss-unified-nav .nav-portal {
    display: none !important;
  }

  .site-header.ss-unified-nav .menu {
    display: none !important;
  }

  .site-header.ss-unified-nav .nav {
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 10px !important;
  }

  .site-header.ss-unified-nav .nav-right {
    width: auto !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    margin-left: auto !important;
    flex: 0 0 auto !important;
  }

  .site-header.ss-unified-nav .brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .site-header.ss-unified-nav .brand img {
    height: var(--ss-logo-h-mobile) !important;
    max-height: 44px;
  }

  .site-header.ss-unified-nav .theme-toggle {
    grid-column: auto !important;
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    margin-left: 0 !important;
  }

  .site-header {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .site-header .ss-sidebar,
  .site-header .ss-sidebar-backdrop {
    display: block;
  }
}