/* Copyright 2026 Mozilla Foundation
 *
 * 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.
 */

#font-panel {
  flex: 1 1 0;
  overflow: auto;
  min-width: 0;
  min-height: 0;
  background: var(--surface-bg);
  border-radius: 4px;
  border: 1px solid var(--border-color);
}

.font-list {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}

.font-item {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-subtle-color);
  cursor: pointer;

  &:last-child {
    border-bottom: none;
  }

  &:hover {
    background: var(--hover-bg);
  }

  &.selected {
    background: color-mix(
      in srgb,
      var(--font-highlight-color, #0070c1) 12%,
      transparent
    );
  }
}

.font-download-button {
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 3px;
  border: 1px solid var(--input-border-color);
  background: var(--button-bg);
  color: inherit;
  cursor: pointer;

  &::before {
    content: "";
    display: block;
    width: 14px;
    height: 14px;
    margin: auto;
    background: currentColor;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z'/%3E%3Cpolyline points='17 21 17 13 7 13 7 21'/%3E%3Cpolyline points='7 3 7 8 15 8'/%3E%3C/svg%3E");
    mask-size: contain;
    mask-repeat: no-repeat;
    mask-position: center;
  }

  &:hover:not(:disabled) {
    background: var(--button-hover-bg);
  }

  &:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
  }
}

.font-name {
  font-weight: bold;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.font-loaded-name {
  font-size: 0.85em;
  color: var(--muted-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.font-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 3px;
}

.font-tag {
  font-size: 0.75em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--hover-bg);
  color: var(--muted-color);
  border: 1px solid var(--border-subtle-color);
}

.font-empty {
  padding: 8px 10px;
  color: var(--muted-color);
  font-style: italic;
  list-style: none;
}

#font-view-button {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: bold;
  font-style: normal;
}

.font-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-color);
}

.font-color-button {
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  padding: 3px;
  border-radius: 3px;
  border: 1px solid var(--input-border-color);
  background: var(--button-bg);
  cursor: pointer;

  &:hover {
    background: var(--button-hover-bg);
  }
}

.font-color-swatch {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 2px;
  background: var(--font-highlight-color, #0070c1);
}
