@import url('src/assets/styles/common.less');
@import url('src/assets/styles/menu.less');
@import url('src/assets/styles/driver.less');
@import url('./overrides.less');

html {
  --font-family: 'noto sans', sans-serif;
  --ant-color-text-secondary: rgba(0, 0, 0, 65%);
  --ant-color-text-tertiary: rgba(0, 0, 0, 45%);
  --ant-color-text-quaternary: rgba(0, 0, 0, 25%);
  --ant-color-fill: rgba(223, 168, 168, 15%);
  --ant-color-fill-secondary: rgba(0, 0, 0, 6%);
  --ant-color-fill-tertiary: rgba(0, 0, 0, 4%);
  --ant-color-fill-quaternary: rgba(0, 0, 0, 2%);
  --color-text-light-1: rgba(255, 255, 255, 90%);
  --color-fill-1: var(--ant-color-fill-tertiary);
  --color-scrollbar-thumb: rgba(193, 193, 193, 80%);
  --scrollbar-size: 6px;
  --scrollbar-handle-bg: rgba(0, 0, 0, 44%);
  --scrollbar-handle-light-bg: rgba(255, 255, 255, 25%);
  --scrollbar-handle-hover-bg: rgba(0, 0, 0, 55%);
  --color-editor-dark: #282c34;
  --color-editor-light: #fafafa;
  --color-scrollbar-track: var(--ant-color-fill-tertiary);
  // --color-fill-1: #fff;
  --ant-color-text: #000;
  --color-scroll-bg: #d9d9d9;
  --color-fill-2: #fff;
  --color-fill-3: #f3f6fa;
  --color-logs-bg: #1e1e1e;
  --color-logs-text: #d4d4d4;
  --layout-content-blockpadding: 32px;
  --layout-content-inlinepadding: 32px;
  --layout-content-header-inlinepadding: 40px;
  --border-radius-modal: 6px;
  --menu-border-radius-base: 4px;
  --border-radius-base: 4px;
  --border-radius-middle: 20px;
  --border-radius-small: 4px;
  --border-radius-mdium: 4px;
  --border-radius-mini: 4px;
  --border-radius-2px: 2px;
  --color-white-1: rgba(255, 255, 255, 100%);
  --color-fill-sider: #f4f5f4;
  --font-weight-normal: 500;
  --font-weight-medium: 600;
  --font-weight-bold: 700;
  --color-white-primary: rgba(255, 255, 255, 100%);
  --color-white-secondary: rgba(255, 255, 255, 90%);
  --color-white-tertiary: rgba(255, 255, 255, 70%);
  --color-white-quaternary: rgba(255, 255, 255, 50%);
  --color-white-light-1: rgba(255, 255, 255, 15%);
  --color-white-light-2: rgba(255, 255, 255, 25%);
  --color-white-light-3: rgba(255, 255, 255, 35%);
  --color-white-light-4: rgba(255, 255, 255, 45%);
  --color-gray-fill-4: rgba(92, 92, 92, 45%);
  --color-gray-fill-3: rgba(92, 92, 92, 35%);
  --color-text-1: var(--ant-color-text);
  --color-text-3: rgba(0, 0, 0, 45%);
  --color-text-2: rgba(0, 0, 0, 65%);
  --color-bg-light-1: #e6f6ff;
  --font-size-small: 13px;
  --font-size-base: 12px;
  --font-size-large: 16px;
  --font-size-middle: 14px;
  --table-td-radius: 4px;
  --checkbox-border-radius: 2px;
  --ant-table-cell-padding-inline: 16px;
  --ant-table-cell-padding-block: 6px;
  --ant-table-header-border-radius: 4px;
  --ant-table-header-split-color: #f0f0f0;
  --ant-table-row-selected-bg: #e6f6ff;
  --ant-table-row-selected-hover-bg: #e6f6ff;
  --ant-table-row-hover-bg: rgba(230, 230, 230, 88%);
  --color-chart-red: rgba(255, 77, 79, 80%);
  --color-chart-green: rgb(84, 204, 152, 80%);
  --color-chart-glod: rgba(250, 173, 20, 80%);
  --seal-transition-func: cubic-bezier(0, 0, 1, 1);
  --color-progress-green: rgba(84, 204, 152, 100%);
  --color-border-1: rgba(217, 217, 217, 100%);
  --ant-rate-star-color: #fadb14;
  --color-fill-mask: rgba(255, 255, 255, 60%);
  // ======== input ============
  --ant-input-active-shadow: 0 0 0 2px rgba(5, 255, 105, 6%);
  --ant-input-active-border-color: #007bff;
  --ant-input-hover-border-color: #2997ff;
  --box-shadow-base: 0 4px 6px rgba(227, 232, 240, 70%);
  --ant-border-radius-lg: 4px;
  --ant-menu-item-color: var(--color-text-1);
  --color-selected-bg: rgba(230, 230, 230, 88%);
  // --box-shadow-base: none;

  .css-var-rf {
    --ant-font-size: var(--font-size-base);
  }

  .css-var-rg,
  .css-var-ri,
  .css-var-rh {
    --ant-font-size: var(--font-size-base);

    &.ant-menu-css-var {
      // --ant-menu-item-selected-bg: var(--color-white-1);
      --ant-menu-item-border-radius: 4px;
      --ant-menu-item-selected-color: var(--ant-color-primary);
      --ant-menu-item-color: var(--color-text-1);
    }
  }

  .css-var-rj.ant-menu-css-var {
    --ant-menu-item-color: var(--color-text-1);
  }

  .css-var-r0 {
    // --ant-control-height: 36px;
    --ant-font-size-sm: var(--font-size-base);
    --ant-font-size-lg: var(--font-size-base);
    --ant-font-size-xl: 20px;
    --ant-font-size: var(--font-size-base);
    --ant-padding-sm: 14px;
    --ant-border-radius-lg: 4px;
    --ant-color-text: #000;
    --ant-color-error: #ff4d4f;
    --ant-color-bg-mask: rgba(0, 0, 0, 35%);
    --ant-color-border: rgb(217 217 217 / 100%);

    &.ant-popover {
      --ant-popover-inner-padding: 26px;
      --ant-popover-title-margin-bottom: 22px;
    }

    &.ant-btn {
      --ant-button-content-font-size-lg: 12px;
      --ant-button-content-font-size: 12px;
      --ant-button-content-font-size-sm: 12px;
    }

    &.ant-table-css-var {
      --ant-table-row-hover-bg: #e6e6e6;
    }

    &.ant-progress {
      --ant-progress-line-border-radius: 2px;
    }

    &.ant-modal-css-var {
      --ant-modal-title-font-size: 14px;
      --ant-modal-header-margin-bottom: 20px;
      --ant-modal-footer-margin-top: 30px;
      --ant-modal-content-padding: 20px 24px 24px;
      --ant-modal-title-color: var(--ant-color-text);
    }
  }

  .css-var-r11.ant-menu-css-var {
    --ant-menu-item-color: var(--color-text-1);
  }

  .css-var-rk.ant-menu-css-var {
    --ant-menu-item-color: var(--color-text-1);
  }

  .css-var-rf.ant-menu-css-var,
  .css-var-ri.ant-menu-css-var,
  .css-var-rh.ant-menu-css-var {
    --ant-menu-item-height: 46px;
    --ant-menu-item-border-radius: 4px;
    --ant-menu-item-selected-color: var(--ant-color-primary);
    --ant-menu-item-color: var(--color-text-1);
    --ant-menu-item-active-bg: rgba(0, 0, 0, 4%);
  }

  .css-var-r0.ant-input-css-var {
    --ant-input-input-font-size: var(--font-size-base);
    --ant-input-input-font-size-lg: var(--font-size-base);
    --ant-input-input-font-size-sm: var(--font-size-base);
    --ant-input-padding-inline-lg: 14px;
  }

  .css-var-r0.ant-select-css-var {
    --ant-select-option-active-bg: var(--color-fill-1);
    --ant-select-option-font-size: var(--font-size-base);
    --ant-select-option-selected-bg: var(--color-selected-bg);
  }
}

body * {
  font-weight: var(--font-weight-normal);
}

body {
  font-family: 'noto sans', sans-serif;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;

  &::-webkit-scrollbar {
    width: 0;
  }

  .ant-modal-confirm-title {
    display: none;
  }

  .ant-slider:hover .ant-slider-handle::after {
    box-shadow: 0 0 0 var(--ant-slider-handle-line-width)
      var(--ant-slider-track-hover-bg);
  }

  .ant-select-selector {
    .ant-select-selection-item {
      font-weight: var(--font-weight-normal);
    }
  }

  .ant-checkbox {
    .ant-checkbox-inner {
      border-radius: var(--checkbox-border-radius) !important;
    }
  }

  // table
  .ant-table-wrapper {
    .ant-table-selection-column {
      padding-inline-start: 16px !important;
    }
  }

  .ant-table-container .ant-table-content table {
    border-spacing: 0 20px;

    .ant-table-thead th.ant-table-column-sort {
      background-color: transparent;

      &::before {
        background-color: var(--ant-table-header-split-color) !important;
      }
    }

    .ant-checkbox {
      .ant-checkbox-inner::after {
        display: flex !important;
      }
    }

    .ant-checkbox-indeterminate .ant-checkbox-inner::after {
      display: flex !important;
    }

    tr > th {
      background-color: var(--color-white-1);
      border: none;
      padding-block: 0;
    }

    tr > td {
      // background-color: var(--color-fill-1);
      border-bottom: none;
      height: 68px;

      &:first-child {
        border-top-left-radius: var(--table-td-radius);
        border-bottom-left-radius: var(--table-td-radius);
      }

      &:last-child {
        border-top-right-radius: var(--table-td-radius);
        border-bottom-right-radius: var(--table-td-radius);
      }
    }
  }

  // input
  .ant-input-css-var.ant-input {
    height: 40px;
  }

  .ant-input-outlined,
  .ant-input-affix-wrapper,
  .ant-picker {
    height: 40px;
  }

  .ant-input-outlined.ant-input-status-error:not(.ant-input-disabled) {
    border: none;
    box-shadow: none;
  }

  .ant-input-outlined.ant-input-status-error:not(.ant-input-disabled):focus,
  .ant-input-outlined.ant-input-status-error:not(
      .ant-input-disabled
    ):focus-within {
    border: none;
    box-shadow: none;
  }

  // input number
  .ant-input-number-outlined.ant-input-number-status-error:not(
      .ant-input-number-disabled
    ) {
    border: none;
    box-shadow: none;
  }

  .ant-input-number-outlined.ant-input-number-status-error:not(
      .ant-input-number-disabled
    ):focus,
  .ant-input-number-outlined.ant-input-number-status-error:not(
      .ant-input-disabled
    ):focus-within {
    border: none;
    box-shadow: none;
  }

  // form item help
  .ant-form-item-with-help .ant-form-item-explain {
    padding-left: 16px;
  }

  // icon
  .anticon {
    &.size-16 {
      font-size: 16px;
    }
  }

  // ============== new theme style start ===============
  .ant-pro-layout {
    background-color: var(--color-fill-1);
    height: 100%;

    .ant-pro-sider-actions-list-item {
      padding: 0;

      &:hover {
        background-color: unset;
      }
    }

    .ant-pro-sider-logo {
      position: relative;
      padding-left: 18px;
      padding-block: 12px;
      border-block-end: none;
    }

    .ant-pro-sider-logo-collapsed {
      padding-left: 12px;

      .collapse-wrap {
        display: none;
        position: absolute;
        top: 12px;

        &::after {
          content: '';
          position: absolute;
          height: 48px;
          width: 64px;
          top: -16px;
          left: -16px;
        }
      }

      &:hover {
        .collapse-wrap {
          display: block;
        }
      }
    }

    .ant-pro-sider .ant-layout-sider-children {
      background-color: var(--color-fill-sider);
      border-right: 1px solid var(--ant-color-border);
    }
  }

  .ant-table-wrapper .ant-table {
    background-color: unset;
  }

  .ant-table-content table {
    .ant-table-thead > tr > th {
      background-color: unset;
    }

    .ant-table-tbody {
      .ant-table-row {
        border-radius: var(--table-td-radius);
        background-color: var(--color-fill-sider);

        > td {
          background-color: unset;
        }
      }
    }
  }

  // ============== new theme style end =================
}

// ======== menu style start ============
.ant-pro-sider-collapsed-button {
  display: none;
}

.ant-pro-layout {
  height: 100vh;

  .ant-menu-inline-collapsed {
    .anticon {
      font-size: 16px;
    }
  }

  .ant-pro-page-container-children-container {
    padding-block: var(--layout-content-blockpadding);
    padding-inline: var(--layout-content-inlinepadding);
  }

  .ant-layout {
    min-height: 100vh;
  }

  .ant-pro-layout-bg-list {
    background: transparent !important;
  }

  .ant-pro-layout-container {
    overflow-x: auto;
    min-height: 100vh;
    // background-color: var(--color-fill-2);
  }

  .ant-pro-sider {
    .ant-pro-base-menu-inline-item-title {
      gap: 12px;
    }

    .ant-menu {
      .ant-menu-item {
        border-radius: var(--border-radius-small);
        color: var(--color-text-1) !important;

        &:active {
          background-color: var(--ant-menu-item-selected-bg);
        }
      }

      .ant-menu-item:not(.ant-menu-item-selected) {
        color: var(--ant-color-text);
      }

      .ant-menu-item:hover {
        color: var(--ant-color-text);
      }

      .ant-menu-item.ant-menu-item-selected:hover {
        color: var(--ant-color-primary) !important;
        background-color: var(--ant-menu-item-selected-bg);
      }

      .ant-menu-item.ant-menu-item-selected {
        color: var(--ant-color-primary) !important;
        background-color: var(--ant-menu-item-selected-bg);
      }
    }
  }
}

// ======== menu style end ============
.ant-menu-submenu-popup {
  .ant-menu-sub {
    .ant-menu-item-only-child {
      height: 40px;
      line-height: 40px;
      color: var(--color-text-1);

      .anticon {
        font-size: var(--font-size-middle);
      }
    }

    .new-icon {
      position: relative;
      bottom: 3px;
      display: flex;
      color: #fff;
      width: 36px;
      height: 15px;
      margin-left: 5px;
      justify-content: center;
      align-items: center;
      background-color: var(--ant-orange-5);
      border-radius: 8px 8px 8px 0;
      transform: scale(0.9);

      .text {
        transform: scale(0.8);
        line-height: 1em;
      }
    }
  }
}

.ant-menu {
  .ant-menu-submenu-title {
    color: var(--color-text-1) !important;
  }
}

.user-menu-container {
  .user-avatar.ant-menu-submenu {
    .ant-menu-submenu-title {
      padding-left: 10px;
      color: var(--color-text-1) !important;
    }
  }

  &.user-menu-collapsed {
    .ant-menu-submenu-title {
      display: flex;
      justify-content: center;
      align-items: center;
      color: var(--color-text-1) !important;
      padding-inline: unset !important;
      width: 100%;
      margin-inline: 0 !important;
    }

    .user-avatar.ant-menu-submenu {
      .ant-menu-submenu-title {
        padding: 0 !important;
        display: flex;
        justify-content: center;

        .ant-menu-title-content {
          display: none;
        }
      }
    }

    .sub-title {
      display: none !important;
    }
  }

  .ant-menu-submenu-title {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    color: var(--color-text-1) !important;
  }
}

.ant-menu-submenu-popup > .ant-menu {
  border-radius: var(--menu-border-radius-base);
}

// ======== monaco editor style ============
.monaco-editor {
  border-radius: 8px;
}

.ant-modal-centered.ant-modal-wrap {
  &::-webkit-scrollbar {
    width: 0;
  }

  &::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 4px;
  }

  &::-webkit-scrollbar-track {
    background-color: transparent;
  }

  &:hover {
    &::-webkit-scrollbar-thumb {
      background-color: var(--scrollbar-handle-bg);
      border-radius: 4px;
    }
  }
}

.custome-scrollbar {
  &::-webkit-scrollbar {
    width: var(--scrollbar-size);
  }

  &::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 4px;
  }

  &::-webkit-scrollbar-track {
    background-color: transparent;
  }

  &:hover {
    &::-webkit-scrollbar-thumb {
      background-color: var(--color-scrollbar-thumb);
      border-radius: 4px;
    }
  }
}

.custom-scrollbar-horizontal {
  &::-webkit-scrollbar {
    height: var(--scrollbar-size);
  }

  &::-webkit-scrollbar-thumb {
    background-color: transparent;
    border-radius: 4px;
  }

  &::-webkit-scrollbar-track {
    background-color: transparent;
  }

  &:hover {
    &::-webkit-scrollbar-thumb {
      background-color: var(--color-scrollbar-thumb);
      border-radius: 4px;
    }
  }
}

.rc-virtual-list-scrollbar {
  width: var(--scrollbar-size) !important;
}

.ant-dropdown-menu
  .ant-dropdown-menu-item.ant-dropdown-menu-item-danger:not(
    .ant-dropdown-menu-item-disabled
  ):hover {
  background-color: var(--ant-color-error-bg) !important;
  color: var(--ant-color-error) !important;
}

.ant-image {
  border-radius: var(--border-radius-base);
  overflow: hidden;

  .ant-image-mask {
    background: rgba(0, 0, 0, 25%);
  }
}

.ant-upload.ant-upload-drag {
  background: none;
}

.ant-message-notice-wrapper {
  .ant-message-notice-error {
    .ant-message-notice-content {
      background-color: var(--ant-color-error-bg);
      color: var(--ant-color-error);
      // custom scrollbar
      &::-webkit-scrollbar {
        width: 6px;
      }

      &::-webkit-scrollbar-thumb {
        background-color: transparent;
        border-radius: 4px;
      }

      &::-webkit-scrollbar-track {
        background-color: transparent;
      }

      &:hover {
        &::-webkit-scrollbar-thumb {
          background-color: var(--ant-color-fill);
          border-radius: 4px;
        }
      }
    }
  }

  .ant-message-notice-success {
    .ant-message-notice-content {
      background-color: var(--ant-color-success-bg);
      color: var(--ant-color-success);
    }
  }

  .ant-message-notice-content {
    border-radius: var(--border-radius-base) !important;
    line-height: 2;
    max-width: 300px;
    text-align: left;
    word-break: break-word;
    box-shadow: var(--ant-box-shadow-secondary) !important;
    max-height: 140px;
    overflow-y: auto;

    .anticon {
      padding-top: 5px;
    }
  }

  .ant-message-custom-content {
    align-items: flex-start !important;
  }
}

// =============== segment start==============
.ant-segmented .ant-segmented-item::after {
  border-radius: var(--border-radius-mini);
}

// =============== segment end ===============

.background {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-color: var(--color-white-1);

  &::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: 1;
    height: 100%;
  }
}

.full-wrap::after {
  content: '';
  display: flex;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  z-index: 1;
}

.login-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  min-height: 100vh;
  z-index: -1;
  background: url('@/assets/images/bg-2.png') center center no-repeat;
  background-size: cover;
  opacity: 0.6;
}

.ant-pro-page-container {
  background: transparent;

  .ant-page-header-heading {
    min-width: max-content;
  }
}

@keyframes skeleton-loading {
  0% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0 50%;
  }
}

.skeleton-loading {
  animation: skeleton-loading 2.5s ease infinite;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 4%) 25%,
    rgba(0, 0, 0, 8%) 37%,
    rgba(255, 255, 255, 4%) 63%
  );
  background-size: 400% 100%;
}

.ant-modal {
  max-width: 100vw;

  .ant-modal-title {
    font-weight: var(--font-weight-bold);
  }
}

.ant-drawer .ant-drawer-title {
  font-weight: var(--font-weight-bold);
}

.ant-cascader-menu-item.ant-cascader-menu-item-active {
  background-color: var(--ant-select-option-selected-bg) !important;
}

.ant-cascader-dropdown .ant-cascader-menu {
  flex-grow: unset;
}

.cascader-popup-wrapper {
  width: 100%;
  border: 1px solid var(--ant-color-border);
  inset: 54px auto auto 0 !important;
  border-radius: 0 0 var(--border-radius-base) var(--border-radius-base);
  border-top: none;
  max-height: 240px;
  min-height: 100px;

  &.gpu-selector {
    .ant-cascader-menu:last-child {
      flex: auto;

      .ant-cascader-menu-item {
        display: flex;

        .ant-cascader-checkbox {
          align-self: flex-start;
          margin-top: 5px;
        }
      }
    }
  }

  .ant-cascader-menu {
    overflow-x: hidden;

    &::-webkit-scrollbar {
      width: var(--scrollbar-size);
    }

    &::-webkit-scrollbar-thumb {
      background-color: transparent;
      border-radius: 4px;
    }

    &::-webkit-scrollbar-track {
      background-color: transparent;
    }

    &:hover {
      &::-webkit-scrollbar-thumb {
        background-color: var(--color-scrollbar-thumb);
        border-radius: 4px;
      }
    }

    .ant-cascader-menu-item-content {
      width: 100%;
      padding-right: 11px;
    }
  }
}

.ant-tooltip-content {
  .ant-tooltip-inner {
    a {
      color: var(--ant-color-link-hover);
    }
  }
}

.ant-tooltip-inner {
  .text-tertiary {
    color: var(--color-white-secondary);
  }
}

.tooltip-wrapper {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  background-color: rgba(255, 255, 255, 80%);
  min-width: 100px;
  max-width: 360px;

  .tooltip-x-name {
    font-size: var(--font-size-base);
    color: var(--ant-color-text-tertiary);
  }

  .tooltip-item {
    color: var(--ant-color-text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;

    .tooltip-item-title {
      margin-right: 2px;
    }

    .tooltip-value {
      margin-left: 10px;
      color: var(--ant-color-text);
      text-overflow: ellipsis;
      overflow: hidden;
    }
  }
}

.ant-pro-sider-logo + div {
  &::-webkit-scrollbar {
    width: 0;
  }
}

.ant-notification .ant-notification-notice-close {
  width: fit-content !important;
}
