/*
 * SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
 *
 * SPDX-License-Identifier: Apache-2.0
 */

@use 'font';
@use 'variables';

main {
  background: var(--ant-layout-body-bg);
  height: calc(100vh - 130px);
  overflow: auto;

  .content-outer-wrap,
  .content-inner-wrap {
    padding: var(--ant-padding-xl);
  }

  .content-inner-wrap {
    border-radius: 12px;
    background-color: var(--ant-color-bg-base);
    box-shadow: 4px 4px 4px 0 rgba(0, 0, 0, 0.1);
  }
}

.pointer {
  cursor: pointer;
}

.nowrap {
  white-space: nowrap;
  max-width: 150px;
}

.full-width {
  width: 100%;
}

.relative {
  position: relative;
}

.link {
  color: var(--secondary-color-2);
  cursor: pointer;
}

.header-row {
  margin-bottom: var(--ant-margin-lg);
}

.gradient {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('/gradient.svg');
  background-size: cover;
  z-index: 1;

  &.dark {
    background-image: url('/gradient-dark.svg');
  }
}

.fade-enter {
  opacity: 0;
}
.fade-enter-active {
  opacity: 1;
  transition: opacity var(--ant-motion-duration-mid) ease-in;
}
.fade-exit {
  opacity: 1;
}
.fade-exit-active {
  opacity: 0;
  transition: opacity var(--ant-motion-duration-mid) ease-out;
}

.ant-layout-content {
  > div {
    position: relative;
    z-index: 10;
  }
}

button.secondary {
  background-color: var(--secondary-color-2);
  color: white;
  border: 0;
  &:not(:disabled):not(.ant-btn-disabled):hover {
    background-color: var(--secondary-color-3);
    color: white;
  }
}

.ant-table-wrapper .ant-table-cell,
.ant-table-wrapper .ant-table-thead > tr > th,
.ant-table-wrapper .ant-table-tbody > tr > th,
.ant-table-wrapper .ant-table-tbody > tr > td,
.ant-table-wrapper tfoot > tr > th,
.ant-table-wrapper tfoot > tr > td {
  padding: var(--ant-padding-xs) var(--ant-padding-xs);
}

.ant-table-wrapper {
  width: 100%;
  overflow-x: auto;
}

.ant-card .ant-tabs-content-holder {
  padding: 0 4px;
}

.ant-table {
  .selected-row {
    background: var(--ant-table-row-hover-bg);
    .column-id h4 {
      color: var(--secondary-color-3);
    }
  }

  .ant-table-expanded-row {
    .nested {
      padding: var(--ant-padding-md);

      .ant-table {
        margin-block: 0 !important;
        margin-inline: 0 !important;
      }
    }
  }

  .arrow {
    transition: 250ms ease-in-out;
    &.rotate {
      transform: rotate(180deg);
    }
  }

  .column-actions {
    button {
      margin-left: var(--ant-margin-xs);
      color: black !important;

      &:hover {
        color: var(--secondary-color-3) !important;
      }

      &.ant-btn-color-dangerous:hover {
        color: var(--ui-color-error) !important;
      }

      svg {
        width: 16px;
        height: 16px;
      }
    }
  }

  .row-origin-cs {
    padding: 4px;
    border-radius: 4px;
    border-left: 3px solid #52c41a !important;
    background-color: rgba(82, 196, 26, 0.05);
    transition: background-color 0.3s ease;
  }

  .row-origin-csms {
    padding: 4px;
    border-radius: 4px;
    border-left: 3px solid #1890ff !important;
    background-color: rgba(24, 144, 255, 0.05);
    transition: background-color 0.3s ease;
  }

  .highlighted-correlation-cell {
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
  }

  .column-message {
    max-width: 60%;
    word-break: break-word;
  }
}

.ant-table-cell.ant-table-cell-row-hover.column-id:hover {
  background-color: var(--secondary-color-2);
}

.ant-table-cell.ant-table-cell-row-hover.column-name:hover {
  background-color: var(--secondary-color-2);
}

.ant-table-cell.ant-table-cell-row-hover.column-idToken:hover {
  background-color: var(--secondary-color-2);
}

.ant-table-cell.ant-table-cell-row-hover.column-transactionId:hover {
  background-color: var(--secondary-color-2);
}

.ant-drawer {
  .ant-drawer-body {
    padding: var(--ant-padding-xxs) var(--ant-padding-xs);
  }

  .ant-drawer-header {
    padding: var(--ant-padding-xs) var(--ant-padding-sm);
  }
}

.ant-input-disabled,
.ant-input-number-disabled,
.ant-select-disabled .ant-select-selector,
.ant-picker-disabled,
.ant-switch-disabled,
.ant-checkbox-wrapper-disabled .ant-checkbox,
.ant-btn-disabled {
  background-color: #fbfbfb !important;
  color: #8c8c8c !important;
}

.ant-layout {
  background: transparent;
  height: 100vh;
}

/* Animation for grow from center */
.button-grow-enter {
  transform: scale(0.9);
  opacity: 0;
}

.button-grow-enter-active {
  transform: scale(1);
  opacity: 1;
  transition:
    transform 300ms ease,
    opacity 300ms ease;
}

.button-grow-exit {
  transform: scale(1);
  opacity: 1;
}

.button-grow-exit-active {
  transform: scale(0.9);
  opacity: 0;
  transition:
    transform 300ms ease,
    opacity 300ms ease;
}

.chart-wrapper {
  display: flex;
  flex: 1;
  flex-direction: column;
  height: 400px;
  background: var(--ant-color-primary-bg);
  margin: var(--ant-margin-xs);

  text {
    fill: var(--ant-color-text-base);
  }
}
