/* W Home brand palette
 * Brand cyan:       #01A0DD
 * Functional blue:  #0085BB
 * Active/hover blue:#006A96
 * Soft background:  #F3F8FA
 */

body,
#root,
main,
[role="main"] {
  background-color: #f3f8fa;
}

/* Primary actions */
.MuiButton-containedPrimary,
.MuiFab-primary {
  color: #fff !important;
  background-color: #0085bb !important;
}

.MuiButton-containedPrimary:hover,
.MuiButton-containedPrimary:focus-visible,
.MuiFab-primary:hover,
.MuiFab-primary:focus-visible {
  background-color: #006a96 !important;
}

.MuiButton-outlinedPrimary,
.MuiButton-textPrimary,
.MuiIconButton-colorPrimary,
.MuiLink-colorPrimary {
  color: #0085bb !important;
}

.MuiButton-outlinedPrimary {
  border-color: #0085bb !important;
}

.MuiButton-outlinedPrimary:hover,
.MuiButton-outlinedPrimary:focus-visible {
  color: #006a96 !important;
  border-color: #006a96 !important;
  background-color: rgba(1, 160, 221, 0.08) !important;
}

/* Tabs, selections and form controls */
.MuiTabs-indicator,
.MuiLinearProgress-barColorPrimary {
  background-color: #01a0dd !important;
}

/* Route/page loading bar. MetaFox can render this as NProgress or MUI. */
#nprogress .bar,
.nprogress-bar,
.MuiLinearProgress-bar,
[role="progressbar"] > span {
  background-color: #01a0dd !important;
}

#nprogress .peg {
  box-shadow: 0 0 10px #01a0dd, 0 0 5px #01a0dd !important;
}

#nprogress .spinner-icon {
  border-top-color: #01a0dd !important;
  border-left-color: #01a0dd !important;
}

/* Lightweight route loading: thin, calm and free of glow/spinner noise. */
#nprogress .bar {
  height: 2px !important;
  opacity: 0.82;
  transition: transform 280ms ease-out, opacity 180ms ease !important;
}

#nprogress .peg,
#nprogress .spinner {
  display: none !important;
  box-shadow: none !important;
}

.MuiLinearProgress-root {
  height: 2px !important;
  overflow: hidden;
  border-radius: 999px;
  background-color: rgba(1, 160, 221, 0.12) !important;
}

.MuiLinearProgress-bar {
  transition: transform 320ms ease-out !important;
}

@media (prefers-reduced-motion: reduce) {
  #nprogress .bar,
  .MuiLinearProgress-bar,
  .MuiSkeleton-root {
    animation: none !important;
    transition: none !important;
  }
}

/* Initial application loader: small stationary dots with a soft pulse. */
@keyframes whome-loader-pulse {
  0%,
  80%,
  100% {
    opacity: 0.22;
  }

  40% {
    opacity: 0.78;
  }
}

[data-testid="loadingIndicator"][data-whome-light-loader="true"] > div {
  width: 2.5rem !important;
  height: 2.5rem !important;
}

[data-testid="loadingIndicator"][data-whome-light-loader="true"] svg g {
  fill: #01a0dd !important;
}

[data-testid="loadingIndicator"][data-whome-light-loader="true"] svg circle {
  r: 4px;
  animation: whome-loader-pulse 1.4s ease-in-out infinite;
}

[data-testid="loadingIndicator"][data-whome-light-loader="true"] svg circle:nth-of-type(2) {
  animation-delay: 140ms;
}

[data-testid="loadingIndicator"][data-whome-light-loader="true"] svg circle:nth-of-type(3) {
  animation-delay: 280ms;
}

@media (prefers-reduced-motion: reduce) {
  [data-testid="loadingIndicator"][data-whome-light-loader="true"] svg circle {
    opacity: 0.5;
    animation: none !important;
  }
}

.MuiTab-textColorPrimary.Mui-selected,
.MuiPaginationItem-root.Mui-selected,
.MuiCheckbox-colorPrimary.Mui-checked,
.MuiRadio-colorPrimary.Mui-checked,
.MuiSwitch-colorPrimary.Mui-checked,
.MuiCircularProgress-colorPrimary {
  color: #0085bb !important;
}

.MuiSwitch-colorPrimary.Mui-checked + .MuiSwitch-track {
  background-color: #01a0dd !important;
}

.MuiPaginationItem-root.Mui-selected {
  background-color: rgba(1, 160, 221, 0.14) !important;
}

/* Keyboard focus should remain visible and on-brand. */
:focus-visible {
  outline-color: #01a0dd;
}

/* Posting is launched from the bottom + action on the main feed. */
[data-testid="blockStatusComposer"][data-whome-hidden-on-home="true"] {
  display: none !important;
}

/* Desktop information links belong at the bottom of the left navigation. */
@media (min-width: 1024px) {
  [data-testid="blockFooterMenu"] {
    position: fixed !important;
    z-index: 4;
    left: 16px !important;
    right: auto !important;
    top: auto !important;
    bottom: 14px !important;
    width: 290px !important;
    padding: 10px 12px !important;
    border-top: 1px solid rgba(0, 93, 138, 0.12);
    background: rgba(255, 255, 255, 0.96) !important;
    backdrop-filter: blur(8px);
  }

  [data-testid="blockFooterMenu"] ul {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px 12px !important;
    margin: 0 0 7px !important;
    padding: 0 !important;
  }

  [data-testid="blockFooterMenu"] li {
    margin: 0 !important;
    padding: 0 !important;
  }

  [data-testid="blockFooterMenu"] a {
    color: #53636c !important;
    font-size: 12px !important;
    line-height: 1.35 !important;
  }

  [data-testid="blockFooterMenu"] a:hover {
    color: #0085bb !important;
  }

  [data-testid="blockFooterMenu"] span {
    color: #7a8790 !important;
    font-size: 11px !important;
    line-height: 1.35 !important;
  }

  .Scrollbar-view:has(> [data-testid="blockSidebarMenu"]) {
    padding-bottom: 115px !important;
  }
}

/* Preserve the white icon used over selected blue navigation circles. */
[role="block"] [role="menu"] > a > .MuiMenuItem-root.Mui-selected > .MuiListItemIcon-root .ico {
  color: #fff !important;
}

/* W Home mobile services menu: two-column app grid. */
.appbar-position-bottom > .whome-quick-post {
  display: none;
}

@media (max-width: 1023px) {
  .appbar-position-bottom > .whome-quick-post {
    box-sizing: border-box;
    display: flex;
    position: relative;
    flex: 1 1 0%;
    align-items: center;
    justify-content: center;
    min-width: 0;
    height: 47px;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0085bb;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .appbar-position-bottom > .whome-quick-post::before {
    content: '';
    position: absolute;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #0085bb;
    box-shadow: 0 4px 12px rgba(0, 93, 138, 0.22);
  }

  .appbar-position-bottom > .whome-quick-post .ico {
    position: relative;
    z-index: 1;
    color: #fff !important;
    font-size: 24px;
  }

  .appbar-position-bottom > .whome-quick-post:active::before {
    transform: scale(0.94);
  }

  .appbar-position-bottom > .whome-quick-post:focus-visible {
    outline: 2px solid #01a0dd;
    outline-offset: -2px;
  }

  .appbar-position-bottom > a[role="button"][data-whome-active="false"] .ico {
    color: #191919 !important;
  }

  .appbar-position-bottom > a[role="button"][data-whome-active="true"] {
    background: #e2f4fb !important;
    border-radius: 24px !important;
  }

  .appbar-position-bottom > a[role="button"][data-whome-active="true"] .ico {
    color: #0085bb !important;
  }

  div:has(> [role="menuitem"][data-testid="home"]) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px !important;
    padding: 16px !important;
    align-content: start;
  }

  div:has(> [role="menuitem"][data-testid="home"]) > [role="menuitem"][data-testid] {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 124px !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden;
    border-radius: 16px !important;
    background: #f3f6f8 !important;
    transition: background-color 160ms ease, transform 160ms ease;
  }

  div:has(> [role="menuitem"][data-testid="home"]) > [role="menuitem"][data-testid]:active {
    transform: scale(0.98);
  }

  div:has(> [role="menuitem"][data-testid="home"]) > [role="menuitem"][data-testid] > a {
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 124px !important;
    padding: 18px !important;
    color: #191919 !important;
    text-decoration: none !important;
  }

  div:has(> [role="menuitem"][data-testid="home"]) > [role="menuitem"][data-testid] .ico {
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    font-size: 27px !important;
    line-height: 1 !important;
    color: #0085bb !important;
    background: transparent !important;
    border-radius: 0 !important;
  }

  div:has(> [role="menuitem"][data-testid="home"]) > [role="menuitem"][data-testid] > a > div {
    width: 100%;
    margin: 0 !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
    font-weight: 600 !important;
    color: #191919 !important;
  }

  /* Active destination: a quiet brand tint instead of a social-network circle. */
  div:has(> [role="menuitem"][data-testid="home"]) > [role="menuitem"][class^="jss"][class*=" jss"] {
    background: #e2f4fb !important;
    box-shadow: inset 0 0 0 1px rgba(1, 160, 221, 0.2);
  }

  div:has(> [role="menuitem"][data-testid="home"]) > [role="menuitem"][class^="jss"][class*=" jss"] .ico {
    color: #006a96 !important;
  }

  /* The expandable More item has no anchor in MetaFox. */
  div:has(> [role="menuitem"][data-testid="home"]) > [role="menuitem"][data-testid="more"] {
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    padding: 18px !important;
    color: #191919 !important;
  }
}

/* Expanded mobile "More" menu: MetaFox wraps each menuitem in a link. */
@media (max-width: 1023px) {
  [role="menu"]:has(> a[data-testid="home"]) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px !important;
    padding: 16px !important;
    align-content: start;
  }

  [role="menu"]:has(> a[data-testid="home"]) > a[data-testid] {
    display: block !important;
    min-width: 0 !important;
    min-height: 124px !important;
    margin: 0 !important;
    overflow: hidden;
    border-radius: 16px !important;
    color: #191919 !important;
    background: #f3f6f8 !important;
    text-decoration: none !important;
    transition: background-color 160ms ease, transform 160ms ease;
  }

  [role="menu"]:has(> a[data-testid="home"]) > a[data-testid]:active {
    transform: scale(0.98);
    background: #e2f4fb !important;
  }

  [role="menu"]:has(> a[data-testid="home"]) > a[data-whome-active="true"] {
    color: #fff !important;
    background: #0085bb !important;
    box-shadow: 0 6px 18px rgba(0, 106, 150, 0.18);
  }

  [role="menu"]:has(> a[data-testid="home"]) > a[data-testid] > [role="menuitem"] {
    box-sizing: border-box;
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 124px !important;
    padding: 18px !important;
    color: #191919 !important;
    background: transparent !important;
    border-radius: 16px !important;
  }

  [role="menu"]:has(> a[data-testid="home"]) > a[data-testid] .MuiListItemIcon-root {
    min-width: 0 !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    border-radius: 0 !important;
  }

  [role="menu"]:has(> a[data-testid="home"]) > a[data-testid] .ico {
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    font-size: 27px !important;
    line-height: 1 !important;
    color: #0085bb !important;
    background: transparent !important;
    border-radius: 0 !important;
  }

  [role="menu"]:has(> a[data-testid="home"]) > a[data-whome-active="true"] .ico {
    color: #fff !important;
  }

  [role="menu"]:has(> a[data-testid="home"]) > a[data-testid] [role="menuitem"] > div:last-child {
    width: 100%;
    margin: 0 !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
    font-weight: 600 !important;
    color: #191919 !important;
  }

  [role="menu"]:has(> a[data-testid="home"]) > a[data-whome-active="true"] [role="menuitem"],
  [role="menu"]:has(> a[data-testid="home"]) > a[data-whome-active="true"] [role="menuitem"] > div:last-child {
    color: #fff !important;
  }
}
