// Copyright (C) 2026 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

.pf-memscope-page__container {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100%;
  background: var(--pf-color-background);
}

.pf-memscope-page {
  width: 100%;
  max-width: 1600px;
  margin-inline: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

// Page title bar.
.pf-memscope-title-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;

  h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    text-transform: uppercase;
    align-self: center;
    color: var(--pf-color-text-muted);
  }
}

.pf-memscope-status-bar__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pf-color-success);
  flex-shrink: 0;
  animation: pf-memscope-pulse 2s ease-in-out infinite;

  &--paused {
    background: var(--pf-color-warning);
    animation: none;
  }
}

@keyframes pf-memscope-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.pf-memscope-error {
  color: var(--pf-color-error);
  font-size: var(--pf-font-size-s);
}

.pf-memscope-oom-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pf-memscope-search-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
}

// Hero connect / idle state.
.pf-memscope-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 48px 24px;
  border-radius: 8px;
  border: 1px dashed var(--pf-color-border-secondary);
  text-align: center;
}

.pf-memscope-hero__icon {
  font-size: 48px;
  color: var(--pf-color-text-muted);
  opacity: 0.5;
}

.pf-memscope-hero__text {
  font-size: var(--pf-font-size-m);
  color: var(--pf-color-text-muted);
  max-width: 420px;
  line-height: 1.5;
}

.pf-memscope-hero__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pf-memscope-device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 400px;
}

.pf-memscope-page {
  .pf-memscope-profile-btn {
    visibility: hidden;
  }

  .pf-grid__row:hover .pf-memscope-profile-btn {
    visibility: visible;
  }

  .pf-grid__header {
    background: var(--pf-color-background);
    color: var(--pf-color-text-muted);
    user-select: none;
    text-transform: uppercase;
  }

  .pf-grid__body {
    background: var(--pf-color-background-secondary);
  }

  // Zero-padding for the profile button cell in the process table.
  .pf-grid-cell:has(.pf-memscope-profile-btn) {
    --pf-cell-padding-block: 0;
    --pf-cell-padding-inline: 2px;
  }

  // Drop the panel body padding when it wraps a grid — the grid's own
  // header/cell padding is enough.
  .pf-memscope-panel__body:has(> .pf-grid) {
    padding: 0;
  }
}

.pf-memscope-color-chip {
  --_mixed: color-mix(
    in srgb,
    var(--pf-memscope-chip-color, var(--pf-color-text)) 75%,
    var(--pf-color-background)
  );
  color: var(--pf-chart-color-on);
  background: var(--_mixed);
  border-color: var(--_mixed);
}
