@border-color: var(--gray-150);
@bg-secondary: var(--gray-10);
@radius: 8px;
@mono-font: 'Monaco', 'Consolas', monospace;

// Root container for extension pages to ensure 100% height
.extension-page-root {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--gray-0);
  position: relative;
}

.layout-wrapper {
  display: flex;
  flex: 1;
  min-height: 0;
  height: 100%;
}

/* Sidebar List */
.sidebar-list {
  width: 280px;
  border-right: 1px solid @border-color;
  background-color: @bg-secondary;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;

  .search-box {
    padding: 12px 12px 0;

    .search-input :deep(.ant-input) {
      height: 28px;
    }
  }

  .list-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
}

.list-item {
  padding: 10px 12px;
  border-radius: @radius;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--gray-50);
  background-color: var(--gray-0);

  &:hover {
    border-color: @border-color;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }

  &.active {
    background-color: var(--gray-0);
    border-color: @border-color;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  }

  .item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;

    .item-icon,
    .server-icon {
      width: 16px;
      height: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      color: var(--gray-400);
      font-size: 14px; // For emoji icons
    }

    .item-name {
      flex: 1;
      font-size: 14px;
      font-weight: 500;
      color: var(--gray-700);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

  .item-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .item-desc {
    font-size: 12px;
    color: var(--gray-400);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  &.active {

    .item-icon,
    .server-icon {
      color: var(--main-color);
    }

    .item-name {
      color: var(--gray-900);
    }
  }
}

.list-item .item-details-inline {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.item-meta {
  font-size: 12px;
  color: var(--gray-500);
}

.list-separator {
  display: none;
}

/* Main Panel */
.main-panel {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--gray-0);

  .unselected-state {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: @bg-secondary;

    .hint-box {
      text-align: center;

      p {
        margin-top: 12px;
        color: var(--gray-400);
      }
    }
  }

  .panel-top-bar {
    padding: 10px 16px 0 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;

    h2 {
      margin: 0;
      font-size: 18px;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .panel-title-row {
      min-height: 32px;
    }

    .panel-title-stack {
      min-height: 32px;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .panel-title-meta {
      font-size: 12px;
      color: var(--gray-500);
      border-radius: 4px;
      margin-top: 4px;
      display: inline-block;
      user-select: text;
    }

    .panel-title-icon {
      color: var(--gray-700);
      flex-shrink: 0;
    }

    .panel-actions {
      display: flex;
      align-items: center;
    }
  }
}

/* Tabs inside main panel */
.detail-tabs,
.minimal-tabs {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;

  :deep(.ant-tabs-nav) {
    margin: 0;
    padding: 0 16px;
    flex-shrink: 0;
    border-bottom: 1px solid @border-color;

    &::before {
      border-bottom: none;
    }
  }

  :deep(.ant-tabs-content) {
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
  }

  :deep(.ant-tabs-tabpane) {
    height: 100%;
    min-height: 0;
    overflow: hidden;
  }
}

.detail-tabs {
  .tab-content {
    padding: 16px;
    min-height: 300px;
    height: 100%;
    overflow: auto;
  }

  .empty-tab {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
  }
}

.tab-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.info-grid {
  display: grid;
  gap: 16px;

  .info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;

    label {
      font-size: 12px;
      color: var(--gray-500);
      font-weight: 500;
    }

    > span {
      font-size: 14px;
      color: var(--gray-900);
    }
  }
}

.extension-form {
  .form-item {
    margin-bottom: 16px;
  }
}

.mono-text {
  font-family: @mono-font;
}

.code-inline {
  font-family: @mono-font;
  font-size: 13px;
  background: var(--gray-50);
  padding: 8px 12px;
  border-radius: 4px;
}

.code-pre {
  font-family: @mono-font;
  font-size: 12px;
  background: var(--gray-50);
  padding: 12px;
  border-radius: 4px;
  margin: 0;
  overflow-x: auto;
}

.code-panel {
  background: var(--gray-50);
  border: 1px solid var(--gray-150);
  border-radius: @radius;
  padding: 16px;
}

.code-panel-pre {
  margin: 0;
  font-family: @mono-font;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--gray-700);
}

.text-break-all {
  word-break: break-all;
}

/* Common helpers */
.text-muted {
  color: var(--gray-400);
}

.empty-text {
  padding: 40px 0;
  text-align: center;
  color: var(--gray-400);
}

// Spin wrapper for full height
.full-height-spin {
  height: 100%;

  :deep(.ant-spin-nested-loading) {
    height: 100%;
  }

  :deep(.ant-spin-container) {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
}

/* Loading States */
.loading-bar-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 100;
  overflow: hidden;
  background: transparent;

  .loading-bar {
    height: 100%;
    background: var(--main-color);
    width: 30%;
    position: absolute;
    animation: loading-bar-anim 1.5s infinite linear;
  }
}

@keyframes loading-bar-anim {
  0% {
    left: -30%;
  }

  100% {
    left: 100%;
  }
}

.content-loading {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.2s;
}