/**
 * Dynamic tenant branding overrides.
 * CSS variables (--brand-primary, etc.) are injected on <html> at runtime.
 * Rules apply only after html.branding-theme-ready is set (no wrong-color flash).
 */

html.branding-theme-ready {
  --brand-primary: #47a848;
  --color-primary-500: #47a848;
  --brand-primary-rgb: 71, 168, 72;
  --navbar-background: #142c1e;
  --navbar-background-deep: #0f2217;
}

/* Navbar / header */
html.branding-theme-ready .navbar,
html.branding-theme-ready .navbar-survey {
  background: var(--navbar-background) !important;
}

html.branding-theme-ready .navbar__setting-container i {
  color: var(--brand-primary) !important;
}

html.branding-theme-ready .navbar__back-container {
  background: rgba(var(--brand-primary-rgb), 0.12) !important;
  border-color: rgba(var(--brand-primary-rgb), 0.35) !important;
}

html.branding-theme-ready .navbar__profile--arrow-container i,
html.branding-theme-ready .navbar__profile--save-arrow-container i {
  color: var(--brand-primary) !important;
}

/* Profile dropdown */
html.branding-theme-ready .navbar__profile--settings-container {
  background: var(--navbar-background) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28) !important;
  color: #ffffff !important;
}

html.branding-theme-ready .navbar__profile--image-container,
html.branding-theme-ready .navbar__profile--settings-actions {
  border-bottom-color: rgba(255, 255, 255, 0.22) !important;
}

html.branding-theme-ready .navbar__profile--hello,
html.branding-theme-ready .navbar__profile--logged-label,
html.branding-theme-ready .navbar__profile--settings-actions,
html.branding-theme-ready .navbar__profile--settings-actions li,
html.branding-theme-ready .navbar__profile--settings-actions li span {
  color: #ffffff !important;
}

html.branding-theme-ready .navbar__profile--logged-label {
  color: rgba(255, 255, 255, 0.92) !important;
}

html.branding-theme-ready .navbar__profile--username {
  color: #ffffff !important;
  opacity: 1;
  text-shadow: 0 0 0.01px rgba(255, 255, 255, 0.4);
  background: rgba(var(--brand-primary-rgb), 0.28);
  border-radius: 4px;
  padding: 2px 6px;
  display: inline-block;
  max-width: 100%;
}

html.branding-theme-ready .navbar__profile--settings-actions li:hover {
  background-color: var(--navbar-background-deep) !important;
}

html.branding-theme-ready .navbar__setting-popover {
  background: var(--navbar-background) !important;
}

html.branding-theme-ready .navbar__setting-popover--showarrow:after {
  border-bottom-color: var(--navbar-background) !important;
  background: var(--navbar-background) !important;
}

html.branding-theme-ready .navbar__setting-popover li:hover {
  background-color: var(--navbar-background-deep) !important;
}

/* Lesson / mission side nav */
html.branding-theme-ready #sidebar-wrapper,
html.branding-theme-ready #sidebar_menu,
html.branding-theme-ready #sidebar-wrapper.not_active,
html.branding-theme-ready #sidebar-wrapper.not_active #sidebar_menu,
html.branding-theme-ready .sidenav__data,
html.branding-theme-ready .sidenav__item,
html.branding-theme-ready .sidenav__item:hover {
  background: var(--navbar-background) !important;
  background-color: var(--navbar-background) !important;
}

html.branding-theme-ready #sidebar_menu,
html.branding-theme-ready .sidenav__icons {
  border-bottom-color: rgba(255, 255, 255, 0.18) !important;
}

html.branding-theme-ready #main_icon,
html.branding-theme-ready .sidenav__icons--arrow {
  color: var(--brand-primary) !important;
}

html.branding-theme-ready .sidenav__item--active > .sidenav__item {
  background: var(--navbar-background-deep) !important;
  background-color: var(--navbar-background-deep) !important;
  border-left-color: var(--brand-primary) !important;
}

html.branding-theme-ready .sidenav__course-progress-bar {
  background-color: var(--brand-primary) !important;
}

/* Primary action buttons */
html.branding-theme-ready .mission-control-btn--run,
html.branding-theme-ready .mission-tutorial-btn--continue,
html.branding-theme-ready .error-popup__try--btn,
html.branding-theme-ready .sweet-alert button.confirm,
html.branding-theme-ready .mcq-mission__actions__submit-and-next,
html.branding-theme-ready .puplish-button {
  background: var(--brand-primary) !important;
  background-color: var(--brand-primary) !important;
  border-color: var(--brand-primary) !important;
}

/* Editor active tab underline */
html.branding-theme-ready .editor-pane__tab-container li.active a,
html.branding-theme-ready .editor-pane__tab-container li.active a:hover,
html.branding-theme-ready .editor-pane__tab-container li.active a:focus {
  border-bottom-color: var(--brand-primary) !important;
}

/* Quiz progress bar */
html.branding-theme-ready #quiz-mission .progress-bar {
  background-color: var(--brand-primary) !important;
}

/* Outline / text accents */
html.branding-theme-ready .blockly-pop__btn--prev {
  border-color: var(--brand-primary) !important;
  color: var(--brand-primary) !important;
  background: rgba(var(--brand-primary-rgb), 0.08) !important;
}

html.branding-theme-ready .mission-control-btn--run:hover,
html.branding-theme-ready .mission-tutorial-btn--continue:hover,
html.branding-theme-ready .error-popup__try--btn:hover,
html.branding-theme-ready .sweet-alert button.confirm:hover {
  filter: brightness(0.95);
}

/* Navbar logo sizing */
.navbar__logo-container--link {
  display: flex;
  align-items: center;
  line-height: 0;
}

.navbar__logo-container--image {
  max-height: 26px;
  width: auto;
  display: block;
}

#project-webeditor .navbar__logo-container--image {
  max-height: 24px;
}

.navbar__logo-section--small-screen--logo .navbar__logo-container--image {
  max-height: 22px;
}
