/* ================================================== */
/* header.css                                         */
/* Global header component used across normal pages   */
/* Includes brand, breadcrumbs, company, and actions  */
/* ================================================== */

/* ================================================== */
/* HEADER                                             */
/* ================================================== */

/* The main header row used across normal pages */
.header {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 18px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--colorLine);
  background: var(--colorCardBgAlt);
  color: var(--colorText);
}

/* Keeps shared header text aligned consistently */
.headerAppName,
.headerBreadcrumbLink,
.headerBreadcrumbCurrent,
.headerCompanyName,
.headerDateTime,
.headerUser,
.headerLanguageCode {
  line-height: 1.2;
}

/* ================================================== */
/* LEFT SIDE                                          */
/* ================================================== */

/* The left header area used for brand and breadcrumbs */
.headerLeft {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  overflow: visible;
}

/* The brand group used for logo and app name */
.headerBrand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  white-space: nowrap;
  margin-top: 7px;
}

/* The small logo box used at the far left of the header */
.headerLogo {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--colorLine);
  border-radius: 10px;
  background: var(--colorIconBg);
  color: var(--colorWhite);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.headerLogo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* The app name shown beside the logo */
.headerAppName {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1;
}

.headerAppNameMain {
  display: inline-flex;
  align-items: baseline;
  font-family: "Black Ops One", sans-serif;
  font-size: 20px;
  line-height: 1;
  color: var(--colorLogoText);
  text-shadow:
    0 0 2px rgba(85, 255, 255, 0.18),
    0 0 6px rgba(85, 255, 255, 0.22),
    0 0 10px rgba(85, 255, 255, 0.12);
}

.headerAppName24 {
  display: inline-block;
}

.headerAppNameSales {
  display: inline-block;
  margin-left: 4px;
}

.headerAppNameAi {
  margin-top: 1px;
  font-family: "Orbitron", sans-serif;
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--colorLogoAiText);
  opacity: 0.7;
  text-transform: uppercase;
  text-shadow: none;
  padding-left: 7px;
}

/* The breadcrumb row used for page context */
.headerBreadcrumbs {
  min-width: 0;
  display: flex;
  align-items: center;
  height: 28px;
  overflow: hidden;
  white-space: nowrap;
}

/* The clickable breadcrumb link used for parent levels */
.headerBreadcrumbLink {
  font-size: 14px;
  line-height: 1.2;
  color: var(--colorTextMuted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* The current breadcrumb item used for the active page */
.headerBreadcrumbCurrent {
  display: inline-flex;
  align-items: center;
  height: 28px;
  font-size: 14px;
  line-height: 1;
  color: var(--colorText);
  font-weight: 700;
}

/* The separator used between breadcrumb items */
.headerBreadcrumbSeparator {
  flex: 0 0 auto;
  font-size: 13px;
  line-height: 1;
  color: var(--colorTextMuted);
}

/* ================================================== */
/* CENTER                                             */
/* ================================================== */

/* The center header area used for the company switch */
.headerCenter {
  min-width: 0;
  display: flex;
  align-items: center;
}

/* ================================================== */
/* RIGHT SIDE                                         */
/* ================================================== */

/* The right header area used for utility controls */
.headerRight {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  white-space: nowrap;
}

/* ================================================== */
/* SHARED CONTROLS                                    */
/* ================================================== */

/* The shared shell used for compact header controls */
.headerControl {
  border: 1px solid var(--colorLine);
  border-radius: 12px;
  background: var(--colorFieldBg);
  color: var(--colorText);
  transition:
    border-color 120ms ease,
    box-shadow 120ms ease,
    background 120ms ease;
}

/* The shared hover state used for compact header controls */
.headerControl:hover {
  border-color: rgba(255, 255, 255, 0.18);
}

/* The shared keyboard focus state used for compact header controls */
.headerControl:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px rgba(19, 215, 232, 0.35);
}

.headerControl--blue:hover {
  border-color: rgba(59, 130, 246, 0.6);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.headerControl--green:hover {
  border-color: rgba(34, 197, 94, 0.6);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
}

.headerControl--yellow:hover {
  border-color: rgba(234, 179, 8, 0.6);
  box-shadow: 0 0 0 1px rgba(234, 179, 8, 0.25);
}

.headerControl--red:hover {
  border-color: rgba(239, 68, 68, 0.6);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25);
}

/* The shared icon button shell used for compact header actions */
.headerIconButton {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* ================================================== */
/* COMPANY SWITCH                                     */
/* ================================================== */

/* The company switch used to show and change active company */
.headerCompanySwitch {
  max-width: 320px;
  min-width: 0;
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  cursor: pointer;
}

/* The company name shown inside the company switch */
.headerCompanyName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1;
}

/* The small arrow used inside the company switch */
.headerCompanyArrow {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-right: 1.5px solid var(--colorTextMuted);
  border-bottom: 1.5px solid var(--colorTextMuted);
  transform: rotate(45deg) translateY(-1px);
}

/* ================================================== */
/* LANGUAGE                                           */
/* ================================================== */

/* The language control used for locale switching */
.headerLanguage {
  position: relative;
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
}

/* Closed state shows globe + short code */
.headerLanguageClosed {
  height: 100%;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: var(--colorText);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* The globe icon used for language selection */
.headerLanguageIcon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--colorTextMuted);
}

.headerLanguageIcon::before,
.headerLanguageIcon::after {
  content: none;
}

.headerLanguageIconSvg {
  width: 16px;
  height: 16px;
  display: block;
}

/* The short visible language code shown beside the icon */
.headerLanguageCode {
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  color: var(--colorText);
}

/* Hidden by default until control is opened */
.headerLanguageSelectWrap {
  display: none;
  width: 132px;
  min-width: 132px;
}

/* The compact select used inside the language control */
.headerLanguageSelect {
  height: 30px;
  min-height: 30px;
  padding-left: 8px;
  padding-right: 32px;
  border-radius: 8px;
  font-size: 13px;
  background: var(--colorFieldBg);
  border: none;
  outline: none;
  box-shadow: none;
}
.headerLanguage.isOpen {
  border-color: transparent;
  box-shadow: none;
}

/* Keeps the select arrow aligned in the compact language control */
.headerLanguageSelectWrap::after {
  right: 10px;
  width: 14px;
  height: 14px;
  background-size: 14px 14px;
}

/* Open state hides globe/code button and shows select */
.headerLanguage.isOpen .headerLanguageClosed {
  display: none;
}

.headerLanguage.isOpen .headerLanguageSelectWrap {
  display: block;
}

/* ================================================== */
/* DATE / USER                                        */
/* ================================================== */

/* The date and time text used in the header */
.headerDateTime {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1;
  color: var(--colorTextMuted);
  white-space: nowrap;
}

/* The user button used for account actions */
.headerUser {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
}

/* ================================================== */
/* ICON BUTTONS                                       */
/* ================================================== */

/* The notifications button used in the header */
.headerNotifications {
  position: relative;
  cursor: pointer;
}

/* Keeps the notification dropdown anchored to the bell */
.headerNotificationsWrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

/* The main menu button used in the header */
.headerMenu {
  cursor: pointer;
}

/* ================================================== */
/* MENU ICON                                          */
/* ================================================== */

/* The compact menu icon used for the menu button */
.headerMenuIcon {
  width: 18px;
  height: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

/* The individual lines used inside the menu icon */
.headerMenuIcon span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--colorText);
  border-radius: 1px;
}

/* ================================================== */
/* BELL ICON (SVG)                                    */
/* ================================================== */

.headerBellIcon {
  width: 20px;
  height: 20px;
  display: block;
}

.headerBellIconSvg {
  width: 20px;
  height: 20px;
  display: block;
}

/* ================================================== */
/* NOTIFICATIONS                                      */
/* ================================================== */

.headerNotificationsBadge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: var(--colorBtnRedBg);
  color: var(--colorWhite);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.3),
    0 0 12px rgba(239, 68, 68, 0.45);
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

.headerNotificationsWrap.hasCriticalUnread .headerNotifications {
  color: var(--colorBtnRedText);
  border-color: var(--colorBtnRedBorder);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.35),
    0 0 16px rgba(239, 68, 68, 0.28);
}

.headerNotificationsWrap.hasCriticalUnread .headerNotificationsBadge {
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow:
    0 0 0 2px rgba(239, 68, 68, 0.68),
    0 0 14px rgba(239, 68, 68, 0.78),
    0 0 28px rgba(239, 68, 68, 0.45);
}

.headerNotificationsBadge[hidden] {
  display: none;
}

.headerNotificationsPanel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 80;
  width: 340px;
  max-height: min(460px, calc(100vh - 80px));
  display: none;
  overflow: hidden;
  white-space: normal;
  border: 1px solid var(--colorLine);
  border-radius: 14px;
  background: var(--colorCardBgAlt);
  box-shadow:
    0 22px 70px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(19, 215, 232, 0.08);
}

.headerNotificationsPanel[aria-hidden="false"] {
  display: flex;
  flex-direction: column;
}

.headerNotificationsPanelHead {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--colorLine);
  background: rgba(0, 0, 0, 0.18);
}

.headerNotificationsPanelTitle {
  color: var(--colorWhite);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
}

.headerNotificationsMarkAll {
  border: 0;
  background: transparent;
  color: var(--colorTextMuted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.headerNotificationsMarkAll:hover,
.headerNotificationsMarkAll:focus-visible {
  color: var(--colorLogoText);
  outline: none;
}

.headerNotificationsMarkAll:disabled {
  opacity: 0.45;
  cursor: default;
}

.headerNotificationsList {
  flex: 1 1 auto;
  max-height: 360px;
  overflow-y: auto;
}

.headerNotificationItem {
  position: relative;
  border-bottom: 1px solid var(--colorLine);
  background: rgba(0, 0, 0, 0.08);
}

.headerNotificationItem:last-child {
  border-bottom: 0;
}

.headerNotificationItem.isUnread {
  background: rgba(19, 215, 232, 0.07);
}

.headerNotificationItem.isCritical {
  background: rgba(239, 68, 68, 0.12);
}

.headerNotificationRow {
  width: 100%;
  min-height: 104px;
  padding: 12px 42px 12px 12px;
  border: 0;
  background: transparent;
  color: var(--colorText);
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.headerNotificationRow:hover {
  background: rgba(255, 255, 255, 0.04);
}

.headerNotificationRow:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--colorFieldFocusRing);
}

.headerNotificationTime {
  color: var(--colorTextMuted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.headerNotificationHeadline {
  color: var(--colorText);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
}

.headerNotificationItem.isUnread .headerNotificationHeadline {
  color: var(--colorLogoText);
  font-weight: 800;
  text-shadow: 0 0 10px rgba(85, 255, 255, 0.22);
}

.headerNotificationItem.isCritical .headerNotificationHeadline {
  color: var(--colorBtnRedText);
  font-weight: 800;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.38);
}

.headerNotificationItem.isCritical .headerNotificationText {
  color: var(--colorWhite);
}

.headerNotificationItem.isUnread .headerNotificationText {
  color: var(--colorWhite);
  font-weight: 600;
}

.headerNotificationText {
  color: var(--colorTextMuted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.headerNotificationClose {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--colorBtnGrayBorder);
  border-radius: 999px;
  background: var(--colorBtnGrayBg);
  color: var(--colorBtnGrayText);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.headerNotificationClose:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--colorPanelBg);
}

.headerNotificationClose:focus-visible {
  outline: none;
  box-shadow: 0 0 0 1px var(--colorFieldFocusRing);
}

.headerNotificationsEmpty {
  padding: 24px 12px;
  color: var(--colorTextMuted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.headerNotificationsEmpty[hidden] {
  display: none;
}

.notificationFooter {
  min-height: 36px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 12px;
  border-top: 1px solid var(--colorLine);
  background: rgba(0, 0, 0, 0.2);
}

.notificationFooterLabel {
  color: var(--colorTextMuted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.notificationThemeToggle {
  position: relative;
  min-width: 112px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.notificationThemeInput {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.notificationThemeOptions {
  position: relative;
  width: 112px;
  height: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--colorLine);
  border-radius: 999px;
  background: var(--colorFieldBg);
  overflow: hidden;
}

.notificationThemeOptions::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(50% - 2px);
  height: calc(100% - 4px);
  border-radius: 999px;
  background: var(--colorBtnYellowBg);
  border: 1px solid var(--colorBtnYellowBorder);
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.24);
  transition: transform 120ms ease;
}

.notificationThemeInput:checked + .notificationThemeOptions::before {
  transform: translateX(100%);
  background: var(--colorBtnBlueBg);
  border-color: var(--colorBtnBlueBorder);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.28);
}

.notificationThemeOption {
  position: relative;
  z-index: 1;
  color: var(--colorTextMuted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  user-select: none;
}

.notificationThemeInput:not(:checked)
  + .notificationThemeOptions
  .notificationThemeLight,
.notificationThemeInput:checked
  + .notificationThemeOptions
  .notificationThemeDark {
  color: var(--colorWhite);
}

.notificationThemeText {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.notificationThemeInput:not(:checked)
  ~ .notificationThemeText::before {
  content: "Light";
}

.notificationThemeInput:checked
  ~ .notificationThemeText::before {
  content: "Dark";
}

.notificationThemeInput:focus-visible + .notificationThemeOptions {
  box-shadow: 0 0 0 1px var(--colorFieldFocusRing);
}

/* ================================================== */
/* RESPONSIVE                                         */
/* ================================================== */

/* Hides the date when space gets tighter */
@media (max-width: 980px) {
  .headerDateTime {
    display: none;
  }
}

/* Hides lower-priority text as the header gets narrower */
@media (max-width: 860px) {
  .headerUser {
    display: none;
  }
}

/* Tighter header layout, but always keep breadcrumb and company dropdown */
@media (max-width: 700px) {
  .header {
    grid-template-columns: minmax(0, 1fr) auto auto;
    column-gap: 10px;
  }

  .headerLeft {
    min-width: 0;
    gap: 10px;
    overflow: hidden;
  }

  .headerBrand {
    flex: 0 0 auto;
  }

  .headerBreadcrumbs {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .headerBreadcrumbCurrent,
  .headerBreadcrumbLink {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .headerCenter {
    min-width: 0;
    display: flex;
    align-items: center;
  }

  .headerCompanySwitch {
    max-width: 220px;
  }

  .headerLanguageCode {
    display: none;
  }

  .headerLanguage {
    padding: 0 8px;
  }

  .headerLanguageSelectWrap {
    width: 92px;
    min-width: 92px;
  }

  .headerNotificationsPanel {
    position: fixed;
    top: 54px;
    right: 10px;
    left: 10px;
    width: auto;
    max-height: calc(100vh - 70px);
  }
}
