.cbx-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 38px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  z-index: 1000;
  background: linear-gradient(135deg, #2d2d2d 0%, #1f1f1f 100%);
  border-bottom: 1px solid #404040;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  color: #ffffff;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;

  &:not(.visible) {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-100%);
  }

  .header-left,
  .header-right {
    display: flex;
    align-items: center;
    z-index: 1;
  }

  .icon-btn {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;

    .icon {
      font-size: 18px;
      line-height: 1;
    }

    &:hover {
      background: rgba(255, 255, 255, 0.12);
    }

    &:last-child {
      margin-right: 0;
    }

    &.close-btn {
      .icon {
        font-size: 22px;
        font-weight: bold;
      }

      &:hover {
        background: rgba(239, 68, 68, 0.2);
      }
    }

    &.active {
      color: #ef4444;
      background: rgba(239, 68, 68, 0.15);
    }

    &.has-notes {
      color: #ffc107;
      position: relative;
    }

    .indicator-dot {
      position: absolute;
      top: 4px;
      right: 4px;
      width: 8px;
      height: 8px;
      background: #ffc107;
      border-radius: 50%;
      border: 1px solid #1f1f1f;
    }
  }

  .book-title {
    flex: 1;
    min-width: 0;
    padding: 0 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    color: inherit;
    pointer-events: none;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-only {
    display: none;
  }

  .overflow-menu {
    position: relative;
  }

  .overflow-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
  }

  .overflow-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    min-width: 180px;
    padding: 4px;
  }

  .overflow-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 13px;
    cursor: pointer;
    border-radius: 6px;
    white-space: nowrap;

    &:hover {
      background: rgba(255, 255, 255, 0.12);
    }

    &.active {
      color: #ef4444;
      background: rgba(239, 68, 68, 0.15);
    }
  }
}

@media (max-width: 600px) {
  .cbx-header {
    padding: 0 4px;

    .icon-btn {
      padding: 5px;
      margin-right: 6px;

      app-reader-icon {
        transform: scale(0.9);
      }
    }

    .book-title {
      font-size: 12px;
    }

    .desktop-only {
      display: none;
    }

    .mobile-only {
      display: block;
    }
  }
}
