/* Embedded AbsolutHR portal layout — iframe-first mode */
html,
body.embedded-portal-page {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  background: #ffffff !important;
  overflow: hidden !important;
}

body.embedded-portal-page {
  margin: 0 !important;
  padding: 0 !important;
}

body.embedded-portal-page #particles-js,
body.embedded-portal-page .landing-page,
.embedded-portal-header,
.portal-frame-toolbar,
.portal-frame-title-wrap,
.portal-frame-hint {
  display: none !important;
}

.embedded-portal-shell.content {
  display: block !important;
  position: fixed;
  top: 0;
  left: var(--sidebar-rail-width);
  right: 0;
  bottom: 0;
  width: auto;
  height: 100dvh;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  background: #ffffff !important;
  z-index: 1;
}

body.sidebar-display-text .embedded-portal-shell.content {
  left: var(--sidebar-panel-width);
}

body.sidebar-display-icons.sidebar-temporary-open .embedded-portal-shell.content {
  left: 0;
}

.portal-frame-card {
  position: relative;
  width: 100%;
  height: 100%;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: hidden;
  background: #ffffff !important;
  box-shadow: none !important;
}

.portal-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #ffffff;
}

.portal-frame-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(6px);
}

.portal-frame-loading.is-visible {
  display: flex;
}

.portal-loading-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.14);
  color: #1f2937;
  font-weight: 800;
}

.portal-loading-spinner {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 3px solid rgba(0, 106, 255, 0.20);
  border-top-color: #006aff;
  animation: portalSpin 0.8s linear infinite;
}

@keyframes portalSpin {
  to { transform: rotate(360deg); }
}

/* Sidebar navigation overrides for static nested categories */
.sidebar-nav {
  padding: 14px 12px 120px;
}

.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.embedded-home-item {
  margin-bottom: 8px;
}

.embedded-home-item a,
.embedded-category-toggle,
.embedded-subitem a {
  width: 100%;
  border: 0;
  outline: 0;
  text-decoration: none;
  font-family: inherit;
}

.embedded-home-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 15px;
  color: var(--sidebar-ink);
  font-weight: 800;
  background: rgba(0, 106, 255, 0.08);
}

.embedded-home-item a.active,
.embedded-home-item a:hover {
  color: #006aff;
  background: rgba(0, 106, 255, 0.13);
}

.embedded-category {
  margin: 6px 0;
}

.embedded-category-toggle {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 15px;
  background: transparent;
  color: var(--sidebar-ink);
  cursor: pointer;
  font-weight: 800;
  transition: background 0.18s ease, color 0.18s ease;
}

.embedded-category-toggle:hover,
.embedded-category.is-open .embedded-category-toggle {
  background: rgba(0, 106, 255, 0.08);
  color: #006aff;
}

.embedded-category-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.embedded-category-main span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.embedded-category-count {
  min-width: 24px;
  height: 22px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.07);
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
}

.embedded-category-chevron {
  font-size: 0.78rem;
  opacity: 0.55;
  transition: transform 0.18s ease;
}

.embedded-category.is-open .embedded-category-chevron {
  transform: rotate(180deg);
}

.embedded-submenu {
  display: none;
  padding: 5px 0 8px 7px !important;
  margin-left: 15px !important;
  border-left: 1px solid rgba(0, 106, 255, 0.16);
}

.embedded-category.is-open .embedded-submenu {
  display: block;
}

.embedded-subitem {
  margin: 3px 0;
}

.embedded-subitem a {
  display: grid;
  grid-template-columns: 19px 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 8px 9px;
  border-radius: 12px;
  color: #475569;
  font-size: 0.86rem;
  font-weight: 700;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.embedded-subitem a:hover,
.embedded-subitem a.active {
  color: #006aff;
  background: rgba(0, 106, 255, 0.10);
  transform: translateX(1px);
}

.embedded-subitem-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.embedded-type-badge {
  min-width: 26px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #ffffff;
  background: #64748b;
}

.embedded-type-badge.type-internal { background: #2563eb; }
.embedded-type-badge.type-external { background: #0f766e; }
.embedded-type-badge.type-portal { background: #7c3aed; }
.embedded-type-badge.type-approval { background: #ea580c; }

.embedded-rail-category {
  position: relative;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--sidebar-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.embedded-rail-category:hover,
.embedded-rail-category.active {
  background: rgba(0, 106, 255, 0.10);
  color: var(--sidebar-accent);
  transform: translateY(-1px);
}

.embedded-rail-category:hover .rail-label {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.sidebar-filter-btn,
#filterMenu {
  display: none !important;
}

body.night-mode.embedded-portal-page {
  background:
    radial-gradient(circle at top left, rgba(0, 106, 255, 0.26), transparent 35%),
    linear-gradient(135deg, #0b1020 0%, #0f172a 48%, #111827 100%);
}

body.night-mode .embedded-portal-header,
body.night-mode .portal-frame-card,
body.night-mode .portal-frame-toolbar {
  background: rgba(15, 23, 42, 0.86);
  border-color: rgba(255, 255, 255, 0.10);
}

body.night-mode .embedded-brand-title,
body.night-mode .portal-frame-title,
body.night-mode .portal-loading-card {
  color: rgba(255, 255, 255, 0.94);
}

body.night-mode .portal-frame-url {
  color: rgba(203, 213, 225, 0.76);
}

body.night-mode .portal-frame-loading {
  background: rgba(15, 23, 42, 0.74);
}

body.night-mode .portal-loading-card {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(255, 255, 255, 0.10);
}

body.night-mode .embedded-category-toggle,
body.night-mode .embedded-home-item a {
  color: rgba(255, 255, 255, 0.90);
}

body.night-mode .embedded-subitem a {
  color: rgba(203, 213, 225, 0.86);
}

@media (max-width: 900px) {
  .embedded-portal-header {
    left: 0;
    padding: 0 14px 0 76px;
  }

  .embedded-brand-title {
    max-width: 48vw;
  }

  .embedded-header-action span {
    display: none;
  }

  .embedded-portal-shell.content {
    left: 0;
    padding: 10px;
  }

  body.sidebar-display-text .embedded-portal-shell.content,
  body.sidebar-display-text .embedded-portal-header {
    left: 0;
  }

  .portal-frame-card {
    border-radius: 18px;
  }

  .portal-frame-toolbar {
    height: 64px;
    padding: 12px;
  }

  .portal-frame {
    height: calc(100% - 64px);
  }

  .portal-frame-hint {
    display: none;
  }
}

@media (max-width: 560px) {
  .embedded-brand img {
    display: none;
  }

  .embedded-brand-title {
    max-width: 52vw;
    font-size: 0.92rem;
  }

  .embedded-brand-eyebrow {
    font-size: 0.68rem;
  }

  .portal-frame-url {
    display: none;
  }
}

/* Final iframe-only overrides: keep the embedded website flush in every viewport. */
body.embedded-portal-page {
  background: #ffffff !important;
}

body.embedded-portal-page .embedded-portal-shell.content {
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
  background: #ffffff !important;
}

body.sidebar-display-icons .embedded-portal-shell.content {
  left: var(--sidebar-rail-width) !important;
}

body.sidebar-display-text .embedded-portal-shell.content {
  left: var(--sidebar-panel-width) !important;
}

body.sidebar-display-icons.sidebar-temporary-open .embedded-portal-shell.content {
  left: 0 !important;
}

body.embedded-portal-page .portal-frame-card,
body.night-mode.embedded-portal-page .portal-frame-card {
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: #ffffff !important;
}

body.embedded-portal-page .portal-frame {
  height: 100% !important;
  width: 100% !important;
}

@media (max-width: 900px) {
  body.embedded-portal-page .embedded-portal-shell.content {
    left: 0 !important;
    padding: 0 !important;
  }
}
